Open syprieur opened 9 months ago
I'm not sure why the error message specifies both a navigation property or complex property. It appears that in the past this error message only referred to navigation properties but 7 years ago a change was introduced that added the "complex property" to the message: https://github.com/OData/odata.net/commit/24b9727f24c28589c32b891d35ac20d730b55850
My guess is that this error message is used in a different places and maybe in some of those places it applies to both navigation properties and complex properties and they decided to update the error message as a result. Maybe we should add an error message that only applies to navigation properties to use in scenarios that do not apply to complex properties.
When an
$expand
is run against a valid non-navigation property of the type, the error message emitted by ODL has been reported by customers as misleading.Assemblies affected
All
Microsoft.OData.Core
up to 7.19 included.Reproduce steps
With:
calendars
an entity set ofmicrosoft.graph.calendars
microsoft.graph.calendar
defining a complex property namedowner
.The incorrect query:
/calendars?$expand=owner
yields the error message:This is somewhat misleading, as
owner
is a complex property of the typemicrosoft.graph.calendar
.Additional detail
The error message comes from ExpandItemBinder_PropertyIsNotANavigationPropertyOrComplexProperty. The intent behind mentioning complex properties is unknown. Was it to allow valid expand paths traversing complex properties?