Skip to content

Commit 4f210fe

Browse files
committed
fix(oas): respect STACKIT API versioning spec during OAS download
relates to STACKITSDK-136
1 parent f9b878e commit 4f210fe

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/download-oas.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ EOF
6464

6565
for dir in ${service_dir}/*; do
6666
version=$(basename "$dir")
67-
current_version_priority=3
67+
current_version_priority=999
6868
# Check if directory name starts with 'v'
6969
if [[ ${version} == v* ]]; then
7070
# Remove the 'v' prefix
@@ -85,9 +85,16 @@ EOF
8585
fi
8686
# Check if version is beta
8787
if [[ ${version} == *beta* ]]; then
88-
# Remove 'beta' suffix
89-
version=${version%beta*}
9088
current_version_priority=2
89+
90+
# check if the version is e.g. "v2beta2"
91+
if [[ ${version} =~ beta([0-9]+)$ ]]; then
92+
betaVersion="${BASH_REMATCH[1]}"
93+
current_version_priority=$((betaVersion+current_version_priority))
94+
fi
95+
96+
# Remove 'beta' suffix
97+
version=${version%beta*}
9198
fi
9299
# Compare versions, prioritizing GA over Beta over Alpha versions
93100
if [[ $((version)) -gt ${max_version} || ($((version)) -eq ${max_version} && ${current_version_priority} -gt ${max_version_priority}) ]]; then

0 commit comments

Comments
 (0)