A CLI that uses swagger-jsdoc to generate Swagger definitions, but dereferences all json-refs for compatibility.
npm install swagger-jsdoc-deref
 
A CLI that uses [swagger-jsdoc] and [json-refs] to generate an
OpenAPI/Swagger definition file from JSDoc-like comments, but allows for
arbitrary references and dereferences them in the output document. This is
particularly useful when working with certain consumers of OpenAPI that
don't parse json references.
`` sh`
npm install swagger-jsdoc-deref
From a console using npx
` sh`
npx swagger-jsdoc-deref -d ./path/to/definition/file.js -o ./other-path/output.json
In your package.json file:
` json`
{
"scripts": {
"generate-docs": "swagger-jsdoc-deref -d ./path/to/definition/file.js -o ./other-path/output.json"
}
}
You can also provide additional API snippets from yaml files by providing additional file arguments:
` sh`
npx swagger-jsdoc-deref -d ./path/to/definition/file.js -o ./other-path/output.json ./path/to/api/snippet.yaml
In your package.json file:
` json`
{
"scripts": {
"generate-docs": "swagger-jsdoc-deref -d ./path/to/definition/file.js -o ./other-path/output.json ./path/to/api/snippet.yaml"
}
}
` sh`
npm test
[swagger-jsdoc]: https://www.npmjs.com/package/swagger-jsdocjson-refs`]: https://www.npmjs.com/package/json-refs
[