Open dnperfors opened 1 year ago
Possibly related are calls to /products(1)(2)(3)
(will test this when I get back to work tomorrow)
@dnperfors what's your Edm model (xml csdl)? and what's your controller/action?
@dnperfors what's your Edm model (xml csdl)? and what's your controller/action?
I am pretty sure I mentioned the ODataRoutingSample, without any changes...
But I have a smaller reproduction here:
[HttpGet]
[EnableQuery(AllowedQueryOptions = AllowedQueryOptions.None)]
public IQueryable<Book> GetBooks() => books.AsQueryable();
[HttpGet]
[EnableQuery(AllowedQueryOptions = AllowedQueryOptions.None)]
public SingleResult<Book> GetBook(int key) => SingleResult.Create(books.Where(x => x.Id == key).AsQueryable());
Edm:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema Namespace="eLibrary.WebApi.OData.Models" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityType Name="Book">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
<Property Name="Title" Type="Edm.String" Nullable="false" />
<Property Name="Author" Type="Edm.String" Nullable="false" />
</EntityType>
</Schema>
<Schema Namespace="Default" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityContainer Name="Container">
<EntitySet Name="Books" EntityType="eLibrary.WebApi.OData.Models.Book" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Possibly related are calls to
/products(1)(2)(3)
The above URL type has the same behavior.
Assemblies affected ASP.NET Core OData 8.x (master)
Describe the bug When getting a single entity, but passing multiple ID's will return a single result (the first id found in the list). However, according to the specification this doesn't seem to be a valid url.
Reproduce steps
http://localhost:5000/products(1,2,3)
orhttp://localhost:5000/products(1)(2)(3)
Data Model Data model: https://github.com/OData/AspNetCoreOData/blob/9f1547e92a6bbed936dcae705491049014873be7/sample/ODataRoutingSample/Models/Product.cs#L12-L25 Controller: https://github.com/OData/AspNetCoreOData/blob/9f1547e92a6bbed936dcae705491049014873be7/sample/ODataRoutingSample/Controllers/ProductsController.cs#L74-L85
EDM (CSDL) Model You probably know this EDM better than I do...
Request/Response
Expected behavior I would expect a
404 Not Found
, since:1,2,3
as a parameter1,2,3
I could expect a
400 Bad Request
, since the URL is not a valid OData URL, butNot Found
seems to be more appropriate.