2.2.41 • Published 7 days ago

@sap-ux/ui5-middleware-fe-mockserver v2.2.41

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 days ago

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

Features

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.

Installation

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

Usage

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": [
        "@sap-ux/ui5-middleware-fe-mockserver"
    ]
}

[..]

Example for a yaml configuration file

specVersion: '2.0'
metadata:
  name: <NAME>
type: application
server:
  customMiddleware:
    - name: sap-fe-mockserver
      mountPath: /
      afterMiddleware: compression
      configuration:
        annotations:
          - localPath: './webapp/localService/myServiceAnnotation.xml'
            urlPath: '/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations*'
        services:
          - 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

Documentation

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

Support

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.

Keywords

Mockserver, Middleware

2.2.40

7 days ago

2.2.41

7 days ago

2.2.39

10 days ago

2.2.38

20 days ago

2.2.37

1 month ago

2.2.36

2 months ago

2.2.35

2 months ago

2.2.34

2 months ago

2.2.33

2 months ago

2.2.31

2 months ago

2.2.32

2 months ago

2.2.29

2 months ago

2.2.30

2 months ago

2.2.28

2 months ago

2.2.27

2 months ago

2.2.26

3 months ago

2.2.25

3 months ago

2.2.24

3 months ago

2.2.22

3 months ago

2.2.23

3 months ago

2.2.21

3 months ago

2.2.20

3 months ago

2.2.19

4 months ago

2.2.18

4 months ago

2.2.17

4 months ago

2.2.16

4 months ago

2.2.15

4 months ago

2.2.14

4 months ago

2.2.13

5 months ago

2.2.11

5 months ago

2.2.12

5 months ago

2.2.10

5 months ago

2.2.9

5 months ago

2.2.8

5 months ago

2.2.1

7 months ago

2.2.0

7 months ago

2.2.3

6 months ago

2.2.2

7 months ago

2.2.5

6 months ago

2.2.4

6 months ago

2.2.7

6 months ago

2.2.6

6 months ago

2.1.112

10 months ago

2.1.114

10 months ago

2.1.113

10 months ago

2.1.116

9 months ago

2.1.115

9 months ago

2.1.118

8 months ago

2.1.117

8 months ago

2.1.119

8 months ago

2.1.121

8 months ago

2.1.120

8 months ago

2.1.123

7 months ago

2.1.122

8 months ago

2.1.125

7 months ago

2.1.124

7 months ago

2.1.111

11 months ago

2.1.89

1 year ago

2.1.87

1 year ago

2.1.88

1 year ago

2.1.98

12 months ago

2.1.99

11 months ago

2.1.101

11 months ago

2.1.96

12 months ago

2.1.100

11 months ago

2.1.97

12 months ago

2.1.103

11 months ago

2.1.94

12 months ago

2.1.102

11 months ago

2.1.95

12 months ago

2.1.105

11 months ago

2.1.92

12 months ago

2.1.104

11 months ago

2.1.93

12 months ago

2.1.107

11 months ago

2.1.90

1 year ago

2.1.106

11 months ago

2.1.91

12 months ago

2.1.109

11 months ago

2.1.108

11 months ago

2.1.110

11 months ago

2.1.85

1 year ago

2.1.86

1 year ago

2.1.83

1 year ago

2.1.84

1 year ago

2.1.81

1 year ago

2.1.82

1 year ago

2.1.80

1 year ago

2.1.69

1 year ago

2.1.67

1 year ago

2.1.68

1 year ago

2.1.65

1 year ago

2.1.66

1 year ago

2.1.63

1 year ago

2.1.64

1 year ago

2.1.78

1 year ago

2.1.79

1 year ago

2.1.76

1 year ago

2.1.77

1 year ago

2.1.74

1 year ago

2.1.75

1 year ago

2.1.72

1 year ago

2.1.73

1 year ago

2.1.70

1 year ago

2.1.71

1 year ago

2.1.58

1 year ago

2.1.59

1 year ago

2.1.56

1 year ago

2.1.57

1 year ago

2.1.54

1 year ago

2.1.55

1 year ago

2.1.61

1 year ago

2.1.62

1 year ago

2.1.60

1 year ago

2.1.49

1 year ago

2.1.47

1 year ago

2.1.48

1 year ago

2.1.45

1 year ago

2.1.46

1 year ago

2.1.44

1 year ago

2.1.52

1 year ago

2.1.50

1 year ago

2.1.51

1 year ago

2.1.43

1 year ago

2.1.41

2 years ago

2.1.42

2 years ago

2.1.40

2 years ago

2.1.39

2 years ago

2.1.28

2 years ago

2.1.29

2 years ago

2.1.38

2 years ago

2.1.36

2 years ago

2.1.37

2 years ago

2.1.34

2 years ago

2.1.35

2 years ago

2.1.32

2 years ago

2.1.33

2 years ago

2.1.30

2 years ago

2.1.31

2 years ago

2.1.18

2 years ago

2.1.19

2 years ago

2.1.27

2 years ago

2.1.25

2 years ago

2.1.26

2 years ago

2.1.23

2 years ago

2.1.6

2 years ago

2.1.24

2 years ago

2.1.5

2 years ago

2.1.21

2 years ago

2.1.8

2 years ago

2.1.22

2 years ago

2.1.7

2 years ago

2.1.20

2 years ago

2.1.9

2 years ago

2.1.16

2 years ago

2.1.17

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago