-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Assemblies affected
only affects ASP.NET Core OData 9.4.0
ASP.NET Core OData 9.3.2 and previous: working as expected
Describe the bug
When configuring EnableNoDollarQueryOptions=false, and adding an object of type ODataQueryOptions to an endpoint, the ODataQueryOptions.Top property is being filled and contains the top query parameter value, whether a $ was appended as a prefix to it or not.
Reproduce steps
- Set EnableNoDollarQueryOptions=false
services.AddControllers()
.AddOData(option =>
{
option.AddRouteComponents("odata", new ODataConventionModelBuilder().GetEdmModel());
option.Count()
.Filter()
.OrderBy()
.Expand()
.Select()
.SetMaxTop(null);
option.EnableNoDollarQueryOptions = false;
});
- Add some endpoint
[HttpGet]
[ODataRouteComponent("Table")]
[Route("Table")]
[AllowAnonymous]
public async Task<IActionResult> GetAll(ODataQueryOptions<object> options, int skip = 0, int top = 22, bool latestData = false)
{
return Ok(options.Top is null);
}
- Call the endpoint, ex.
GET http://localhost:5000/api/test/Table?top=25
Expected behavior
Expected output: options.Top should be null. Under 9.4.0, the Top property is populated and reads the value from the top query parameter directly.
Before 9.4.0, options.Top is null.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working