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

Add $count to select #123

Open
wants to merge 8 commits into
base: v4.02-release-candidate
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions abnf/odata-abnf-construction-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,16 @@ expandItem = "$value"
/ expandPath
/ optionallyQualifiedEntityTypeName "/" expandPath
expandPath = ( STAR [ ref / OPEN levels CLOSE ]
/ entityNavigationProperty [ "/" optionallyQualifiedEntityTypeName ]
/ ( entityNavigationProperty / entityAnnotationInQuery ) [ "/" optionallyQualifiedEntityTypeName ]
[ ref
/ OPEN entityOption *( SEMI entityOption ) CLOSE
/ OPEN entityOption *( SEMI entityOption ) CLOSE
]
/ ( entityColNavigationProperty / entityAnnotationInQuery ) [ "/" optionallyQualifiedEntityTypeName ]
/ ( entityColNavigationProperty / entityColAnnotationInQuery ) [ "/" optionallyQualifiedEntityTypeName ]
[ ref [ OPEN colOption *( SEMI colOption ) CLOSE ]
/ count [ OPEN countOption *( SEMI countOption ) CLOSE ]
/ OPEN expandOption *( SEMI expandOption ) CLOSE
/ count [ OPEN countOption *( SEMI countOption ) CLOSE ]
/ OPEN expandOption *( SEMI expandOption ) CLOSE
]
/ ( complexProperty / complexColProperty / optionallyQualifiedComplexTypeName / complexAnnotationInQuery ) "/" expandPath
/ ( complexProperty / complexColProperty / optionallyQualifiedComplexTypeName / complexAnnotationInQuery / complexColAnnotationInQuery) "/" expandPath
/ streamProperty
)
countOption = filter
Expand Down Expand Up @@ -395,20 +395,20 @@ selectItem = STAR
/ optionallyQualifiedFunctionName
)
selectProperty = primitiveProperty / primitiveAnnotationInQuery
/ selectPath [ OPEN structOption *( SEMI structOption ) CLOSE
/ "/" selectProperty
]
/ selectColPath [ count [ OPEN countOption *( SEMI countOption ) CLOSE ]
/ OPEN selectOption *( SEMI selectOption ) CLOSE
/ "/" selectProperty
]
/ ( primitiveColProperty / primitiveColAnnotationInQuery )
[ count [ OPEN countOption *( SEMI countOption ) CLOSE ]
/ [ OPEN colOption *( SEMI colOption ) CLOSE ]
/ OPEN colOption *( SEMI colOption ) CLOSE
]
/ navigationProperty
/ selectPath [ OPEN structOption *( SEMI structOption ) CLOSE
/ "/" selectProperty
]
/ selectColPath [ count [ OPEN countOption *( SEMI countOption ) CLOSE ]
/ OPEN selectOption *( SEMI selectOption ) CLOSE
/ "/" selectProperty
]
selectPath = ( complexProperty / complexAnnotationInQuery ) [ "/" optionallyQualifiedComplexTypeName ]
selectColPath = complexColProperty [ "/" optionallyQualifiedComplexTypeName ]
selectColPath = ( complexColProperty / complexColAnnotationInQuery ) [ "/" optionallyQualifiedComplexTypeName ]
selectOption = colOption / structOption

allOperationsInSchema = namespace "." STAR
Expand Down Expand Up @@ -437,7 +437,9 @@ customName = qchar-no-AMP-EQ-AT-DOLLAR *( qchar-no-AMP-EQ )
customValue = *( qchar-no-AMP )

complexAnnotationInQuery = annotationInQuery ; complex-valued annotation
complexColAnnotationInQuery = annotationInQuery ; complex collection-valued annotation
entityAnnotationInQuery = annotationInQuery ; entity-valued annotation
entityColAnnotationInQuery = annotationInQuery ; entity collection-valued annotation

primitiveAnnotationInQuery = annotationInQuery ; primitive-valued annotation
primitiveColAnnotationInQuery = annotationInQuery ; primitive collection-valued annotation
Expand Down
70 changes: 63 additions & 7 deletions abnf/odata-abnf-testcases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Constraints:
- Rejection
actionImport:
- Activation
complexAnnotationInQuery:
- "@Namespace.ComplexTerm"
complexColAnnotationInQuery:
- "@Core.Messages"
complexColProperty:
- Addresses
- _at_Core_dot_Messages
Expand All @@ -88,6 +92,8 @@ Constraints:
- "@Namespace.EntityTerm"
entityAnnotationInQuery:
- "@Namespace.EntityTerm"
entityColAnnotationInQuery:
- "@Namespace.EntitySetTerm"
entityColFunction:
- AllOrders
- ProductsByColor
Expand Down Expand Up @@ -2407,7 +2413,7 @@ TestCases:
Input: $expand=Items/$count($filter=Name eq 'Hugo')

