-
Notifications
You must be signed in to change notification settings - Fork 351
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
Fixes #3174: Enable $select=colProperty/$count query option parser #3175
base: main
Are you sure you want to change the base?
Conversation
@@ -319,6 +323,15 @@ private SelectItem GenerateSelectItem(SelectTermToken tokenIn) | |||
parsedPath.AddRange(selectedPath); | |||
SelectExpandClause selectExpand = BindSelectExpand(null, tokenIn.SelectOption, parsedPath, this.ResourcePathNavigationSource, targetNavigationSource, elementTypeReference, generatedProperties); | |||
|
|||
if (isCount) | |||
{ | |||
// Do we need to throw exception if orderBy and nested select expand are not null within /$count ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; here, or somewhere, we should return an error if there is anything other than $filter/$search nested in a /$count(...). See https://github.com/oasis-tcs/odata-abnf/blob/e0b11964a13bf6ebe614b67933da8af0c155de4a/abnf/odata-abnf-construction-rules.txt#L313C2-L313C5
@@ -964,15 +979,39 @@ private static void VerifySelectedPath(SelectTermToken selectedToken) | |||
throw new ODataException(Error.Format(SRResources.SelectExpandBinder_SystemTokenInSelect, current.Identifier)); | |||
} | |||
|
|||
// Be design, the "/$count" should be built using SystemToken, but now, ODL is using NonSystemToken. | |||
// Shall we support "no-dollar sign"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/$count requires the '$', but ($count=true) does not.
@@ -170,6 +165,8 @@ private PathSegmentToken ParseSegment(PathSegmentToken previousSegment, bool all | |||
this.lexer.NextToken(); | |||
} | |||
|
|||
// By design, "/$count" or "/$ref" should return using SystemToken, but the existing implementation is using "NonSystemToken". | |||
// So far, let's keep it unchanged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we fix this in ODL9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question
Assert.Null(selectCountItem.Search); | ||
} | ||
|
||
// $select=colProperty/$count($search=...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test with nested expand, count and search.
For example:
- $expand=colProperty($count($search=...))
|
||
Assert.Null(selectCountItem.Filter); | ||
Assert.NotNull(selectCountItem.Search); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to add tests for scenarios where there is anything other than $filter/$search nested in a /$count(...)
- $select=colProperty/$count($orderby=...)
- $select=colProperty/$count($select=...)
- ...
Fixes #3174: Enable $select=colProperty/$count query option parser
See details in #3174
See related OASIS tc issues at: Should ABNF support /$count in $Select · Issue #2046 · oasis-tcs/odata-specs