yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
626 stars 147 forks source link

Add support for running scripts after code generation #234

Closed mackoj closed 3 years ago

mackoj commented 4 years ago

The goal of this PR is to allow to run scripts on generated code after the generation.

You will need to add postGenerationScript: ["<script call here>", "<another script>"] in your template.yml file in order for it to work.

This is an exemple of what it can do.

  postGenerationScript: ["swift-format -m format  -r -i __DESTNATION_PATH__"] # script to execute post generation

Adding this will reformat the generated code with swift-format.

For the moment it only have one context variable __DESTNATION_PATH__ that will transform into the final destinationPath.

I hope it helps.