$apply is not returning the response with OData annotations #2840
Replies: 1 comment
-
Related to OData/AspNetCoreOData#1144 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
$apply=aggregate or groupby returns only JSON payload in response without ODATA annotations. There is no ODATA headers in response as well.
Request:
apply=groupby((FieldProductionsId,FieldCode),aggregate(DaysOnProduction with sum as SumOfProd))
Response Body:
In above the response is pure JSON not with OData annotations.
How to make the response with OData annotations, I can use the customized middleware like this, but we need to again write more logic for other OData annotations, like count, etag etc.
When we give request with http://localhost:64771/v1/Customers?$apply=aggregate(Id with sum as TotalCount)
the outputFormatter in below screen shot is coming as
{Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter}
where as without apply
http://localhost:64771/v1/Customers?$select=Name
the outputFormatter is set to{Microsoft.AspNetCore.OData.Formatter.ODataOutputFormatter}
.I presume that these different makes apply to not set the OData annotations for apply.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions