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

Omission of collection-valued action parameters #2045

Open
HeikoTheissen opened this issue Feb 3, 2025 · 3 comments · May be fixed by #2049
Open

Omission of collection-valued action parameters #2045

HeikoTheissen opened this issue Feb 3, 2025 · 3 comments · May be fixed by #2049
Assignees
Labels

Comments

@HeikoTheissen
Copy link
Contributor

HeikoTheissen commented Feb 3, 2025

OData-JSON, section 18 states

Non-binding parameters that are nullable ... MAY be omitted from the request body. ... it MUST be interpreted as having the null value.

This statement cannot apply to collection-valued parameters, because they can at most be interpreted as having an empty collection as value. Is this meant here?

  • If yes, can an empty collection be omitted even if non-nullable?
  • If not, a collection-valued parameter must always be included even if empty.

Conversely, can an empty array be omitted in a response, similar to omit-values=nulls?

@ralfhandl
Copy link
Contributor

For collection-valued parameters nullable expresses whether null is allowed as collection items. The collection itself cannot be null, it can only be empty.

Given that, omission of a collection-valued parameter means "sender has no opinion, receiver can fill in a default", which may be an empty collection.

@mikepizzo
Copy link
Contributor

Note: a collection-valued parameter is never nullable (nullable=true references the members of the collection-valued parameter, not the parameter itself). Therefore, the statement on nullable non-binding parameters doesn't apply.

In https://oasis-tcs.github.io/odata-specs/odata-csdl-xml/odata-csdl-xml.html#Parameter, we need to update the meaning of nullable in order to cover collection valued parameters, consistent with the json description.

@mikepizzo
Copy link
Contributor

mikepizzo commented Feb 12, 2025

2025-2-12: discussed treating an absent collection valued parameter as up to the service (equivalent to an optional parameter with no defined value), including returning an error. This is arguably the most useful and flexible, and the most backward compatible.

General agreement that this is a reasonable direction.

Heiko will come back with a proposed change.

Also: we noted that text on omit-null shouldn't apply to collection-valued properties (since they are not nullable) but the wording could be made crisper. Heiko will look at this as well. Thanks Heiko! :-)

@HeikoTheissen HeikoTheissen self-assigned this Feb 12, 2025
@HeikoTheissen HeikoTheissen moved this from Open to Review in OData TC Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review
Development

Successfully merging a pull request may close this issue.

3 participants