SAP / open-ux-odata

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.
Apache License 2.0
51 stars 12 forks source link

BUG - Creating V2 entity returns invalid metadata #674

Closed sb-aigh closed 1 year ago

sb-aigh commented 1 year ago

Description

When creating a V2 entity (via BatchRequest containing POST), the mockserver returns a response like the following:

--batch_e9b6-2912-a683
Content-Type: multipart/mixed; boundary=changeset_dfd9-54ec-be88

--changeset_dfd9-54ec-be88
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 201 Created
sap-tenantid: tenant-default
Location: MyEntitySet()
dataserviceversion: 2.0
cache-control: no-store, no-cache
content-type: application/json

{"d":{"uuid":"0c241e36-7e4c-44b4-a748-3bf31fcc2135","name":"my name","description":"my description","isActive":true,"__metadata":{"id":"/odata/v2/MyService/MyEntitySet()","uri":"/odata/v2/MyService/MyEntitySet()","type":"MyService.MyEntitySet"}}}

--changeset_dfd9-54ec-be88--
--batch_e9b6-2912-a683--

The response payload contains the key (-> uuid) with some generated value, but the metadata id and uri as well as the Location property in the header section do not contain any key (just ()).

Expected results

The batch request response shall contain:

--batch_e9b6-2912-a683
Content-Type: multipart/mixed; boundary=changeset_dfd9-54ec-be88

--changeset_dfd9-54ec-be88
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 201 Created
sap-tenantid: tenant-default
Location: MyEntitySet(guid'0c241e36-7e4c-44b4-a748-3bf31fcc2135')
dataserviceversion: 2.0
cache-control: no-store, no-cache
content-type: application/json

{"d":{"uuid":"0c241e36-7e4c-44b4-a748-3bf31fcc2135","name":"my name","description":"my description","isActive":true,"__metadata":{"id":"/odata/v2/MyService/MyEntitySet(guid'0c241e36-7e4c-44b4-a748-3bf31fcc2135')","uri":"/odata/v2/MyService/MyEntitySet(guid'0c241e36-7e4c-44b4-a748-3bf31fcc2135')","type":"MyService.MyEntitySet"}}}

--changeset_dfd9-54ec-be88--
--batch_e9b6-2912-a683--

In my example the key is of type Edm.Guid hence the response key is guid('xyz').

Version/Components/Environment

2.1.114

nlunets commented 1 year ago

Most likely fixed by [@sap-ux/ui5-middleware-fe-mockserver@2.1.115]