fix(api-ref): Update getswagger.sh destination paths to use the new directory structure when fetching spec files. Update the redocly plugin module path.

fix-api-ref-paths
Jason Stirnaman 2025-01-28 12:31:47 -06:00
parent f1d82f4b00
commit 8509ea36d6
7 changed files with 34 additions and 29 deletions

View File

@ -1,5 +1,5 @@
plugins:
- './openapi/plugins/docs-plugin.js'
- './../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all

View File

@ -139,93 +139,98 @@ function postProcess() {
}
function updateCloudV2 {
outFile="cloud/v2/ref.yml"
outFile="influxdb/cloud/v2/ref.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
fi
postProcess $outFile 'cloud/.config.yml' v2@2
postProcess $outFile 'influxdb/cloud/.config.yml' v2@2
}
function updateCloudDedicatedManagement {
outFile="cloud-dedicated/management/openapi.yml"
outFile="influxdb3/cloud-dedicated/management/openapi.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS https://raw.githubusercontent.com/influxdata/granite/ab7ee2aceacfae7f415d15ffbcf8c9d0f6f3e015/openapi.yaml -o $outFile
# Clone influxdata/granite and fetch the latest openapi.yaml file.
echo "Fetching the latest openapi.yaml file from influxdata/granite"
tmp_dir=$(mktemp -d)
git clone --depth 1 --branch main https://github.com/influxdata/granite.git "$tmp_dir"
cp "$tmp_dir/openapi.yaml" "$outFile"
rm -rf "$tmp_dir"
fi
postProcess $outFile 'cloud-dedicated/.config.yml' management@0
postProcess $outFile 'influxdb3/cloud-dedicated/.config.yml' management@0
}
function updateCloudDedicatedV2 {
outFile="cloud-dedicated/v2/ref.yml"
outFile="influxdb3/cloud-dedicated/v2/ref.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
fi
postProcess $outFile 'cloud-dedicated/.config.yml' v2@2
postProcess $outFile 'influxdb3/cloud-dedicated/.config.yml' v2@2
}
function updateClusteredV2 {
outFile="clustered/v2/ref.yml"
outFile="influxdb3/clustered/v2/ref.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
fi
postProcess $outFile 'clustered/.config.yml' v2@2
postProcess $outFile 'influxdb3/clustered/.config.yml' v2@2
}
function updateCloudServerlessV2 {
outFile="cloud-serverless/v2/ref.yml"
outFile="influxdb3/cloud-serverless/v2/ref.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
fi
postProcess $outFile 'cloud-serverless/.config.yml' v2@2
postProcess $outFile 'influxdb3/cloud-serverless/.config.yml' v2@2
}
function updateOSSV2 {
outFile="v2/ref.yml"
outFile="influxdb/v2/ref.yml"
if [[ -z "$baseUrlOSS" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrlOSS}/contracts/ref/oss.yml -o $outFile
fi
postProcess $outFile 'v2/.config.yml' '@2'
postProcess $outFile 'influxdb/v2/.config.yml' '@2'
}
function updateV1Compat {
outFile="cloud/v1-compatibility/swaggerV1Compat.yml"
outFile="influxdb/cloud/v1-compatibility/swaggerV1Compat.yml"
if [[ -z "$baseUrl" ]];
then
echo "Using existing $outFile"
else
curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile
fi
postProcess $outFile 'cloud/.config.yml' 'v1-compatibility'
postProcess $outFile 'influxdb/cloud/.config.yml' 'v1-compatibility'
outFile="v2/v1-compatibility/swaggerV1Compat.yml"
outFile="influxdb/v2/v1-compatibility/swaggerV1Compat.yml"
cp cloud/v1-compatibility/swaggerV1Compat.yml $outFile
postProcess $outFile 'v2/.config.yml' 'v1-compatibility'
postProcess $outFile 'influxdb/v2/.config.yml' 'v1-compatibility'
outFile="cloud-dedicated/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'cloud-dedicated/.config.yml' 'v1-compatibility'
outFile="influxdb3/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'influxdb3/cloud-dedicated/.config.yml' 'v1-compatibility'
outFile="cloud-serverless/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'cloud-serverless/.config.yml' 'v1-compatibility'
outFile="influxdb3/cloud-serverless/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'influxdb3/cloud-serverless/.config.yml' 'v1-compatibility'
outFile="clustered/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'clustered/.config.yml' 'v1-compatibility'
outFile="influxdb3/clustered/v1-compatibility/swaggerV1Compat.yml"
postProcess $outFile 'influxdb3/clustered/.config.yml' 'v1-compatibility'
}
UPDATE_OPTIONS="--fail"

View File

@ -1,5 +1,5 @@
plugins:
- '../openapi/plugins/docs-plugin.js'
- '../../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all

View File

@ -1,5 +1,5 @@
plugins:
- '../openapi/plugins/docs-plugin.js'
- '../../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all

View File

@ -1,5 +1,5 @@
plugins:
- '../openapi/plugins/docs-plugin.js'
- '../../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all

View File

@ -1,5 +1,5 @@
plugins:
- '../openapi/plugins/docs-plugin.js'
- '../../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all

View File

@ -1,5 +1,5 @@
plugins:
- '../openapi/plugins/docs-plugin.js'
- '../../openapi/plugins/docs-plugin.js'
extends:
- recommended
- docs/all