Description
Assemblies affected
ASP.NET Core OData 8.2.1
Describe the bug
Since the upgrade to v.8.2.1, we experience responses like the following:
{
"@odata.context": "..........$metadata#apimodel(expandedProperty())",
"value": [
{
"title": null,
"description": null,
"id": "00000000-0000-0000-0000-000000000000",
"expandedProperty": [
{
"id": "00000000-0000-0000-0000-000000000000",
"categories": [],
"description": null,
"displayName": null,
"isPublished": false
}
]
}
]
}
We did not have this behavior with the previous release (8.2.0) and it can be work-arounded by adding some top-level properties to the $select
query option (hence, the top level apimodel
object has its selected properties with values, but the expanded ones do not), or some nested properties to the $expand=expandedProperty(select=..)
(and then, the selected nested properties have values too).
Reproduce steps
Simply issue a query with and $expand
on a navigation property, regardless it is an entity or a collection property.
Additional context
I narrowed down my search for a cause of this bug to this PR #993. If I just rollback to the previous behavior in the Microsoft.AspNetCore.OData.Query.Expressions.SelectExpandBinder.ProjectElement
method, it fixes the issue.