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

Isof type parameter quotes #1744

Open
VirusQuartirus opened this issue Apr 15, 2020 · 2 comments · Fixed by #3108 · May be fixed by #3117
Open

Isof type parameter quotes #1744

VirusQuartirus opened this issue Apr 15, 2020 · 2 comments · Fixed by #3108 · May be fixed by #3117
Assignees

Comments

@VirusQuartirus
Copy link

According OData V4 spec isof function type parameter should not be enclosed in quotes. However both .NET client lib sends quoted type parameter and service impl requires type to be quoted.

Assemblies affected

OData .Net lib 6.x, 7.x

Reproduce steps

Execute query like
https://services.odata.org/TripPinRESTierService/(S(4dte2qgkqy1lkpudzkpnk4om))/People?$filter=isof(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Employee)

Expected result

Request should return list of Employees like https://services.odata.org/TripPinRESTierService/(S(4dte2qgkqy1lkpudzkpnk4om))/People?$filter=isof('Microsoft.OData.Service.Sample.TrippinInMemory.Models.Employee') request does.

Actual result

Request fails with "Cast or IsOf Function must have a type in its arguments." message.

@mikepizzo
Copy link
Member

mikepizzo commented Apr 21, 2020

Here is the stack from RESTier, which suggests that the issue is in the UriParser within OData Library (version ODL 7.6.1):

at IEdmTypeReference Microsoft.OData.UriParser.FunctionCallBinder.ValidateIsOfOrCast(BindingState state, bool isCast, ref List args)\r\n at SingleValueNode Microsoft.OData.UriParser.FunctionCallBinder.CreateUnboundFunctionNode(string functionCallTokenName, List args)\r\n at QueryNode Microsoft.OData.UriParser.FunctionCallBinder.BindAsUriFunction(FunctionCallToken functionCallToken, List argumentNodes)\r\n at QueryNode Microsoft.OData.UriParser.FunctionCallBinder.BindFunctionCall(FunctionCallToken functionCallToken)\r\n at QueryNode Microsoft.OData.UriParser.MetadataBinder.BindFunctionCall(FunctionCallToken functionCallToken)\r\n at QueryNode Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n at FilterClause Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)\r\n at FilterClause Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilterImplementation(string filter, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)\r\n at FilterClause Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()\r\n at FilterClause Microsoft.AspNet.OData.Query.FilterQueryOption.get_FilterClause()\r\n at void Microsoft.AspNet.OData.Query.Validators.FilterQueryValidator.Validate(FilterQueryOption filterQueryOption, ODataValidationSettings settings)\r\n at void Microsoft.AspNet.OData.Query.FilterQueryOption.Validate(ODataValidationSettings validationSettings)\r\n at void Microsoft.AspNet.OData.Query.Validators.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\r\n at void Microsoft.AspNet.OData.Query.ODataQueryOptions.Validate(ODataValidationSettings validationSettings)\r\n at async Task<(IQueryable Queryable, ETag Etag)> Microsoft.Restier.AspNet.RestierController.ApplyQueryOptionsAsync(IQueryable queryable, ODataPath path, bool applyCount)\r\n at async Task Microsoft.Restier.AspNet.RestierController.Get(CancellationToken cancellationToken)\r\n at async Task System.Threading.Tasks.TaskHelpersExtensions.CastToObject(Task task)\r\n at async Task System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsyncCore(HttpActionContext actionContext, CancellationToken cancellationToken)\r\n at async Task System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(CancellationToken cancellationToken)\r\n at async Task System.Web.Http.Controllers.ExceptionFilterResult.ExecuteAsync(CancellationToken cancellationToken)

@Xriuk
Copy link

Xriuk commented Nov 22, 2023

+1, encountered this issue today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants