Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1064

ComplexType is deserialized as Primitive Type if the value is NULL

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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 response.

      "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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            chrisam Christian Amend
            punith619 Punith DG
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment