Skip to content

Allow custom resource links #1678

Description

@toedter

Maybe I understand something wrong here, but the spec says:

Unless otherwise noted, objects defined by this specification or any applied extensions MUST NOT contain any additional members. Client and server implementations MUST ignore non-compliant members.

Furthermore the spec says:

The optional links member within each resource object contains links related to the resource.

If present, this links object MAY contain a self link that identifies the resource represented by the resource object.

I interpret this language so that the following JSON would NOT be compliant with the spec:

{
  "data": {
    "id": "4",
    "type": "movies",
    "attributes": {
      "title": "The Matrix"
    },
    "links": {
      "imdb": "https://www.imdb.com/title/tt0133093/"
    }
  }
}

If my interpretation is right, please allow custom links. Otherwise many REST hypermedia use cases could not be implemented in a spec-compliant way.

If my interpretation is wrong, please clarify the language of the spec by explicitly adding language to allow custom resource links.

Just a side note: If you validate the above JSON with https://www.jsonschemavalidator.net/ (and use the provided JSON:API schema), it says it is valid JSON:API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions