Skip to content

Instantly share code, notes, and snippets.

@DoktorMike
Created December 31, 2019 12:15
Show Gist options
  • Save DoktorMike/b03df0fb9bb434ea0d3d21a1d008203b to your computer and use it in GitHub Desktop.
Save DoktorMike/b03df0fb9bb434ea0d3d21a1d008203b to your computer and use it in GitHub Desktop.
Generate client code from openapi specification through docker
#!/bin/bash
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/openapi.json \
-g go \
-o /local/out/go
@DoktorMike
Copy link
Author

DoktorMike commented Dec 31, 2019

This requires you to be in the correct directory where a file openapi.json is located. If it's named something else you need to rename it.

  • -g specifies which language to generate client for
  • -o specifies where to put the files

You can read more here: https://openapi-generator.tech/docs/usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment