Search code examples
dockerswaggercommand-line-interfaceapple-m1code-generation

Looking for workaround to run swagger-codegen-cli via docker on M1 Mac


I am trying to run swagger-codegen-cli via docker on an M1 Macbook but it either won't run or gets stuck in an endless loop (tested on different Macbooks). I have found out that there currently is no image for linux/arm64 and jugding by the swagger-codegen github, this won't change in the near future.

Now my question is, has somebody tested/used a workaround to run the swagger-codegen?

Command I am using:

#!/bin/bash
docker run --rm -it -v "${PWD}/../generated-restclient:/output" -v "${PWD}/specification.yml:/input/schema.yml" -v "${PWD}/config.json:/config/config.json" swaggerapi/swagger-codegen-cli-v3:3.0.46 generate -i /input/schema.yml -l typescript-axios -o /output -c /config/config.json

I tried different versions and tried running it with Rosetta emulation activated within docker - no success.

Thanks in advance!


Solution

  • According to https://hub.docker.com/r/swaggerapi/swagger-codegen-cli/tags and https://hub.docker.com/r/swaggerapi/swagger-codegen-cli-v3/tags, since 2.4.38/3.0.52 there is now also an image for Macs available. I haven't tested it but this resolves the need for a workaround.