-
Notifications
You must be signed in to change notification settings - Fork 890
Clarify processing rules for malformed ext
and profile
members of JSON:API object
#1607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… JSON:API object The applied extension and profiles must be provided as `ext` and `profile` media type parameters of `Content-Type` header. Additionally they may be listed as `jsonapi.ext` and `jsonapi.profile` member of a JSON:API document. This opens up the possibility of having different values in both places. So far the specification has not defined processing rules for such malformed documents. This clarifies that a client and server must honor the `Content-Type` header in case of a conflict. Additionally it clarifies that they should not reject the document but ignore the invalid `jsonapi.ext` and/or `jsonapi.profile` members. Ignoring them in case of a conflict rather than rejecting the document allows server and clients to _not_ process them at all - even if present. This avoids computing overhead just for the sake of validating the document.
I agree entirely with the sentiment behind this PR, which is that content negotiation should occur using headers ( I believe that the guarantees we want to provide are:
I think this combination of guarantees should prevent unnecessary validation while still providing a reasonable assumption of correctness if these members are present. @jelhan what do you think? Would this combination of normative changes address your concerns? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think your proposal makes sense. Enforcing validation was not my intent. I provided a potential rewording as review comment.
To be honest I'm not sure what value ext
and profile
members of jsonapi
provide. They seem to only duplicate information already available in Content-Type
header. Not sure if I missed a relevant discussion about the use cases they address.
Co-authored-by: Jeldrik Hanschke <jelhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the adjustments, @jelhan. Another good clarification!
The applied extension and profiles must be provided as
ext
andprofile
media type parameters ofContent-Type
header. Additionally they may be listed asjsonapi.ext
andjsonapi.profile
member of a JSON:API document.This opens up the possibility of having different values in both places. So far the specification has not defined processing rules for such malformed documents.
This clarifies that a client and server must honor the
Content-Type
header in case of a conflict. Additionally it clarifies that they should not reject the document but ignore the invalidjsonapi.ext
and/orjsonapi.profile
members.Ignoring them in case of a conflict rather than rejecting the document allows server and clients to not process them at all - even if present. This avoids computing overhead just for the sake of validating the document.
Closes #1359