Emma Sajic created OLINGO-1612:
----------------------------------

             Summary: Olingo implementation of $expand star operator implicitly 
includes Stream properties when the spec says it does not
                 Key: OLINGO-1612
                 URL: https://issues.apache.org/jira/browse/OLINGO-1612
             Project: Olingo
          Issue Type: Bug
          Components: odata4-server
    Affects Versions: (Java) V4 4.10.0
            Reporter: Emma Sajic


The OData v4 spec Part 2 [5.1.2 System Query Option 
$expand|http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752359]
 states "expand all declared and dynamic *navigation properties* using a star 
(*)" (my bolding)

The OData v4.01 spec Part 2 [5.1.3 System Query Option 
$expand|https://docs.oasis-open.org/odata/odata/v4.01/os/part2-url-conventions/odata-v4.01-os-part2-url-conventions.html#sec_SystemQueryOptionexpand]
 states
"The star operator *does not* implicitly include stream properties." (my 
bolding)

However, in the Olingo implementation for both OData v4.0 and OData v4.1, 
$expand=* implies expanding all navigation properties on the entity but also 
all Stream properties.

There are two main issues with how this has been implemented in Olingo:
 # Expanding Stream properties is only supported in OData v4.01 and NOT in 
OData v4.

This means that if an OData v4 request is $expand=* and the serializer finds a 
Stream property on an entity it throws an exception.

But if OData v4 $expand entities are explicitly specified navigation properties 
e.g. $expand=Vendor,Voucher, the serializer processes Stream properties on the 
entity OK and writes e.g. the Stream read link to the response.

The OData v4 spec does not even mention $expand=* having anything to do with 
Stream properties - this is not an invalid request and should expand navigation 
properties only, rather than throwing an exception.


 # In OData v4.01, $expand=* is expanding Stream properties in the response 
when it should not. This contradicts the v4.01 spec mentioned above.

 

See https://issues.apache.org/jira/browse/OLINGO-1182 which introduced this 
behaviour in [ODataJsonSerializer.writeExpandedStreamProperty 
method|https://github.com/apache/olingo-odata4/blob/21ee56917f900a816b1dbae4d3683d5b84b00f67/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java#L600-L608]

 

I attach a patch which adds unit tests to ODataJsonSerializerTest and 
ODataJsonSerializerv01Test to reproduce the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to