2.0.0 • Published 2 years ago
@romuleald/swggr-ts-gen v2.0.0
swggr-ts-gen
A low config over swagger-typescript-api to manage type in your project.
- install
npm i -D @romuleald/swggr-ts-gen at the root of you
package.jsonadd"swggr-ts-gen": { "localJson": "dto/jsons", "output": "dto/types", "typePrefix": true, "apis": [ { "url": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v2.0/json/api-with-examples.json", "name": "exemple" } ] }- under
apis:urlwill be your openapi json from swagger andnamethe name of the file. localJsonrefer to swagger json files (in openapi format) in your repository.outputrefer to the path where .ts file will be created.typePrefixit will PascCase the api name. For json file il will PascalCase from the filename (eg. my-api => MyApi).
- under
add a command in your scripts
"dto-doc": "swggr-ts-gen"- execute
npm run dto-doc - DTOs will be generated in
./dto/typesfrom the root of your project