Swagger client generation

August 7, 2024 ยท View on GitHub

Usage

Note: This requires Podman.

To update the Swagger Client with the new API specifications, run:

# go to repo root dir
cd $(git rev-parse --show-toplevel)

# generate client
# TODO: set base path as needed, as in "https://your-host/api/cps"
./tools/swagger-client-generator/generate-client.sh <BASE_PATH>

If you don't want to download the Swagger Specification, and just want to use the local files in tools/swagger-client-generator, run:

./tools/swagger-client-generator/generate-client.sh .

Podman setup

For mounting the user folder in Podman, make sure the machine was created with the option -v $HOME:$HOME.

To re-initialize your default podman machine, you can run the following commands

podman machine stop podman-machine-default
podman machine rm podman-machine-default

podman machine init -v $HOME:$HOME
podman machine start

Docker setup

For using the Docker CLI, make sure to specify the DOCKER and DOCKER_OPTS parameters when running the script

DOCKER=docker DOCKER_OPTS=" " ./tools/swagger-client-generator/generate-client.sh <BASE_PATH>