Skip to content
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

is empty include allowed? #1530

Closed
freddrake opened this issue Dec 31, 2020 · 1 comment · Fixed by #1532
Closed

is empty include allowed? #1530

freddrake opened this issue Dec 31, 2020 · 1 comment · Fixed by #1532

Comments

@freddrake
Copy link
Contributor

Both the 1.0 and 1.1 versions of the specification state:

The value of the include parameter MUST be a comma-separated (U+002C COMMA, “,”)
list of relationship paths. A relationship path is a dot-separated (U+002E FULL-STOP, “.”)
list of relationship names.

It is unclear whether an empty value for include represents an empty list of relationship paths or a single (invalid) relationship path.

@jelhan
Copy link
Contributor

jelhan commented Jan 2, 2021

This seems to be unclear from the specification indeed. I think it should be considered as supported because otherwise a client would not be able to request to not include any resource.

The specification allows a server to include related resources by default:

An endpoint MAY return resources related to the primary data by default.

It allows a client to tell the server, which resources should be included:

An endpoint MAY also support an include request parameter to allow the client to customize which related resources should be returned.

[...]

If an endpoint supports the include parameter and a client supplies it, the server MUST NOT include unrequested resource objects in the included section of the compound document.

Using an empty include query parameter a client can tell the server to not include any related resources. Even if the server would do so by default.

For Sparse Fieldsets the meaning of an empty list is explicitly specified:

Sparse Fieldsets
[...]
The value of any fields[TYPE] parameter MUST be a comma-separated (U+002C COMMA, “,”) list that refers to the name(s) of the fields to be returned. An empty value indicates that no fields should be returned.

I think such a clarification should be added for include query parameter as well. At least if my interpretation of the specification is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants