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

Should support dynamic properties as right-hand operator in In clause using type of left-hand operand #3090

Open
mikepizzo opened this issue Oct 17, 2024 · 0 comments · May be fixed by #3091
Assignees

Comments

@mikepizzo
Copy link
Member

According to OData ABNF, the right operand of an in expression can be a common expression. Specifically:

inExpr = RWS "in" RWS ( listExpr / commonExpr )

allows the right-hand operand of an in expression to be a collection-valued property.

This works in the library today if the right-hand expression is a schematized property, for example:

https://services.odata.org/TripPinRESTierService/Me/Trips?$filter='Travel' in Tags

However, if the right-hand expression is a dynamic property, the query fails because we are unable to determine the type of the right-hand operand.

We should support dynamic properties as the right-hand operand, using the type of the left-hand operator.

Assemblies affected

All

Reproduce steps

Try to parse the following filter expression, where "trip" is an open type and "undefined" is an undefined property:

trips?$filter='Europe' in undefined

Expected result

A valid In expression with a right-hand operand that is a CollectionOpenPropertyAccessNode with a CollectionType of Collection(Edm.String).

Actual result

An error is thrown stating that the right hand operand isn't a collection.

Additional detail

Note that, for the in operator, user can work around this limitation by use of the Any operator. However, the Any operator is less intuitive and potentially more expensive to compute than the in operator, and doesn't solve the general case.

@mikepizzo mikepizzo linked a pull request Oct 17, 2024 that will close this issue
2 tasks
@mikepizzo mikepizzo self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant