-
Notifications
You must be signed in to change notification settings - Fork 359
Open
Labels
Description
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:
-
Where can we get the annotations of
UndeclaredAddress1during reading: -
What's the expected logic for unknown annotation starting with
@odata.*such asodata.unknownName1,
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.