- Name:
5.1.2 Expand - $count - no $ prefix for query options, still required for
5.1.2 Expand - $count - no $ prefix for nested query options, still required for
path segment
Rule: expand
Input: expand=Items/$count(filter=Name eq 'Hugo')
Expand Down Expand Up @@ -2506,13 +2512,18 @@ TestCases:
Rule: expand
Input: [email protected]

- Name: 5.1.2 Expand - annotation with nested query options
- Name: 5.1.2 Expand - annotation
Rule: expand
FailAt: 33
Input: [email protected]($top=2)

- Name: 5.1.2 Expand - annotation with nested query options
Rule: expand
Input: [email protected]($top=2)

- Name: 5.1.2 Expand - annotation with navigation property
Rule: expand
Input: $expand=@Namespace.SomeTerm/Products($top=2)
Input: $expand=@Namespace.ComplexTerm/Products($top=2)

- Name: 5.1.3 Select - simple
Rule: select
Expand All @@ -2530,6 +2541,24 @@ TestCases:
Rule: select
Input: $select=Sizes($count=true)

- Name: 5.1.3 Select - $count -- can't support $count within /$count
Rule: select
FailAt: 21
Input: $select=Sizes/$count($count=true)

- Name: 5.1.3 Select - $count -- can't support count within /$count
Rule: select
FailAt: 21
Input: $select=Sizes/$count(count=true)

- Name: 5.1.3 Select - $count
Rule: select
Input: $select=Sizes/$count

- Name: 5.1.3 Select - $count
Rule: select
Input: $select=Sizes/$count($filter=$it gt 5)

- Name: 5.1.3 Select - $count
Rule: select
Input: $select=Addresses($count=true)
Expand All @@ -2550,12 +2579,12 @@ TestCases:
Rule: select
Input: $select=Addresses/$count($filter=startswith(City,'H'))

- Name: 5.1.3 Select - $count - no $ prefix for query options, still required for
- Name: 5.1.3 Select - $count - no $ prefix for nested query options, still required for
path segment
Rule: select
Input: select=Sizes/$count(filter=$it gt 5)

- Name: 5.1.3 Select - $count - no $ prefix for query options, still required for
- Name: 5.1.3 Select - $count - no $ prefix for nested query options, still required for
path segment
Rule: select
Input: select=Addresses/$count(filter=startswith(City,'H'))
Expand Down Expand Up @@ -2682,14 +2711,41 @@ TestCases:
Rule: queryOptions
Input: $select=Addresses($select=City;$filter=startswith(City,'H');$top=5;$skip=0;$count=true;$orderby=$it;$search=blue;@c=15)&$expand=Addresses/Country

- Name: 5.1.3 Select - annotations
- Name: 5.1.3 Select - annotations on a single complex term
Rule: select
Input: [email protected]($select=Name)

- Name: 5.1.3 Select - annotations on a collection
Rule: select
Input: [email protected]($top=5)

- Name: 5.1.3 Select - annotations
- Name: 5.1.3 Select - collection annotations on single complex term
Rule: select
FailAt: 31
Input: [email protected]($top=5)

- Name: 5.1.3 Select - annotations on a collection
Rule: select
Input: $select=Address/@Core.Messages($top=5)

- Name: 5.1.3 Select - annotations on a single complex term
Rule: select
Input: $select=Address/@Namespace.ComplexTerm($select=Name)

- Name: 5.1.3 Select - collection annotation on a single complex term
Rule: select
FailAt: 39
Input: $select=Address/@Namespace.ComplexTerm($top=5)

- Name: 5.1.3 Select - annotations
Rule: select
Input: [email protected],@Namespace.ComplexTerm($select=Name)

- Name: 5.1.3 Select - collection annotations on a single complex term
Rule: select
FailAt: 50
Input: [email protected],@Namespace.ComplexTerm($top=2)

- Name: 5.1.3 Select - annotations
Rule: select
Input: [email protected],@Core.MayImplement($top=2)
Expand Down