Clarify domain of index systemQueryOption
Closed this issue ยท 5 comments
The spec states:
11.4.11 Positional Inserts
Collections of entity, complex, or primitive types annotated with the Core.PositionalInsert term (see [OData-VocCore]) support inserting items at a specific location via POST requests to the collection URL using the $index system query option. The value of the $index system query option is the zero-based ordinal position where the item is to be inserted. The ordinal positions of items within the collection greater than or equal to the inserted position are increased by one. A negative ordinal number indexes from the end of the collection, with -1 representing an insert as the last item in the collection.
Which reads as assigning the domain of the whole numbers (including negative ones') to index (despite the mention of zero-based ordinal position which just mentions the mapping required to apply the value to actual collection "positions").
The grammar (ABNF) keeps index expression value within non-negative numbers (extract after percent decoding).
index = ( "$index" / "index" ) EQ 1*DIGIT
EQ = "="
DIGIT = %x30-39
@sthagen Thanks for catching this, opened https://issues.oasis-open.org/browse/ODATA-1393 to track and repair it.
I switched to the oasis-tcs/odata-abnf variants of ABNF grammar and test cases (the test cases are not yet synchronized across formats), and updated all impacted derived / sub-grammars as well as generated matching positive test data files (in the centurio folders for the sub grammars and the data folder for the percent decoded main grammar; the latter with start symbol queryOptions).
Propose to close this issue. Thank you @ralfhandl for the fast upstream handling of the issue. I added a comment upstream on constraining the domain in the grammar via [ MINUS ]
(Or the literal which the github webui on ios does not let me enter) instead of *SIGN
. That makes life for implementers easier and is maybe more close to our intent. Maybe we do not want to support index expressions like โ+โโ42
๐
PR now uses [ "-" ]
.