Skip to content

Commit d650041

Browse files
authored
fix(oas): ignore iaasalpha spec during determination of latest iaas spec (#160)
also respect STACKIT API versioning spec for alpha during OAS download relates to #151
1 parent dbd57fa commit d650041

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/download-oas.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ EOF
5959
cd - > /dev/null
6060

6161
# Prioritize GA over Beta over Alpha versions
62-
# GA priority = 999, Beta priority >= 2, Alpha priority = 1
62+
# GA priority =999, Beta priority >=500, Alpha priority <500 and >=1
6363
max_version_priority=1
6464

6565
for dir in ${service_dir}/*; do
@@ -75,17 +75,26 @@ EOF
7575
# This check can be removed once the IaaS API moves all endpoints to Beta
7676
if [[ ${service} == "iaas" ]]; then
7777
mv -f ${dir}/*.json ${ROOT_DIR}/oas/iaasalpha.json
78+
continue
7879
fi
7980
if [[ ${ALLOW_ALPHA} != "true" ]]; then
8081
continue
8182
fi
83+
84+
current_version_priority=1
85+
86+
# check if the version is e.g. "v2alpha2"
87+
if [[ ${version} =~ alpha([0-9]+)$ ]]; then
88+
alphaVersion="${BASH_REMATCH[1]}"
89+
current_version_priority=$((alphaVersion+current_version_priority))
90+
fi
91+
8292
# Remove 'alpha' suffix
8393
version=${version%alpha*}
84-
current_version_priority=1
8594
fi
8695
# Check if version is beta
8796
if [[ ${version} == *beta* ]]; then
88-
current_version_priority=2
97+
current_version_priority=500
8998

9099
# check if the version is e.g. "v2beta2"
91100
if [[ ${version} =~ beta([0-9]+)$ ]]; then

0 commit comments

Comments
 (0)