
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
swagger-to-mock
Advanced tools
Mock data generator CLI for Swagger3 (OpenAPI 3)
npm i -g swagger-to-mock
swagger-to-mock <YOUR SWAGGER FILE>
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: {}
If we pass an example YAML file
responses:
'200':
description: pet response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
swagger-to-mock
will generate file named pets_get_200.json
and the body should be below
[
{
"name": "",
"tag": "",
"id": 0
}
]
Naming JSON file will follow the format below.
${API_PATH}_${HTTP_METHOD}_${RESPONSE_STATUS}.json
swagger-to-mock
will follow rules based on OpenAPI 3 specification for each data type, If the example value is not specified.
If you specify oneOf
or anyOf
, The value should be at the top type.
value should be true
or false
.
FAQs
mock data generator from Swagger (OpenAPI 3)
The npm package swagger-to-mock receives a total of 19,407 weekly downloads. As such, swagger-to-mock popularity was classified as popular.
We found that swagger-to-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.