TypeScript icon, indicating that this package has built-in type declarations

2.2.53 • Public • Published



The SAP Fiori - UI5 middleware for the Fiori elements mock server is a middleware extension for the UI5 Tooling. As an alternative to proxying OData requests to a live backend, it supports loading mock data for OData v2/v4 requests for supported Fiori elements templates. As the mock server runs locally without requiring a network connection to a backend system, it is useful for development and test scenarios.


npm npm install --save-dev @sap-ux/ui5-middleware-fe-mockserver

yarn yarn add @sap-ux/ui5-middleware-fe-mockserver --dev

pnpm pnpm add @sap-ux/ui5-middleware-fe-mockserver --dev


In order to use the mock server, the npm module @sap-ux/ui5-middleware-fe-mockserver needs to be added as devDependency and ui5.dependencies to package.json, and a valid ui5.yaml configuration needs to be provided. Entries in package.json


"devDependencies": {
    "@sap-ux/ui5-middleware-fe-mockserver": "^2"
"ui5": {
    "dependencies": [


Example for a yaml configuration file

specVersion: '2.0'
  name: <NAME>
type: application
    - name: sap-fe-mockserver
      mountPath: /
      afterMiddleware: compression
          - localPath: './webapp/localService/myServiceAnnotation.xml'
            urlPath: '/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations*'
          - urlPath: '/sap/opu/odata/sap/<SERVICE_NAME>'
            metadataPath: './webapp/localService/metadata.xml'
            mockdataPath: './webapp/localService/data'
          - urlPath: '/sap/opu/odata/sap/<OTHER_SERVICE_NAME>'
            metadataPath: './webapp/localService/other_metadata.xml'
            mockdataPath: './webapp/localService/data'

Special case within karma

If you are running the mockserver embedded in karma you need to change the configuration to use

beforeMiddleware: csp instead of afterMiddleware: compression

Service Configuration

Each service must provide at least two things

  • urlPath : where will your service be accessible from
  • metadataPath : local path to your metadata file

On top of that you can specify one of the following option

  • mockdataPath : the path to the folder containing the mockdata files
  • generateMockData : whether or not you want to use automatically generated mockdata
  • forceNullableValuesToNull: determine if nullable properties should be generated as null or with a default value (defaults to false)

Additional option are available either per service of for all services if defined globally

  • debug : toggle the debug mode
  • watch : toggle the watch mode, the mockserver will restart the service where data or metadata have changed
  • noETag : disable ETag support on metadata
  • strictKeyMode : disable the default "loose" mode for the key matching, you can try this if the mockserver returns too much data
  • contextBasedIsolation : enable the support of "tenants", by adding /tenant-xxx at the very start of your service call you will be able to work on tenant isolated data.

You can also define static annotation file using the annotations entry, each annotation must provide

  • urlPath : where will your annotation be accessible from
  • localPath : local path to your annotation file


You can find more details on how to influence the mockserver behavior for mockdata by checking the documentation under Defining Mockdata

We also have samples available in the samples folder

Sample application

See the usage in demo apps SAP Fiori sample apps


Join the SAP Fiori tools Community. Ask Questions, Read the Latest Blogs, Explore Content. Please assign tag: SAP Fiori tools

To log an issue with SAP Fiori tools, please see Contact SAP Support.


Mockserver, Middleware




Package Sidebar


npm i @sap-ux/ui5-middleware-fe-mockserver

Weekly Downloads






Unpacked Size

33 kB

Total Files


Last publish


  • sap_extncrepos
  • kranthie.sap
  • tqueck