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

ODL requires collection items on the RHS of "in" operator to be strings #3098

Open
gathogojr opened this issue Oct 25, 2024 · 1 comment · May be fixed by #3190
Open

ODL requires collection items on the RHS of "in" operator to be strings #3098

gathogojr opened this issue Oct 25, 2024 · 1 comment · May be fixed by #3190
Labels

Comments

@gathogojr
Copy link
Contributor

ODL requires collection items on the RHS of in operator to be strings.
The following filter expression where DynamicPrimitiveCollectionProperty is a dynamic property is not parsed successfully.

$filter=DynamicPrimitiveCollectionProperty in (19,17)

Assemblies affected

  • Microsoft.OData.Core 8.x
  • Microsoft.OData.Core 7.x

Reproduce steps

var model = new EdmModel();

var customerEntityType = model.AddEntityType("NS", "Customer", baseType: null, isAbstract: false, isOpen: true);
customerEntityType.AddKeys(customerEntityType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));

var entityContainer = model.AddEntityContainer("Default", "Container");

var customersEntitySet = entityContainer.AddEntitySet("Customers",
customerEntityType);

var filterClause = new ODataQueryOptionParser(
    model,
    customerEntityType,
    customersEntitySet, new Dictionary<string, string> { { "$filter", "DynamicPrimitiveCollectionProperty in (19,17)" } }).ParseFilter();

Expected result

The filter expression to be parsed successfully.

Actual result

image

Additional detail

Works if the collection items are strings, e.g., DynamicPrimitiveCollectionProperty in ('19','17')

@gathogojr
Copy link
Contributor Author

Relate issue #1958

@ElizabethOkerio ElizabethOkerio linked a pull request Mar 3, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants