woog
- simple wrapper of @openapitools/openapi-generator-cli, with some default configurations.
- woog means Wrapper Of Openapi Generator
- if use generator
openapioropenapi-yaml, paths and schemas in input file will be sorted
Install
npm i -g @openapitools/openapi-generator-cli woogUsage
woog <generatorDirName> [inputFileName=openapi] [outputDirName=out]example:
woog openapiwoog html2 openapi.json out.html2Config
if config file exists(<generatorDir>/config.yaml or <generatorDir>/config.yml or <generatorDir>/config.json)
generator will use it
you can put optional extra parameters in the config file:
x-generator
if the
generatorDiris not the same as generator name, you can set generator name with this parameter. eg: thegeneratorDirisjava-spring-codeand the generator name isspringx-template
if you want to use custom templates, set your template root dir to env
OPENAPI_TEMPLATE_ROOT(eg.D:\workspace\github\openapi-generator\modules\openapi-generator\src\main\resources), and add parameterx-templateto config file.truemeans useOPENAPI_TEMPLATE_ROOT/generatorNameas template dir- string value means use
OPENAPI_TEMPLATE_ROOT/<x-template value>as template dir - some generators have special template dir name(different from generator name).
these generators' template dir will be auto mapped if
x-templatehave been set totrue. for example:html2->htmlDocs2spring->JavaSpringjaxrs-cxf->JavaJaxRSjaxrs-cxf-cdi->JavaJaxRS
Note
- use
openapi-generator-cli version-manager listto switch openapi-generator-cli version(if download too slow, you can manually copy org.openapitools:openapi-generator-cli:.jar to<npm prefix dir>/node_modules/@openapitools/openapi-generator-cli/versions/, remember to rename it as format<version>.jar, like6.0.0.jar) - use
openapi-generator-cli listto get available generator names - use
openapi-generator-cli config-help -g <generatorName>to get generator config schema
License
MIT © rainmanhhh