WebApi
WebApi copied to clipboard
"Deep Insert" requests with Prefer: return=representation header does not return expanded graph.
According to OData V4 spec:
11.4.2.2 Create Related Entities When Creating an Entity
A request to create an entity that includes related entities, represented using the appropriate inline representation, is referred to as a “deep insert”. Media entities, whose binary representation cannot be represented inline, cannot be created within a deep insert. ... On success, the service MUST create all entities and relate them. If the request included a return Prefer header with a value of return=representation and is applied by the service, the response MUST be expanded to at least the level that was present in the deep-insert request.
However this is not what's happening. I am sending a deep request and the response message does not include expanded graph.
Anything new about this item?
I am also facing to this issue.
As a workaround I use "Prefer" as "return=minimal" and use Location header to get url, which I can use to return entity with all required selects\expands.
This issue is still present in 7.x. Any plans to fix it?
Somewhat related: https://github.com/OData/WebApi/issues/356
I also tried to work-around this issue by adding Prefer: return=representation
in the POST
request header and explicitly add $expand=MyNavigationProperty
in the query string, but the response still doesn't include the expanded navigation property.
I'm using Microsoft.AspNetCore.OData 7.5.12