sw2ngx
v6.9.0
Published
auto-generation of angular services by Swagger / OpenAPI declaration
Downloads
578
Maintainers
Readme
SW2NGX - Swagger to Angular
Generate Angular API services from swagger.json or openapi.json
💥 ATTENTION 💥: in version 6 and later breaking changes
if your project only uses swagger (openapi v2.x), use version no higher than 5.2.0
// for example
npx [email protected] -c https://petstore.swagger.io/v2/swagger.json -o ./path/to/api/module/folder
1. no need to install, just use!
// use preset
npx sw2ngx@latest -preset ./path/to/sw2ngx.json
// use cli params
npx sw2ngx@latest -preset ./path/to/sw2ngx.json
2. preset schema
|cli key| property | required | default | description | |-------|-----------|-----------|---------|--------------| | -c | config | ✅ | ❌ | path to configuration swagger/openapi json file | | -o | outputPath | ❎ | ./api | path to folder where create generated api files | | -baseHref | baseHref | ❎ | / | override base href constant for api services | | -preset | preset | ❎ | / | override base href constant for api services | | -tmpl | templates | ❎ | / |folder for templates default use /templates/default from library files | | -provide-in | provideIn | ❎ | 'root' | define default provideIn in services | | -srv-interface | baseHref | ❎ | false | add interfaces to service generation | | -parser-custom-method-name | parserMethodName | ❎ | defaultMethodNameParser | file for parsing method name function | | -parser-custom-model-name | parserModelName | ❎ | defaultModelNameParser | file for parsing model name function |