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

Not able to serialize nested navigation properties

    XMLWordPrintableJSON

Details

    • Question
    • Status: Open
    • Major
    • Resolution: Unresolved
    • (Java) V4 4.7.1
    • None
    • odata4-server
    • None

    Description

      I have an EDM with the following:

       

      <EntityType Name="problem">

             <Key> 

                  <PropertyRef Name="id" />

              </Key>

            <Property Name="id" Type="Edm.Int32" />

            <Property Name="name" Type="Edm.String" />

            <NavigationProperty Name="targetItem" Type="Service.item" />

      </EntityType>

      <EntityType Name="item">

             <Key> 

                  <PropertyRef Name="id" />

              </Key>

            <Property Name="id" Type="Edm.Int32" />

            <Property Name="name" Type="Edm.String" />

            <NavigationProperty Name="category" Type="Service.category" />

       </EntityType>

      <EntityType Name="category">

            <Key> 

                  <PropertyRef Name="id" />

              </Key>

            <Property Name="id" Type="Edm.Int32" />

            <Property Name="name" Type="Edm.String" />

       </EntityType>

       

      I can walk the navigation properties successfully using $expand, e.g.:

       

      /problems(10)?$expand=targetItem($expand=category($select=id,name))

       

      This returns the expected JSON (summarized):

      {

         "id": 10,

          "targetItem": {

               "id": 1,

               "name": "foo",

               "category":

      {               "id": 2,              "name": "bar"           }

          }

      }

       

      But when I try to expand via a select option:

      /problems(10)?$expand=targetItem($select=id,name, category)

       

       I get:

       

      {

         "id": 10,

          "targetItem":

      {          "id": 1,          "name": "foo"     }

      }

       

      Any hints how I can get the nested select to include the expanded category in the response? As far as I can see the request is valid (as per OData 4.0 spec) and (unfortunately) the request is being generated by a 3rd party tool so I can't change it.

       

      When I include the ExpandOption with the EntitySerializerOptions.Builder should it "just work"?

        

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            macfaran Alan Macfarlane
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: