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

Annotation default values if dynamic expression is null #2057

Open
HeikoTheissen opened this issue Feb 27, 2025 · 2 comments · May be fixed by #2058
Open

Annotation default values if dynamic expression is null #2057

HeikoTheissen opened this issue Feb 27, 2025 · 2 comments · May be fixed by #2058

Comments

@HeikoTheissen
Copy link
Contributor

HeikoTheissen commented Feb 27, 2025

Consider the following annotations:

"@Capabilities.ComputeSupported": {"$Path": "NavigationProperty/BooleanProperty"},
"@Capabilities.SelectSupport": {"ComputeSupported": {"$Path": "NavigationProperty/BooleanProperty"}}

What are the annotation values if the NavigationProperty is null?

SelectSupport/ComputeSupported is effectively not given, because null is not an allowed value. Hence its default value false applies.

ComputeSupported is effectively not given, because null is not an allowed value. But does that mean that the default value true applies? In other words and in XML parlance, is this equivalent to

  • <Annotation Term="Capabilities.ComputedSupported" /> (in which case the DefaultValue="true" would apply) or to

  • no <Annotation> at all? In which case no DefaultValue would apply, but the general remarks would:

    A service is assumed to support by default the following capabilities even though an
    annotation doesn’t exist

    (Here $compute is not mentioned, so the assumption would be "not supported".)

@ralfhandl
Copy link
Contributor

One could argue that these annotations are invalid because the type of the ValuePath expression is "nullable Boolean" and does not match the type of the term or term property "non-nullable Boolean".

Unfortunately we don't go into that level of detail in sections 14.4.1.7 Value Path and 14.4.1.2 Path Evaluation.

@HeikoTheissen
Copy link
Contributor Author

HeikoTheissen commented Feb 28, 2025

One could argue that these annotations are invalid

Yes, but what follows from that? Servers cannot avoid such values if they use dynamic expressions. And the default values should come to the rescue in such cases. We should consider spelling that out in more detail.

@HeikoTheissen HeikoTheissen linked a pull request Mar 1, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open
Development

Successfully merging a pull request may close this issue.

2 participants