OData / AspNetCoreOData

ASP.NET Core OData: A server library built upon ODataLib and ASP.NET Core
Other
457 stars 158 forks source link

Support property without property value #1301

Open xuzhg opened 2 months ago

xuzhg commented 2 months ago

Assemblies affected Which assemblies and versions are known to be affected e.g. ASP.NET Core OData 9.x

Describe the bug

ODL supports to read the property without value. Here's an example:

{
    "@odata.context":"http://localhost/$metadata#Customers/$entity",
    "CustomerID": 17,
    "Name@Custom.PrimitiveAnnotation":123,
    "Name@Custom.BooleanAnnotation":true,
    "Location": { "Street":"154TH AVE"}
}

where, the property 'Name' only contains the instance annotations.

ODL can read the above properties and output the 'ODataReaderState.NestedPropertyInfo' in the reading pipeline.

The ASP.NET Core OData payload reading process doesn't handle the "NestedPropertyInfo", that means the properties without value are ignored. The result is that the end user can't handle such properties even he customizes the resource deserializer.

Additional context Be noted, so far ODL 8.1 also reads the 'primitive type property without value into the 'ODataResourceBase.Properties', but not for other type properties.

julealgon commented 2 months ago

What do you mean by this one @xuzhg ? Can you add a simple description/example?

xuzhg commented 2 months ago

What do you mean by this one @xuzhg ? Can you add a simple description/example?

I can't catch up your speed. :)