Skip to content

Commit

Permalink
changed openapi generator to Bash Launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravm committed Jul 9, 2024
1 parent 5d9c4bf commit 0d8d25c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ target/
debug/
Cargo.lock
openapitools.json
package.json
package-lock.json
node_modules/
lib/src/**/models/
*.log
funnel-work-dir/
Expand Down
19 changes: 10 additions & 9 deletions build-models.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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/"

0 comments on commit 0d8d25c

Please sign in to comment.