Add support for collection parameters in URI functions#3444
Open
gathogojr wants to merge 1 commit intoOData:mainfrom
Open
Add support for collection parameters in URI functions#3444gathogojr wants to merge 1 commit intoOData:mainfrom
gathogojr wants to merge 1 commit intoOData:mainfrom
Conversation
1b0ab84 to
a06f317
Compare
6504a2e to
13346b1
Compare
13346b1 to
2cb423d
Compare
| @@ -47,45 +47,87 @@ internal FunctionCallBinder(MetadataBinder.QueryTokenVisitor bindMethod, Binding | |||
| /// </summary> | |||
| /// <param name="signature">The signature to match the types to.</param> | |||
| /// <param name="argumentNodes">The types to promote.</param> | |||
Member
There was a problem hiding this comment.
Should we update this comment as well
xuzhg
reviewed
Nov 26, 2025
| OrderByClause orderBy = this.ParseOrderBy(); | ||
| SearchClause search = this.ParseSearch(); | ||
| ApplyClause apply = this.ParseApply(); | ||
| ComputeClause compute = this.ParseCompute(); |
Member
There was a problem hiding this comment.
Why not move 'ParseApply()'?
ParseApply() should be called first
KenitoInc
reviewed
Dec 3, 2025
| for (int i = 0; i < candidate.Value.ArgumentTypes.Length; i++) | ||
| { | ||
| if (!CanPromoteNodeTo(argumentNodes[i], argumentTypes[i], candidate.Value.ArgumentTypes[i])) | ||
| if (!CanPromoteNodeTo(argumentMetadata[i].Node, argumentMetadata[i].TypeReference, candidate.Value.ArgumentTypes[i])) |
| { | ||
| object result = ODataUriUtils.ConvertFromUriLiteral( | ||
| value: constantNode.LiteralText, | ||
| version: ODataVersion.V4, |
Contributor
There was a problem hiding this comment.
Will the behaviour be the same for v4.01?
| if(enumType.TryParse(memberIntegralValue, out IEdmEnumMember enumMember)) | ||
| { | ||
| string literalText = ODataUriUtils.ConvertToUriLiteral(enumMember.Name, default(ODataVersion)); | ||
| string literalText = ODataUriUtils.ConvertToUriLiteral(enumMember.Name, default); |
Contributor
Author
There was a problem hiding this comment.
Just applied a suggestion by the compiler
| if (convertedNode == null) | ||
| { | ||
| // Try to keep original literal text if meaningful | ||
| string literal = item.LiteralText ?? ODataUriUtils.ConvertToUriLiteral(item.Value, ODataVersion.V4); |
Contributor
There was a problem hiding this comment.
Will the behaviour be the same on v4.01?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
This pull request fixes #3385.
Description
This pull request adds first-class support for passing collection-valued properties and collection-valued literals as parameters to functions invoked inside the
$computequery option, and fixes a parse-order defect that prevented selecting a computed property in$selectwhen defined via$compute.Before these changes:
$computecould only reliably accept single-valued parameters (primitive/scalar).[1,2,3]) was not consistently recognized as a semantic collection.$selectreferencing a newly introduced alias from$compute(e.g.&$select=Name,Bonus) could throw, because$select/$expandwas parsed before$compute, so the alias and function call hadn’t been materialized yet.Key enhancements
Collection-valued property parameters in
$computeCustomUriFunctions.AddCustomUriFunction) or model function inside$compute.$compute=calculateTaxablePay(Salary,OvertimeHours) as TaxablePay&$select=Name,Salary,TaxablePay.Collection-valued literal parameters
$computecan accept a bracketed collection literal as a parameter.$$compute=calculateSalaryBand(Salary,[5000,7000,9000]) as SalaryBand&$select=Name,SalaryBand.Edm function collection parameters
$compute=Default.CalculateOvertimePay(salary=Salary,overtimeHours=OvertimeHours) as OvertimePay&$select=Name,Salary,OvertimePay.$compute=Default.GetRating(scale=[1,2,3,4,5]) as Rating&$select=Name,Rating.Parse order fix in
ODataUriParser.ParseUriParseCompute()is now invoked beforeParseSelectAndExpand().$selectis processed, eliminating the previous exception when selecting a computed property.Internal changes
ParseUriprevents premature$selectbinding on non-existent aliases.Backward compatibility
$computeare unaffected.ParseComputebeforeParseSelectExpand) only resolves previously failing scenarios; no semantic regressions expected.Checklist (Uncheck if it is not completed)
Additional work necessary