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

Olingo client sends incorrect types for collection members

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • (Java) V4 4.1.0
    • (Java) V4 4.4.0
    • odata4-client
    • 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", ... }

      ,

      { "@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?

      Attachments

        1. OLINGO975.diff
          5 kB
          Ramya

        Activity

          People

            chrisam Christian Amend
            tkue Torsten Küpper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: