Florent Albert created OLINGO-1594: -------------------------------------- Summary: Incorrect "id" value for transient entities in responses Key: OLINGO-1594 URL: https://issues.apache.org/jira/browse/OLINGO-1594 Project: Olingo Issue Type: Bug Components: odata4-server Affects Versions: (Java) V4 4.9.0 Reporter: Florent Albert
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 [the spec|[OData Atom Format Version 4.0 (oasis-open.org)|http://docs.oasis-open.org/odata/odata-atom-format/v4.0/cs02/odata-atom-format-v4.0-cs02.html#_Toc372792707]] it should be a transient id: {noformat} 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}.{noformat} JSON includes an id field, but its value is a non-existing URI. For example: [{_}https://myhost/odata/PseudoEntitySet(''){_}.] According to [the spec|[OData JSON Format Version 4.0 Plus Errata 02 (oasis-open.org)|http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940621]], the id should be present and have a null value: {noformat} If the entity is transient (i.e. cannot be read or updated), the odata.id annotation MUST appear and have the null value.{noformat} 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. -- This message was sent by Atlassian Jira (v8.20.10#820010)