From 52cc6f97e0b94ec21720b3214375f172812f0e9b Mon Sep 17 00:00:00 2001 From: Arcane Engine Date: Sun, 13 Oct 2024 18:24:21 +0000 Subject: [PATCH] Add error handling and comments to generate_client.sh script --- generate_client.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/generate_client.sh b/generate_client.sh index f063092..46a106c 100755 --- a/generate_client.sh +++ b/generate_client.sh @@ -1,5 +1,27 @@ -docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ - -i https://arcane.engineer/api/openapi.yaml \ +#!/bin/bash + +# This script generates a Python client from the OpenAPI specification. +# It uses the openapitools/openapi-generator-cli Docker image to perform the generation. + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Define the OpenAPI specification URL +OPENAPI_SPEC_URL="https://arcane.engineer/api/openapi.yaml" + +# Define the output directory +OUTPUT_DIR="/local" + +# Run the OpenAPI Generator CLI Docker container +# - --rm: Automatically remove the container when it exits +# - -v "${PWD}:/local": Bind mount the current directory to /local in the container +# - -i: Input OpenAPI specification URL +# - -g: Generator name (python) +# - --additional-properties: Additional properties for the generator +# - -o: Output directory + +docker run --rm -v "${PWD}:${OUTPUT_DIR}" openapitools/openapi-generator-cli generate \ + -i ${OPENAPI_SPEC_URL} \ -g python \ --additional-properties generateSourceCodeOnly=true,projectName=arcane-engine,packageName=arcane \ - -o /local \ No newline at end of file + -o ${OUTPUT_DIR}