open-ux-tools
open-ux-tools copied to clipboard
TBI - To separate the mock server logic from odata-service-writer
Description (include screenshots)
There are two ways to generate a ui5-mock.yaml configuration;
- using odata-service-writer
- using mock-server-writer
The following references, are using odata-service-writer
to create the ui5-mock.yaml configuration;
https://github.com/SAP/open-ux-tools/blob/434025c7516669dc29b076275d41c5fa723275f9/packages/fiori-freestyle-writer/src/index.ts#L6 https://github.com/SAP/open-ux-tools/blob/434025c7516669dc29b076275d41c5fa723275f9/packages/fiori-elements-writer/src/index.ts#L7 https://github.com/SAP/open-ux-tools/blob/434025c7516669dc29b076275d41c5fa723275f9/packages/ui5-config/src/ui5config.ts#L284
These instances rely on the@sap-ux/ui5-config
to return the sap-fe-mockserver
configuration and update what ever path is being given to it i.e.
public addMockServerMiddleware(path?: string, annotationsConfig?: MockserverConfig['annotations']): this {
this.document.appendTo({
path: 'server.customMiddleware',
value: getMockServerMiddlewareConfig(path, annotationsConfig)
});
return this;
}
This flow does not align with the mock-server-writer
which also implements the same logic. Additionaly, the method addMockServerMiddleware
is only ever run against a ui5-mock.yaml configuration and never a ui5.yaml configuration.
Value
Clear separate of concern.
Architecture Elaboration
Does it requires architecture elaboration? Yes
Notes
Tasks
TO BE DEFINED