Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
(Java) V4 4.9.0
-
None
-
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.