npm i swagger-mock-file-generator-by-cases -s
require('swagger-mock-file-generator-by-cases')(<swaggerFile>, <mockFilePath>[, callback])
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!