I am trying to use custom templates on my swagger server code generated by swagger-codegen-v3 docker image. I am using an already validated yaml file as source, a trimmed version of pet-store sample.
I downloaded all mustache files from swagger-codegen/src/main/resources/flaskConnexion/* in master branch. I took a look at v3.0.0 branch but no mustache files there.
Running generate
docker run --rm -v $(pwd):/local swaggerapi/swagger-codegen-cli-v3 generate -i /local/openapi.yaml -l python-flask -o /local/out/python -t /local/custom_templates/
I am getting this error message:
Exception in thread "Thread-1" java.lang.RuntimeException: Could not generate model 'Address'
at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:457)
at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:788)
at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:388)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.github.jknack.handlebars.HandlebarsException: local/custom_templates/model.mustache:25:29: found: '-last', expected: 'no viable alternative at input '{{^-last''
{{name}} = {{{value}}}{{^-last}}
Where are the right mustache files for python-flask?
swagger-codegen-v3 mustache files are in another repository:
https://github.com/swagger-api/swagger-codegen-generators/
Download master version:
git clone --depth=1 https://github.com/swagger-api/swagger-codegen-generators.git
Go to mustache(Handlebars) files for Python and Flask:
cd swagger-codegen-generators/src/main/resources/handlebars/pythonFlaskConnexion/
Thanks @Helen, @William
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With