Skip to content

Bugs around empty included[] in response #991

Closed
@bart-degreed

Description

@bart-degreed

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions