Package Exports
- swagger-to-mock
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swagger-to-mock) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
swagger-to-mock
Mock data generator CLI for Swagger3 (OpenAPI 3)
Install
npm i swagger-to-mockGenerate mock data
swagger-to-mock <YOUR SWAGGER FILE OR URL>will generate JSON file per each API response.
JSON data values should be example values on your swagger if you specified examples.
Otherwise, swagger-to-mock follows data type rules and generate arbitrary values.
If there is no rule like format, values should be below.
string: ""
number: 0
integer: 0
boolean: true
array: []
object: {}Data Type Support [In Progress]
swagger-to-mock will follow rules based on OpenAPI 3 specification for each data type, If the example value is not specified.
Mixed Types
If you specify oneOf or anyOf, The value should be at the top type.
Numbers
- format
- Minimum and Maximum
- Multiples
String
- format
- pattern
Boolean
value should be true or false.
Null
Arrays
- Mixed-Type Arrays
- Array Length
Objects
- Free-Form Object