Skip to content
A mock file generator for swagger, help you customize data by cases
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
.babelrc
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

Badges

version NPM downloads Build Status

Install

npm i swagger-mock-file-generator-by-cases -s

API

require('swagger-mock-file-generator-by-cases')(<swaggerFile>, <mockFilePath>[, callback])

Output

The mock file name is converted api path through the '/' symbol.

If api path is 'api/v1/accompany/list', mock file name will be 'api-v1-accompany-list.json'.

Data in cases array will give priority to use example in difinitions, you can customize more data in json file.

{
    "cases": [
        {
            "data": {},
            "message": "success",
            "status": 0
        }
    ]
}

Notice: mockFilePath must be an absolute path string(eg './mock/').

This generator is based on swagger-mock-file-generator,thanks for supporting!

You can’t perform that action at this time.