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

FEATURE - generateMockData doesn't generate navigationProperty data automatically #810

Closed TornadoM closed 2 days ago

TornadoM commented 7 months ago

Entity defined like:

  entity BusinessPartners {
       ...
        ProductOrders        : Association to many ProductOrders
                                 on  ProductOrders.businessPartner_XXX = xxx
                                 and ProductOrders.businessPartner_ID           = ID;
      ....
  }

Metadata like:

<EntityType Name="BusinessPartners">
...
<NavigationProperty Name="ProductOrders" Relationship="servicename.BusinessPartners_ProductOrders" FromRole="BusinessPartners" ToRole="ProductOrders"/>
...
</EntityType>

In UI, after filter on the parent entity and go to the object page, it will call the request like below, but it's empty:

http://localhost:808/v2/service-name/BusinessPartners(ID='ID_0',XXX='dummy')/ProductOrders

Could you please enable the automatic data generation for such navigation properties? Can we expect this in the near future?

Thanks.

nlunets commented 7 months ago

Hello @TornadoM from what I see here your navigation property doesn't come with any referential constraints, as such we cannot really invent a relationship here. If you have a referential contraints then that would be feasible (and should already work), but without that it's complicated

TornadoM commented 7 months ago

Hello @TornadoM from what I see here your navigation property doesn't come with any referential constraints, as such we cannot really invent a relationship here. If you have a referential contraints then that would be feasible (and should already work), but without that it's complicated

Hi Lunet,

Thanks a lot for the reply. I will generate a mock dataset json file for such navigation property call by myself. But how shall I name it correctly? If I want to define mockdata for BusinessPartners Entity, I just generate file "BusinessPartners.json". But for such navigation property call _BusinessPartners(ID='ID0',XXX='dummy')/ProductOrders , how should I name the json file to make the call reach the mock dataset in the file? Thanks a lot!

BTW, another question. Is that possible that I run a local backend server and I trigger some actions in UI from the test journey, and the mockdata files can be automatically recorded and written into the mockdata folder? Is mockserver or any other sap middleware able to handle this?

Thanks a lot!

Best Regards Ming

nlunets commented 3 months ago

Hello @TornadoM we have no support for local backend proxy to save data as you go :)

The data for the navigationProperty can be provided with the name of the target entityset or type as json.

You then have to ensure that you have a way to access those data, either through a defined referential constraint, or by matching key property names from parent to child.

You can also provide ProductOrders inline for all the entries you want (this should work)

nlunets commented 2 days ago

closing for lack of activities