Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
(Java) V4 4.1.0
-
None
Description
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
"RelatedPersons@odata.type": "#Collection(Person)",
"RelatedPersons": [
,
{ "@odata.type": "Person", ... }]
but correct would be
"RelatedPersons@odata.type": "#Collection(Person)",
"RelatedPersons": [
,
{ "@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?