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

Incorrect "id" value for transient entities in responses

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • (Java) V4 4.9.0
    • None
    • odata4-server
    • None

    Description

      Responses containing transient entities have incorrect values for "id", both in XML and JSON formats.

      XML does not include any id field, while according to [OData Atom Format Version 4.0 (oasis-open.org) it should be a transient id:

      If the entity is transient (i.e. cannot be read or updated), the atom:id SHOULD follow the pattern odata:transient:{some-generated-unique-identifier-to-not-break-atom-parsers}.

       JSON includes an id field, but its value is a non-existing URI. For example: https://myhost/odata/PseudoEntitySet(''). According to [OData JSON Format Version 4.0 Plus Errata 02 (oasis-open.org), the id should be present and have a null value:

      If the entity is transient (i.e. cannot be read or updated), the odata.id annotation MUST appear and have the null value.

      This is likely caused by the method writeEntity() in both serializers.

      • In ODataJsonSerializer, line 426 it always writes the "id" field, regardless of whether id actually has a value or not.
      • In ODataXmlSerializer, line 476, it only writes the "id" field if not null.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            falbert Florent Albert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: