This repository contains the relevant content of the presentation about the MockServer for OData v4 Applications on the UI5Con 2023 in St.Leon Germany
- Add the mockserver as a development dependency to your project. Thanks to the UI5-Tooling v3 we don't have to add the middleware to the ui5 dependencies anymore
npm i -D @sap-ux/ui5-middleware-fe-mockserver
- Add the configuration for the mockserver to the
ui5.yaml
.
- name: sap-fe-mockserver
beforeMiddleware: compression
mountPath: /
configuration:
service:
urlPath: "/path/to/service"
metadataXmlPath: "./path/to/metadata.xml"
mockdataRootPath: "./path/to/mockdata"
generateMockData: true
-
Restart the application and check that the mockserver is working.
-
We can enable a
watch
mode which will update the mock- and metadata when it changes -
To mock an
action
orfunctionImport
we can use theexecuteAction
hook:
executeAction: async function (actionDefinition, actionData, keys) {
}