Skip to content

Missing annotations for null value nested resource or without value nested resource #3440

@xuzhg

Description

@xuzhg

Describe the bug

With 'null' value for an undeclared nested resource (it's also same for declared nested resource):

{
  "@odata.context":"http://www.sampletest.com/$metadata#serverEntitySet/$entity",
  "Id":61880128,
   "UndeclaredAddress1@odata.unknownName1":"unknown odata.xxx value1",
   "UndeclaredAddress1@NS1.abcdefg":"unknown value2",
   "UndeclaredAddress1":null,
   "UndeclaredAddress1@odata.type":"Server.NS.UndefComplex1"
}

Here's the potential reading process:

 if (reader.State == ODataReaderState.ResourceStart)
 {
     if (entry == null)
     {
         entry = (reader.Item as ODataResource);
     }
     else if (complex1 == null)
     {
         complex1 = (reader.Item as ODataResource);
     }
 }
 else if (reader.State == ODataReaderState.NestedResourceInfoStart)
 {
     nestedInfo = (reader.Item as ODataNestedResourceInfo);
 }

So, entry has the value for top level resource
complex1 == null since nested resource's value is null.

Problems:

  1. Where can we get the annotations of UndeclaredAddress1 during reading:

  2. What's the expected logic for unknown annotation starting with @odata.* such as odata.unknownName1,

@mikepizzo

interesting things

without value for an undeclared nested resource (it's also same for declared nested resource):

{
  "@odata.context":"http://www.sampletest.com/$metadata#serverEntitySet/$entity",
  "Id":61880128,
   "UndeclaredAddress1@odata.unknownName1":"unknown odata.xxx value1",
   "UndeclaredAddress1@NS1.abcdefg":"unknown value2",
   "UndeclaredAddress1@odata.type":"Server.NS.UndefComplex1"
}

In this case, It returns 'NestedPropertyInfo' state, and we can get all annotations from 'ODataPropertyInfo'.

 if (reader.State == ODataReaderState.ResourceStart)
 {
     if (entry == null)
     {
         entry = (reader.Item as ODataResource);
     }
     else if (complex1 == null)
     {
         complex1 = (reader.Item as ODataResource);
     }
 }
 else if (reader.State == ODataReaderState.NestedResourceInfoStart)
 {
     nestedInfo = (reader.Item as ODataNestedResourceInfo);
 }
else if (reader.State == ODataReaderState.NestedPropertyInfo)
{
      // Here, we can get the ODataPropertyInfo
     ODataPropertyInfo propertyInfo = (ODataPropertyInfo)reader.Item;
}

That looks inconsistent.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions