mike-north / jsonapi-typescript

TypeScript type information for JSON:API documents
52 stars 5 forks source link

Pagination in compound object #126

Open ericdevries opened 4 years ago

ericdevries commented 4 years ago

Describe the bug The types do not allow for pagination in relationship objects. For example, in the below bit of JSON I would like to add a next relationship to the comments, but the type can only be of type Links which includes self and related and none of the PaginationLinks types.

{
  "data": [{
    "type": "articles",
    "id": "1",
    "attributes": {
      "title": "JSON:API paints my bikeshed!"
    },
    "links": {
      "self": "http://example.com/articles/1"
    },
    "relationships": {
      "comments": {
        "links": {
          "self": "http://example.com/articles/1/relationships/comments",
          "related": "http://example.com/articles/1/comments",
          "next": "http://example.com/articles/1/comments?next=5"
        },
        "data": [
          { "type": "comments", "id": "5" }
        ]
      }
    }
  }],
  "included": [{
    "type": "comments",
    "id": "5",
    "attributes": {
      "body": "First!"
    },
    "relationships": {
      "author": {
        "data": { "type": "people", "id": "2" }
      }
    },
    "links": {
      "self": "http://example.com/comments/5"
    }
  }]
}

Expected behavior I expect it to allow for all the attributes of the PaginationLinks type.