JSON API 与 moshi 的关系

JSON API relationships with moshi

我收到的回复 JSON 理论上符合 JSON API 规范。我正在尝试使用 moshi-jsonapi library 进行解析,但我不知道如何解析 some_objects 关系。在 SomeType class 中,我有一个成员 HasMany<SomeObject> someObjects 并且 class SomeObject 以正确的方式注释:

@JsonApi(type = "some_objects")
public class SomeObject extends Resource {
//....
}

但是,在进行解析之后,我得到的 someObjects 成员为空。有人知道为什么吗?

JSON 是那个:

  "links": {
    "self": "someurl/params"
  },
  "data": [
    {
      "type": "some_type",
      "id": "12345",
      "attributes": {
        "attr1": 1,
        "attr2": 2,
        "attr3": 3
      },
      "relationships": {
        "some_objects": {
          "data": [
            {
              "type": "some_objects",
              "id": "1"
            },
            {
              "type": "some_objects",
              "id": "2"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "type": "some_objects",
      "id": "1",
      "attributes": {
        "id": "1",
        "parentId": "1"
      },
      "relationships": {
        "subobjects": {
          "data": [
            {
              "type": "subobjects",
              "id": "2"
            }
          ]
        }
    }
    {
      "type": "subobjects",
      "id": "2",
      "attributes": {
        "metadata": {
            "code": "AA"
        },
        "id": "2",
        "parentId": "1"
      }
    }
  ],
  "meta": {
    "total": 1,
    "totalCount": 1,
    "correction": []
  }
}

唯一的问题是成员的名字,在将 someObjects 更改为 'some_objects' 之后,它就像一个魅力。