You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Amend, Christian" <ch...@sap.com> on 2016/11/22 16:37:14 UTC

[DISCUSS] usage of the writeOnlyReferences Flag in the ODataSerializer

Hi,

there is currently a flag in the ODataSerializerOptions which is called writeOnlyReferences. This flag can be used when calling the "entityCollection" and the "entity" methods. The flag then results in a complete change of behavior and writes the references for an entity rather than the payload itself.

I would like to propose to remove this flag and use the dedicated "reference" and "referenceCollection" methods in this case as they have been made for that. These methods can also construct the self link if the entity ID is not set. So they are more robust. Another benefit would be that the EntitySerializer is not used out of context and does not have unnecessary code inside.

If nobody objects I would make the above changes and push them.

Best Regards,
Christian

Re: [DISCUSS] usage of the writeOnlyReferences Flag in the ODataSerializer

Posted by Ramesh Reddy <ra...@redhat.com>.
Make sure "sever-core-ext" code is correctly changed for this. The view always took is, server code is not the one taking decision on the what payload should be, it is serializer based on the given configuration sets transforms the input into the required payload. Here you are bringing in the knowledge of reference or entity payload decision to be made in the code itself. This like some making argument I want a different method for minimal vs full vs reference.

But I am not too concerned about the change, so no objections.

----- Original Message -----
> Hi,
> 
> there is currently a flag in the ODataSerializerOptions which is called
> writeOnlyReferences. This flag can be used when calling the
> "entityCollection" and the "entity" methods. The flag then results in a
> complete change of behavior and writes the references for an entity rather
> than the payload itself.
> 
> I would like to propose to remove this flag and use the dedicated "reference"
> and "referenceCollection" methods in this case as they have been made for
> that. These methods can also construct the self link if the entity ID is not
> set. So they are more robust. Another benefit would be that the
> EntitySerializer is not used out of context and does not have unnecessary
> code inside.
> 
> If nobody objects I would make the above changes and push them.
> 
> Best Regards,
> Christian
>