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 13 forks source link

Double expand does not work for navigation property #466

Closed metzgerdirk closed 1 year ago

metzgerdirk commented 1 year ago

Our Fiori Elements V4 app uses the following call, which is working in the deployed version of our service:

Issues(ID=87f12d6a-ea57-41b7-bf82-c5e720721f5a,IsActiveEntity=true)/issueItems?$count=true&$select=HasActiveEntity,ID,IsActiveEntity&$expand=sourceObject($select=ID,externalId,name,navigation_action,navigation_parameters,navigation_semanticObject;$expand=businessObjectType($select=code,name))&$skip=0&$top=10 

When we execute the same call with the mockserver (Version/@sap-ux/ui5-middleware-fe-mockserver version 2.1.65 = latest available at the time of creation of this ticket), we get the following error:

HTTP/1.1 500 Internal Server Error sap-tenantid: tenant-default content-type: text/plain odata-version: 4.0 Cannot delete property '0' of [object String]

The relevant part of our data model looks like this:

entity Issues : cuid, managed {
    issueItems                          : Composition of many IssueItems on issueItems.issue = $self;
 }
entity IssueItems : cuid {
    issue         : Association to Issues;
    sourceObject  : Association to SourceObjects;
}
entity SourceObjects : cuid, managed {
    businessObjectType          : Association to one BusinessObjectCodes;
entity BusinessObjectCodes : CodeList {
    key code : String(48)
}

Please help, so the mockserver also supports this call.

Thanks and best regards, Dirk.

nlunets commented 1 year ago

Hi Dirk,

From what i've seen in your mockdata you are assigning string value instead of the object for the BusinessObjectCodes. As such the code is a bit lost :)

Can you check your mockdata as this is in theory supported and tested on our side

metzgerdirk commented 1 year ago

Hi Nicholas,

thanks a lot for having looked into the problem. Indeed providing the full navigation property instead of the key that is stored in the databased solved the problem. Strangely that in some instances it is ok to provide just the key of the navigation property ... apparently in others it isn't.

Best regards, Dirk.

nlunets commented 1 year ago

If you override the navigation property in your mockdata we assume that you know what you are doing :) Otherwise we try to resolve it using the referential constraint if they are available