Open Xriuk opened 3 months ago
@Xriuk
I have performed a few tests to replicate this issue. Using TripPin/TripPinServiceRW/$metadata) service:
The query that is not working is when, for example, trying to select property (other than key/id) of navigation property that has its "ContainsTarget" attribute set to true. Example of TripPin service endpoint that will cause the above exception is:
GET https://services.odata.org/V4/(S(1ap4mtbir3rypxuywlctvast))/TripPinServiceRW/People?$expand=Trips($select=Name)
Header:
Accept application/json;odata.metadata=full
However, the above query will give me the correct data when used with header
Accept application/json;odata.metadata=minimal
For example:
Header:
Accept application/json;odata.metadata=minimal
@WanjohiSammy yes, that is correct, as I wrote above, this only happens for contained entities (navigation properties with ContainsTarget="true"
), and only with odata.metadata=full
. So this has something to do with incorrectly generating annotations (@odata.id
in this case) for contained entities, when their keys are not explicitly selected (despite still being autoselected).
Assemblies affected ASP.NET Core OData 8.2.4
Describe the bug
$expand
ing a contained navigation and$select
ing other properties except the keys throws:Reproduce steps A GET request to:
with header:
Throws:
Data Model
EDM (CSDL) Model
Additional context From the resulting query it looks like the key properties are autoselected as they should but they are not being used.
If I explicitly select the key, the results are correctly returned