Skip to content

Bugs around empty included[] in response #991

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

Closed
bart-degreed opened this issue May 7, 2021 · 0 comments · Fixed by #1012
Closed

Bugs around empty included[] in response #991

bart-degreed opened this issue May 7, 2021 · 0 comments · Fixed by #1012
Labels

Comments

@bart-degreed
Copy link
Contributor

The json:api spec defines conditions on when included must/must not occur in responses:

If a document does not contain a top-level data key, the included member MUST NOT be present either.
https://jsonapi.org/format/1.1/#document-top-level

If an endpoint supports the include parameter and a client supplies it:
The server’s response MUST be a compound document with an included key — even if that included key holds an empty array (because the requested relationships are empty).
https://jsonapi.org/format/1.1/#fetching-includes

JADNC currently never emits an empty included array, while it should in case the user passed an include query string parameter. It should also emit an empty array on /articles/1/author?include=posts when the author relationship is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 participant