JSONAPI icon indicating copy to clipboard operation
JSONAPI copied to clipboard

Handle unexpected relationships in json?

Open scotsimon opened this issue 9 months ago • 1 comments

We have run into situations where the API gets a bit ahead of our application and the endpoint returns a relationship that hasn't been defined in the application's object model yet.

For example, a JSONAPI ResourceObjectDescription might include a relationship for 'person' and 'address'. The API returns /included data for 'person', 'address' and 'email'.

In this case, the decoding fails and returns a message along the lines of: Out of the 3 includes in the document, the 1st one failed to parse: Found JSON:API type ‘email’ but expected one of ‘person’, ‘address’

The API team is trying to avoid strict API versioning, so I have been asked if there is a way to circumvent this error in the event that unexpected data is found in the json.

Thoughts?

scotsimon avatar Apr 21 '25 13:04 scotsimon