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

ODATA-1506: allow indexing into a collection in a specific order #61

Draft
wants to merge 9 commits into
base: v4.02-release-candidate
Choose a base branch
from
5 changes: 4 additions & 1 deletion abnf/odata-abnf-construction-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,14 @@ complexColPathExpr = collectionPathExpr

collectionPathExpr = count [ OPEN expandCountOption *( SEMI expandCountOption ) CLOSE ]
/ filterExpr [ collectionPathExpr ]
/ OPEN collectionOption *( SEMI collectionOption ) CLOSE [ complexPathExpr ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the index is not mandatory, the complexPathExpr may come after a collection with more than one entry. Is this OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we have to call that out in the prose specification.

/ "/" anyExpr
/ "/" allExpr
/ "/" boundFunctionExpr
/ "/" annotationExpr


collectionOption = orderby / index
HeikoTheissen marked this conversation as resolved.
Show resolved Hide resolved

complexPathExpr = "/" directMemberExpr
/ "/" optionallyQualifiedComplexTypeName [ "/" directMemberExpr ]

Expand Down
12 changes: 12 additions & 0 deletions abnf/odata-abnf-testcases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,18 @@ TestCases:
Rule: odataRelativeUri
Input: Suppliers(1)/Addresses/Model.AddressWithLocation/-1

- Name: 4.10 Addressing a Member of an Ordered Primitive Collection - in $orderby
Rule: orderby
Input: $orderby=EmailAddresses($index=1;$orderby=$this)

- Name: 4.10 Addressing a Member of an Ordered Complex Collection - in $orderby
Rule: orderby
Input: $orderby=Addresses($index=0;$orderby=Name)/Name

- Name: 4.10 Addressing a Member of an Ordered Complex Collection with type-cast - in $orderby
Rule: orderby
Input: $orderby=Addresses/Model.AddressWithLocation($index=-1;$orderby=Name)/Location

- Name: 4.11 Inheritance - set of subtypes
Rule: odataRelativeUri
Input: Products/Model.BestSellingProduct
Expand Down