Closed falbert-ptc closed 1 month ago
First, 5.1 System Query Options states that
The same system query option, irrespective of casing or whether or not it is prefixed with a $, MUST NOT be specified more than once for any resource.
We could, and probably should repeat that statement for nested query options in $expand
and $select
, see #2008.
5.1.3 System Query Option $expand states that
A path MUST NOT appear in more than one expand item.
This rules out example 3 above.
5.1.4 System Query Option $select does not exclude specifying a selected property more than once because it doesn't harm to say "I want this" more than once.
It does explicitly exclude duplicate or conflicting nested options:
The same property MUST NOT have select options specified in more than one place in a request and MUST NOT be specified in more than one expand.
11.2.6.2 System Query Option $orderby states that
Items are sorted by the result values of the first expression, and then items with the same value for the first expression are sorted by the result value of the second expression, and so on.
This means that specifying a property more than once does not have an effect on the outcome because it would sort items with the same value of the expression, and servers can just drop repeated expressions.
5.1.10 System Query Option $compute states that
[The name of the computed dynamic property] MUST differ from the names of declared or dynamic properties of the identified resources.
Which includes names of other computed dynamic properties.
Does this (with the addition of #2008) answer your question?
Hello @ralfhandl
Yes it does, thank you very much ! I missed some of these (especially "A path MUST NOT appear in more than one expand item."), and I apologize.
Thanks again for the quick and clear response.
Hi @falbert-ptc,
Please don't apologize, we are grateful for any feedback.
If you have proposals to increase readability and making such statements easier to find, please don't hesitate to tell us.
It is really hard for us to fix readability issues - we know that something is written somewhere, which makes it easier to find 🙄
Thanks in advance Ralf
Let's take the following examples:
Grammatically, the requests above are correct (per the ABNF. ).
Semantically however, they are confusing and/or full of contradictions. Is there any guidance about how OData services should handle duplicate expandItem/orderbyItem/etc. ?
The current example TripIn service does not error out, but only considers the last item. Not sure if that's intended or an oversight. Ex: https://services.odata.org/V4/TripPinService/People?$select=UserName&$expand=Trips($select=TripId,Name),Trips($filter=Name eq 'Gradutaion trip'),Trips($filter=Name eq 'Trip in US')