Loading common-openapi/cli-validate-openapis-mec.sh +51 −7 Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ DOCKER_IMAGE_REDOC=redocly/cli:2.20.4 echo -e "\n------ Switching to $1 folder --------" cd $1 cd "$1" CONFIG_FILE="doc/config-refs.yaml" echo "------ Checking for previous logs ------" if [ -f "$LOGFILE" ] ; then Loading Loading @@ -52,7 +53,7 @@ if ! ls | grep -Eq '\.ya?ml$|\.json$'; then exit 0 fi function get_ref { function get_refs_from_file_parsing { echo -e "---- Getting refs for $1: " # Parse any ref not starting with #/in the yaml files and put it in a variable # Examples (simple quotes are part of the reference lines): Loading @@ -68,8 +69,8 @@ function get_ref { for ref in $refs; do if [ -f "externals/$ref" ]; then echo "Copying $ref from externals" cp "externals/$ref" "./$ref" #get_ref "$ref" copy_ref "$ref" #get_ref "$ref" - recursive call to get_refs_from_file_parsing else echo "File $ref not found in externals" exit 1 Loading @@ -80,9 +81,45 @@ function get_ref { fi } function copy_ref { echo -e "---- Copying ref $1: " # Copy the ref to the current directory cp "externals/$1" "./$1" } function get_refs_from_config { echo -e "---- Getting refs from config file $CONFIG_FILE: " # Config file contains one YAML filename per non-empty, non-comment line # Example: # TS29122_CpProvisioning.yaml # TS29122_V2XInformationServices.yaml refs=$(grep -Ev '^\s*(#|$)' "$1" | tr -d '\r' | sort -u) echo "Refs: $refs" if [ -d "externals" ] && [ -n "$(find externals -name '*.yaml')" ]; then echo "Processing external YAML files from config..." for ref in $refs; do if [ -f "externals/$ref" ]; then echo "Copying $ref from externals (from config)" copy_ref "$ref" else echo "File $ref not found in externals (from config)" exit 1 fi done else echo "No external YAML files to process from config" fi } # If a config file is provided , use it to resolve refs; # otherwise, fall back to parsing $ref entries from YAML files. if [ -n "$CONFIG_FILE" ] && [ -f "$CONFIG_FILE" ]; then get_refs_from_config "$CONFIG_FILE" else for i in ./*.yaml ; do get_ref "$i" get_refs_from_file_parsing "$i" done fi TMP_FULL_LOG=$(mktemp) TMP_ERR_LOG=$(mktemp) Loading @@ -95,6 +132,13 @@ ERR="" # for i in $specfiles ; do for i in ./*.yaml ; do # Skip files whose basename starts with "TS" bname=$(basename "$i") if [[ "$bname" == TS* ]]; then echo -e "\n--- Skipping $i (starts with TS) ---" | tee -a "$LOGFILE" continue fi echo -e "\n--- Validating $i ---" | tee -a "$LOGFILE" TMP_OUTPUT=$(mktemp) validate "$i" 2>&1 | tee $TMP_OUTPUT Loading Loading
common-openapi/cli-validate-openapis-mec.sh +51 −7 Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ DOCKER_IMAGE_REDOC=redocly/cli:2.20.4 echo -e "\n------ Switching to $1 folder --------" cd $1 cd "$1" CONFIG_FILE="doc/config-refs.yaml" echo "------ Checking for previous logs ------" if [ -f "$LOGFILE" ] ; then Loading Loading @@ -52,7 +53,7 @@ if ! ls | grep -Eq '\.ya?ml$|\.json$'; then exit 0 fi function get_ref { function get_refs_from_file_parsing { echo -e "---- Getting refs for $1: " # Parse any ref not starting with #/in the yaml files and put it in a variable # Examples (simple quotes are part of the reference lines): Loading @@ -68,8 +69,8 @@ function get_ref { for ref in $refs; do if [ -f "externals/$ref" ]; then echo "Copying $ref from externals" cp "externals/$ref" "./$ref" #get_ref "$ref" copy_ref "$ref" #get_ref "$ref" - recursive call to get_refs_from_file_parsing else echo "File $ref not found in externals" exit 1 Loading @@ -80,9 +81,45 @@ function get_ref { fi } function copy_ref { echo -e "---- Copying ref $1: " # Copy the ref to the current directory cp "externals/$1" "./$1" } function get_refs_from_config { echo -e "---- Getting refs from config file $CONFIG_FILE: " # Config file contains one YAML filename per non-empty, non-comment line # Example: # TS29122_CpProvisioning.yaml # TS29122_V2XInformationServices.yaml refs=$(grep -Ev '^\s*(#|$)' "$1" | tr -d '\r' | sort -u) echo "Refs: $refs" if [ -d "externals" ] && [ -n "$(find externals -name '*.yaml')" ]; then echo "Processing external YAML files from config..." for ref in $refs; do if [ -f "externals/$ref" ]; then echo "Copying $ref from externals (from config)" copy_ref "$ref" else echo "File $ref not found in externals (from config)" exit 1 fi done else echo "No external YAML files to process from config" fi } # If a config file is provided , use it to resolve refs; # otherwise, fall back to parsing $ref entries from YAML files. if [ -n "$CONFIG_FILE" ] && [ -f "$CONFIG_FILE" ]; then get_refs_from_config "$CONFIG_FILE" else for i in ./*.yaml ; do get_ref "$i" get_refs_from_file_parsing "$i" done fi TMP_FULL_LOG=$(mktemp) TMP_ERR_LOG=$(mktemp) Loading @@ -95,6 +132,13 @@ ERR="" # for i in $specfiles ; do for i in ./*.yaml ; do # Skip files whose basename starts with "TS" bname=$(basename "$i") if [[ "$bname" == TS* ]]; then echo -e "\n--- Skipping $i (starts with TS) ---" | tee -a "$LOGFILE" continue fi echo -e "\n--- Validating $i ---" | tee -a "$LOGFILE" TMP_OUTPUT=$(mktemp) validate "$i" 2>&1 | tee $TMP_OUTPUT Loading