Loading common-openapi/generateOpenapi.sh +9 −6 Original line number Original line Diff line number Diff line Loading @@ -35,19 +35,22 @@ echo "\n------ Checking for docker image --------" echo "------ Getting spec and config files--------" echo "------ Getting spec and config files--------" # Get project prefix (e.g., gs030) from the project path # Get project prefix (e.g., gs030) from the project path project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') echo $project_prefix echo "Project prefix: $project_prefix" echo $1 echo "Project path: $1" echo $2 echo "Config file: $2" # Get all config files for this project # Get all config files for this project configs=$(grep -A20 "^[[:space:]]*$project_prefix:" "../$2" | grep "config_file" | sed 's/.*config_file:[[:space:]]*"\(.*\)".*/\1/') # Extract the section between project prefix and the next project or end of file project_section=$(sed -n "/^[[:space:]]*$project_prefix:/,/^[[:space:]]*gs[0-9]\{3\}:/p" "../$2" | sed '$d') # Extract config_file values configs=$(echo "$project_section" | grep "config_file:" | sed 's/.*config_file:[[:space:]]*"\(.*\)".*/\1/') if [ -z "$configs" ]; then if [ -z "$configs" ]; then echo "No config files found for project $project_prefix" echo "No config files found for project $project_prefix" exit 1 exit 1 fi fi echo $configs echo "Found configs: $configs" # Process each config file # Process each config file echo "$configs" | while read -r config; do echo "$configs" | while read -r config; do Loading @@ -71,7 +74,7 @@ echo "$configs" | while read -r config; do fi fi # Find corresponding openapi name for this config # Find corresponding openapi name for this config new_name=$(grep -A20 "^[[:space:]]*$project_prefix:" "../$2" | grep -B1 "config_file:.*$config" | grep "openapi_name" | sed 's/.*openapi_name:[[:space:]]*"\(.*\)".*/\1/') new_name=$(echo "$project_section" | grep -B1 "config_file:.*$config" | grep "openapi_name" | sed 's/.*openapi_name:[[:space:]]*"\(.*\)".*/\1/') if [ ! -z "$new_name" ]; then if [ ! -z "$new_name" ]; then echo "Renaming $openapi to $new_name" echo "Renaming $openapi to $new_name" Loading Loading
common-openapi/generateOpenapi.sh +9 −6 Original line number Original line Diff line number Diff line Loading @@ -35,19 +35,22 @@ echo "\n------ Checking for docker image --------" echo "------ Getting spec and config files--------" echo "------ Getting spec and config files--------" # Get project prefix (e.g., gs030) from the project path # Get project prefix (e.g., gs030) from the project path project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') echo $project_prefix echo "Project prefix: $project_prefix" echo $1 echo "Project path: $1" echo $2 echo "Config file: $2" # Get all config files for this project # Get all config files for this project configs=$(grep -A20 "^[[:space:]]*$project_prefix:" "../$2" | grep "config_file" | sed 's/.*config_file:[[:space:]]*"\(.*\)".*/\1/') # Extract the section between project prefix and the next project or end of file project_section=$(sed -n "/^[[:space:]]*$project_prefix:/,/^[[:space:]]*gs[0-9]\{3\}:/p" "../$2" | sed '$d') # Extract config_file values configs=$(echo "$project_section" | grep "config_file:" | sed 's/.*config_file:[[:space:]]*"\(.*\)".*/\1/') if [ -z "$configs" ]; then if [ -z "$configs" ]; then echo "No config files found for project $project_prefix" echo "No config files found for project $project_prefix" exit 1 exit 1 fi fi echo $configs echo "Found configs: $configs" # Process each config file # Process each config file echo "$configs" | while read -r config; do echo "$configs" | while read -r config; do Loading @@ -71,7 +74,7 @@ echo "$configs" | while read -r config; do fi fi # Find corresponding openapi name for this config # Find corresponding openapi name for this config new_name=$(grep -A20 "^[[:space:]]*$project_prefix:" "../$2" | grep -B1 "config_file:.*$config" | grep "openapi_name" | sed 's/.*openapi_name:[[:space:]]*"\(.*\)".*/\1/') new_name=$(echo "$project_section" | grep -B1 "config_file:.*$config" | grep "openapi_name" | sed 's/.*openapi_name:[[:space:]]*"\(.*\)".*/\1/') if [ ! -z "$new_name" ]; then if [ ! -z "$new_name" ]; then echo "Renaming $openapi to $new_name" echo "Renaming $openapi to $new_name" Loading