You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Christian Amend (JIRA)" <ji...@apache.org> on 2016/07/27 08:57:20 UTC

[jira] [Commented] (OLINGO-975) Olingo client sends incorrect types for collection members

    [ https://issues.apache.org/jira/browse/OLINGO-975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15395268#comment-15395268 ] 

Christian Amend commented on OLINGO-975:
----------------------------------------

Hi Torsten,

yes if you would like to change this behavior please provide a patch. As long as it contains tests for the changed functionality I would be OK with this. Here is a tutorial on how to contribute to Olingo: http://olingo.apache.org/contribute.html

Thanks & Best Regards,
Christian

> 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
> 			"RelatedPersons@odata.type": "#Collection(Person)",
> 			"RelatedPersons": [{
> 					   "@odata.type": "Person", ...
> 					   },
> 					   {
> 					   "@odata.type": "Person", ...
> 					   }
> 					   ]
> but correct would be
> 			"RelatedPersons@odata.type": "#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)