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

FEATURE - mockserver - api to implement missing referential constraints #416

Closed antoine42 closed 1 year ago

antoine42 commented 1 year ago

Some odata servers may not provide referential constraints in the metadata for all kinds of navigation properties.

Therefore, when trying to use $expand on such navigation properties, the mock server doesn't now how to compute the link.

For example, using CAPM the following composition

@readonly
@title:'{i18n>CONNECTED_SYSTEM_COMMUNICATION_ARRANGEMENT}'
communicationArrangements: composition of many CommunicationArrangement on communicationArrangements.connectedSystemId = code;

is translated as

<NavigationProperty Name="communicationArrangements" Type="Collection(AdminServiceV5.CommunicationArrangements)">
  <OnDelete Action="Cascade"/>
</NavigationProperty>

We would need to find a way to implement such relationship in the mock server so it can implement $expand properly.

We are using the fe mockserver to run opa tests on productive apps and produce a code coverage report.

nlunets commented 1 year ago

Hi @antoine42 thanks for the report,

Before we look into this in more detail, would it be a solution for you to provide the data inline of the parent entity such as

{
   communicationArrangements: [....]
}

for each entry or would that make no sense ?

antoine42 commented 1 year ago

@nlunets we update the mock data & metadata using downloadScript1911.js on top of test landscapes.

We can't have manual changes to be done either on the mock data or the metadata (as we are sure someone will forget to do so one day).

We use $expand parameters in most of our queries so I guess the data could be there (but it's not 100% sure depending on some performance issues, we might do separate queries in parallel).

nlunets commented 1 year ago

Available in @sap-ux/ui5-middleware-fe-mockserver@2.1.57