olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Amend (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OLINGO-1064) ComplexType is deserialized as Primitive Type if the value is NULL
Date Tue, 27 Dec 2016 14:20:58 GMT

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

Christian Amend commented on OLINGO-1064:

Hi Punith,

I am glad to hear that :)

You can find the source code repository here: https://git-wip-us.apache.org/repos/asf?p=olingo-odata4.git
Here is a tutorial on how we would prefer the patch file: http://olingo.apache.org/contribute.html
If you have questions or want to discuss architecture or implementation decisions you can
use the comment mechanism here.

There are two ways to solve this IMHO:
1. Make the deserializer EDM aware (My personal favourite but more implementation work)
2. hava a post-deserilaization method that checks which properties have been deserialized
and if they need a different value object in case they are comlex or navigation properties.

It would be very helpful to include a test to show that the changes work and to prevent future
refactorings from breaking the new behavior.

Best Regards,

> ComplexType is deserialized as Primitive Type if the value is NULL
> ------------------------------------------------------------------
>                 Key: OLINGO-1064
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1064
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core, odata4-client, odata4-commons
>    Affects Versions: (Java) V4 4.2.0
>            Reporter: Punith DG
>            Assignee: Christian Amend
>         Attachments: complexType.png
> The ODataClient deserializer wrongly converts the Complex Type field to Primitive Type
field if the value received for the complex type is NULL.
> e.g. on querying Person data from OData TripPin service (https://services.odata.org/TripPinRESTierService)
I received below JSON response.
> {
> 	"@odata.context": "http://services.odata.org/TripPinRESTierService/(S(myhztseklikbg41mbg03ugk5))/$metadata#People(AddressInfo,FavoriteFeature,FirstName,HomeAddress,LastName,UserName)",
> 	"value": [{
> 		"FavoriteFeature": "Feature1",
> 		"FirstName": "Angel",
> 		"Gender": "Female",
> 		"LastName": "Huffman",
> 		"UserName": "angelhuffman",
> 		"AddressInfo": [{
> 			"Address": "55 Grizzly Peak Rd.",
> 			"City": {
> 				"Name": "Butte",
> 				"CountryRegion": "United States",
> 				"Region": "MT"
> 			}
> 		}],
> 		"HomeAddress": null
> 	}]
> }
> See that 'HomeAddress' is ComplexType of type 'Location' and received 'null' value.
> Similarly, ComplexType property 'City' is deserialized as Primitive Type in the below
> "HomeAddress": {
> 			"Address": null,
> 			"City": null
> 		}
> When you deserialize and get an entity, the HomeAddress property of the Person entity
is set to Primitive Type with null value. This could be complex type?
> Metadata URL - http://tinyurl.com/gm8vomc

This message was sent by Atlassian JIRA

View raw message