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

Instance annotations and control information for a null result #2018

Open
HeikoTheissen opened this issue Oct 24, 2024 · 1 comment · May be fixed by #2019
Open

Instance annotations and control information for a null result #2018

HeikoTheissen opened this issue Oct 24, 2024 · 1 comment · May be fixed by #2019
Assignees
Labels
JSON Format JSON Format Protocol Protocol, URL Conventions V5.0

Comments

@HeikoTheissen
Copy link
Contributor

HeikoTheissen commented Oct 24, 2024

According to OData-JSON, section 11, an individual property or operation response with value null must be returned as 204 No Content.

I would like to allow an alternative format of 200 OK with empty JSON payload for structured types and

{"@context": "#«primitive type»",
 "value": null}

for primitive types (which was valid in the 4.0 spec).

This is the only way to add instance annotations or control information to the null result.

Use cases:

  • Instance annotation containing messages that occurred during the operation (and which may explain why the result is null). One could even argue that in the presence of instance annotations the result is not null and must thus be represented with a payload.
  • @deltaLink not only for "sets of results", but also for single-valued results. Could be used to obtain changes to individual properties or related entities, and must then also be issued for a null result.
@ralfhandl ralfhandl moved this to Open in OData TC Oct 24, 2024
@ralfhandl ralfhandl added JSON Format JSON Format V4.02 and removed CSDL JSON labels Oct 24, 2024
@HeikoTheissen HeikoTheissen linked a pull request Oct 25, 2024 that will close this issue
@HeikoTheissen HeikoTheissen self-assigned this Nov 28, 2024
@HeikoTheissen HeikoTheissen added the Protocol Protocol, URL Conventions label Nov 28, 2024
@HeikoTheissen HeikoTheissen moved this from Open to Review in OData TC Jan 15, 2025
@mikepizzo
Copy link
Contributor

mikepizzo commented Jan 15, 2025

  1. This would break backwards compatibility
  2. This would make it harder for clients to check for null (they would have to look for either 204 or a 200 with a value null)

A more compatible change would be to add a header to the 204 No Content that contained the JSON payload.

We don't seem to have a compelling need at this point; we can add the header if we have a requirement before OData 5.

Alternatively, client could specify a preference for return-nulls.

@mikepizzo mikepizzo added V5.0 and removed V4.02 labels Jan 15, 2025
@mikepizzo mikepizzo removed the status in OData TC Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON Format JSON Format Protocol Protocol, URL Conventions V5.0
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants