You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Alan Macfarlane (Jira)" <ji...@apache.org> on 2020/08/07 09:36:00 UTC

[jira] [Created] (OLINGO-1474) Not able to serialize nested navigation properties

Alan Macfarlane created OLINGO-1474:
---------------------------------------

             Summary: Not able to serialize nested navigation properties
                 Key: OLINGO-1474
                 URL: https://issues.apache.org/jira/browse/OLINGO-1474
             Project: Olingo
          Issue Type: Question
          Components: odata4-server
    Affects Versions: (Java) V4 4.7.1
            Reporter: Alan Macfarlane


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

  

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)