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

Create entities of derived types - ODataJsonDeserializer ignoring odata.type

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • (Java) V4 4.0.0
    • (Java) V4 4.2.0
    • odata4-server
    • None

    Description

      I have an entity which is linked to a collection of entities of a base type. Something like this:

      <EntityType Name="MyBaseType" Abstract="true">
      [...]
      </EntityType>
      <EntityType Name="DerviedTypeA" BaseType=" MyBaseType ">
      [...]
      </EntityType>
      <EntityType Name="DerviedTypeB" BaseType="MyBaseType ">
      [...]
      </EntityType>
      <EntityType Name="A">
      [...]
      <NavigationProperty Name="params" Type="Collection(MyBaseType)"/> </EntityType>

      A deep insert of the entity A and the entity set params is done. The entity set contains entities of type DerviedTypeA and DerviedTypeB. The request contains odata.type annotations which specify the correct type of the entities. The ODataJsonDeserializer ignores the odata.type annotations and then tries to create DerviedTypeA and DerviedTypeB entities as entities of type MyBaseType and therefore complains that there are more properties than expected.
      The spec says that the odata.type annotation must be present if "The type is derived from the type specified for the (collection of) entities or (collection of) complex type instances" as there is no other way to know the correct type.
      The ODataJsonDeserializer should not ignore the odata.type annotations.

      Attachments

        Activity

          People

            rareddy Ramesh Reddy
            frederik.zimmer Frederik Zimmer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: