1

Does anyone have some experience with Swagger Codegen? Currently I am struggeling with the execution of the Swagger Codegen CLI. At first I tried to generate the Dart Code via the OpenAPI Generator following this tutorial: https://clearpoint.digital/blog/accelerate-flutter-development-with-contract-first-openapi-and-dart-code-generation/ This gave me 11k problems.

So I decided to try Swagger Codegen. I downloaded the Swagger-Codegen-cli 3.0.17, but it didn’t support Dart. The documentation states, that it does. With both versions I used templates to generate the Code. Help for any of the two solutions would be appreciated!

coala003
  • 71
  • 1
  • 2

2 Answers2

1

I am using this generator but it has some bugs especially oneOf and allOf tags. You can use like below and you can customize with mustache templates. In deed, they use handlebar templates after version 3.0.0 but i can't waste my time to adapt it.

java "-Duser.language=en" "-Duser.country=US" "-DapiTests=false" "-DapiDocs=false" "-DmodelTests=false" "-DmodelDocs=false" -jar .\swagger\swagger-codegen-cli.jar generate -i http://localhost:3635/api/specification.json -l dart -o ..\backend_client -t .\swagger\templates\dart --template-engine mustache --additional-properties pubName=backend_client

You can download mustache templates from here.

0

Give it a try with

java -jar openapi/openapi-generator-cli.jar generate -i openapi/openapi.yaml -g dart -c openapi/openapi_config.yaml --enable-post-process-file -o openapi/target --global-property models,apis,supportingFiles,modelTests=false,apiTests=false
Ledjon
  • 105
  • 8