Torsten Küpper created OLINGO-975:
-------------------------------------
Summary: Olingo client sends incorrect types for collection members
Key: OLINGO-975
URL: https://issues.apache.org/jira/browse/OLINGO-975
Project: Olingo
Issue Type: Bug
Components: odata4-client
Affects Versions: (Java) V4 4.1.0
Reporter: Torsten Küpper
Hi,
having derived class types in a collection, the Olingo Java client
sends only the collection type. E.g. given that Employee and Customer both
inherit from Person, and we have a collection RelatedPersons of Person, if the
first collection member is an instance of Employee and the second a Customer,
then the request contains
"[email protected]": "#Collection(Person)",
"RelatedPersons": [{
"@odata.type": "Person", ...
},
{
"@odata.type": "Person", ...
}
]
but correct would be
"[email protected]": "#Collection(Person)",
"RelatedPersons": [{
"@odata.type": "Employee", ...
},
{
"@odata.type": "Customer", ...
}
]
I found OLINGO-825 which seems to describe the issue just on the server
side, which then received a fix.
It seems to me the cause is that type gets lost in ODataBinderImpl when a
translation of data to some internal representation which has no type
information, at least for collection members, is done.
In the reverse direction, when Olingo client receives a response, the type info
is thrown away in JsonDeserializer in fromCollection
if (child.has(Constants.JSON_TYPE)) {
((ObjectNode) child).remove(Constants.JSON_TYPE);
}
What could be done to fix this?
Would a change be accepted which adds the type information to each
collection member in the internal representation?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)