From 0d8d25cf32933cb8745130cd701d69a191a70d8c Mon Sep 17 00:00:00 2001 From: aaravm Date: Tue, 9 Jul 2024 10:41:08 +0530 Subject: [PATCH] changed openapi generator to Bash Launcher --- .gitignore | 3 --- build-models.sh | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 8c999f8..04b8825 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ target/ debug/ Cargo.lock openapitools.json -package.json -package-lock.json -node_modules/ lib/src/**/models/ *.log funnel-work-dir/ diff --git a/build-models.sh b/build-models.sh index f1c7385..ec122d0 100755 --- a/build-models.sh +++ b/build-models.sh @@ -1,6 +1,13 @@ # Exit immediately if a command exits with a non-zero status. set -e +# Ensure the OpenAPI Generator JAR file is set up +mkdir -p ~/bin/openapitools +OPENAPI_GENERATOR_JAR=~/bin/openapitools/openapi-generator-cli.jar +if [ ! -f "$OPENAPI_GENERATOR_JAR" ]; then + curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -o "$OPENAPI_GENERATOR_JAR" +fi + get_git_repo_name() { # Extract the URL of the remote "origin" url=$(git config --get remote.origin.url) @@ -25,8 +32,8 @@ generate_openapi_models() { # Remove the temporary directory at the end of the script trap 'rm -rf "$TEMP_OUTPUT_DIR"' EXIT - # Run the OpenAPI generator CLI - npx openapi-generator-cli generate -g rust \ + # Run the OpenAPI generator CLI using the JAR file + java -jar "$OPENAPI_GENERATOR_JAR" generate -g rust \ -i "$OPENAPI_SPEC_PATH" \ -o "$TEMP_OUTPUT_DIR" \ --additional-properties=useSingleRequestParameter=true @@ -61,16 +68,10 @@ generate_openapi_models() { echo "OpenAPI generation complete. Models copied to $DESTINATION_DIR" } -# Check if OpenAPI Generator CLI is installed -if ! npx openapi-generator-cli version > /dev/null 2>&1; then - # Install OpenAPI Generator CLI locally - npm install -g @openapitools/openapi-generator-cli -fi - generate_openapi_models \ "https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-info/develop/service-info.yaml" \ "serviceinfo" "$SCRIPT_DIR/lib/src/serviceinfo/" generate_openapi_models \ "https://raw.githubusercontent.com/ga4gh/task-execution-schemas/develop/openapi/task_execution_service.openapi.yaml" \ - "tes" "$SCRIPT_DIR/lib/src/tes/" + "tes" "$SCRIPT_DIR/lib/src/tes/" \ No newline at end of file