swagger-extract-definitions
v1.0.7
Published
Retrieves TypeScript definitions from Swagger json files
Maintainers
Readme
swagger-extract-definitions
Extracts TypeScript definitions from Swagger json files. Based on json-schema-to-typescript and fastify-extract-definitions packages.
Pre requirements
node.js:>=22.*
Installation
Install it with yarn:
yarn add swagger-extract-definitionsOr with npm:
npm install swagger-extract-definitionsUsage
Add it to your project with register, pass it some options, and you are done!
⚠️ Note! Use this package for development only.
"scripts": {
"generate:types": "swagger-extract-definitions --targetDir=./schemas --outDir=./src"
}See example for more details.
Options
| key | type | default | description |
| ---------- | --------- | ----------------------------- | ----------------------------------- |
| outDir | string | ./src/shared/api | Output directory |
| targetDir | string | ./scripts/generated/schemas | Target directory with .json files |
| ignoreHead | boolean | _generated.ts | Filename |
License
MIT
