You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to use fromJson with navigation properties it works perfectly if they are only assigned on the top level item (example: root>toItem). Nested navigationProperties (example: root>toItem>toScheduleLine) do not work, the entity builder does not have the functions assigned at that moment.
Try to build the entity with fromJson: salesOrderApi.entityBuilder().fromJson(data);
A warning is displayed: WARN (entity-builder): Field name "toScheduleLine" is already existing in "SalesOrderItem" and thus cannot be defined as custom field.
toItem works perfectly (top-level navigation property on SalesOrder API), but toScheduleLine on the SalesOrderItem Entity does not work as toScheduleLine is not assigned as a function.
Expected behavior
Nested navigation properties get assigned correctly.
Used Versions:
node version v20.18.0
npm version via npm -v 10.8.2
SAP Cloud SDK version you used as dependency "@sap-cloud-sdk/generator": "^3.22.2",
We are aware of this issue. We do a lazy init of 2nd level navigation properties. This is the reason why they don't get initialized.
As a workaround, can you destructure the nested apis as well (even if you don't use them). This ensures that the nested navigation properties are also initialized. An example would be :
Describe the bug
When trying to use
fromJson
with navigation properties it works perfectly if they are only assigned on the top level item (example: root>toItem). Nested navigationProperties (example: root>toItem>toScheduleLine) do not work, the entity builder does not have the functions assigned at that moment.To Reproduce
salesOrderApi.entityBuilder().fromJson(data);
WARN (entity-builder): Field name "toScheduleLine" is already existing in "SalesOrderItem" and thus cannot be defined as custom field.
toItem
works perfectly (top-level navigation property onSalesOrder
API), buttoScheduleLine
on theSalesOrderItem
Entity does not work astoScheduleLine
is not assigned as a function.Expected behavior
Nested navigation properties get assigned correctly.
Used Versions:
npm -v
10.8.2"@sap-cloud-sdk/generator": "^3.22.2",
Code example
(use data json object from above)
The text was updated successfully, but these errors were encountered: