ntg
ntg

Reputation: 14145

swagger-codegen-cli: how to pass additional-properties

swagger-codegen is used in the "official" https://editor.swagger.io/ - https://editor-next.swagger.io/ pages to convert .json or .yaml of swagger APIs to e.g. client code.

java -jar ./swagger-codegen-cli.jar config-help -l python provides information on the available options, e.g.

projectName
    python project name in setup.py (e.g. petstore-api).

My question is how to set the option from the cli... obviously directly as an option seems not working

Upvotes: 0

Views: 2229

Answers (1)

Helen
Helen

Reputation: 98011

Swagger Codegen CLI accepts those options as -D{optionName}={optionValue}.

For example (line breaks added for readability):

java -jar ./swagger-codegen-cli.jar generate
     -i myapi.yaml
     -l python
     -o ./python-sdk
     -DprojectName=MyApi

Another approach is to use the config.json file.

Upvotes: 3

Related Questions