up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Symbols Server CI / symbols-smoke (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Symbols Server CI / symbols-smoke (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
This commit is contained in:
37
src/Sdk/StellaOps.Sdk.Generator/python/generate-python.sh
Normal file
37
src/Sdk/StellaOps.Sdk.Generator/python/generate-python.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
root_dir="$(cd -- "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
config="$root_dir/python/config.yaml"
|
||||
spec="${STELLA_OAS_FILE:-}"
|
||||
|
||||
if [ -z "$spec" ]; then
|
||||
echo "STELLA_OAS_FILE is required (path to OpenAPI spec)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
output_dir="${STELLA_SDK_OUT:-$root_dir/out/python}"
|
||||
mkdir -p "$output_dir"
|
||||
|
||||
export STELLA_POSTPROCESS_ROOT="$output_dir"
|
||||
export STELLA_POSTPROCESS_LANG="python"
|
||||
|
||||
jar="${STELLA_OPENAPI_GENERATOR_JAR:-$root_dir/tools/openapi-generator-cli-7.4.0.jar}"
|
||||
if [ ! -f "$jar" ]; then
|
||||
echo "OpenAPI Generator CLI jar not found at $jar" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAVA_OPTS="${JAVA_OPTS:-} -Dorg.openapitools.codegen.utils.postProcessFile=$root_dir/postprocess/postprocess.sh"
|
||||
export JAVA_OPTS
|
||||
|
||||
java -jar "$jar" generate \
|
||||
-i "$spec" \
|
||||
-g python \
|
||||
-c "$config" \
|
||||
--skip-validate-spec \
|
||||
--enable-post-process-file \
|
||||
--global-property models,apis,supportingFiles \
|
||||
-o "$output_dir"
|
||||
|
||||
echo "Python SDK generated at $output_dir"
|
||||
Reference in New Issue
Block a user