Skip to content

Commit bd0c000

Browse files
committed
fix: api spec priority
- GA should always be prioritized if e.g. v2beta and v1 api spec exists, the v1 should be used
1 parent 70997a1 commit bd0c000

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/download-oas.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ EOF
9696
if [[ ${version} == *beta* ]]; then
9797
current_version_priority=500
9898

99-
# check if the version is e.g. "v2beta2"
100-
if [[ ${version} =~ beta([0-9]+)$ ]]; then
101-
betaVersion="${BASH_REMATCH[1]}"
102-
current_version_priority=$((betaVersion+current_version_priority))
103-
fi
99+
# check if the version is e.g. "v2beta2"
100+
if [[ ${version} =~ beta([0-9]+)$ ]]; then
101+
betaVersion="${BASH_REMATCH[1]}"
102+
current_version_priority=$((betaVersion+current_version_priority))
103+
fi
104104

105-
# Remove 'beta' suffix
106-
version=${version%beta*}
105+
# Remove 'beta' suffix
106+
version=${version%beta*}
107107
fi
108108
# Compare versions, prioritizing GA over Beta over Alpha versions
109-
if [[ $((version)) -gt ${max_version} || ($((version)) -eq ${max_version} && ${current_version_priority} -gt ${max_version_priority}) ]]; then
109+
if [[ ($((version)) -ge ${max_version} && ${current_version_priority} -ge ${max_version_priority}) ]]; then
110110
max_version=$((version))
111111
max_version_dir=${dir}
112112
max_version_priority=${current_version_priority}

0 commit comments

Comments
 (0)