-
Notifications
You must be signed in to change notification settings - Fork 359
Description
Short summary (3-5 sentences) describing the issue.
Filtering an enum with it's integer value causes an exception
Assemblies affected
Which assemblies and versions are known to be affected e.g. OData .Net lib 7.x
Microsoft.AspNetCore.OData 8.0.11
Also whatever the Tripin service on odata.org is using
Reproduce steps
The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue.
the Tripin service used on odata.org is using this library, as the error message is the same.
Expected result
What would happen if there wasn't a bug.
Same results as https://services.odata.org/TripPinRESTierService/(S(bhxqknjf3hgdlqxrtt5uuffr))/People?$count=true&$filter=Gender%20eq%20%27Female%27
Actual result
What is actually happening.
{"error":{"code":"","message":"A binary operator with incompatible types was detected. Found operand types 'Trippin.PersonGender' and 'Edm.Int32' for operator kind 'Equal'."}}{"stacktrace": " at Microsoft.OData.UriParser.BinaryOperatorBinder.PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, SingleValueNode& left, SingleValueNode& right, TypeFacetsPromotionRules facetsPromotionRules)\r\n at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n at Microsoft.OData.UriParser.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)\r\n at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n at Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilterImplementation(String filter, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()\r\n at Microsoft.AspNetCore.OData.Query.FilterQueryOption.get_FilterClause()\r\n at Microsoft.AspNetCore.OData.Query.Validator.FilterQueryValidator.Validate(FilterQueryOption filterQueryOption, ODataValidationSettings settings)\r\n at Microsoft.AspNetCore.OData.Query.FilterQueryOption.Validate(ODataValidationSettings validationSettings)\r\n at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\r\n at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.Validate(ODataValidationSettings validationSettings)\r\n at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\r\n at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)"}Additional detail
Optional, details of the root cause if known. Delete this section if you have no additional details to add.
enum = [ qualifiedEnumTypeName ] SQUOTE enumValue SQUOTE
enumValue = singleEnumValue
singleEnumValue = enumerationMember / enumMemberValue
enumMemberValue = int64Value
which I assume means we should able to use a long when referring to an enum