Change gen_openapi.sh to generate schema with generic mount paths (#18934)

This commit is contained in:
Anton Averchenkov
2023-01-31 18:37:19 -05:00
committed by GitHub
parent fd9cadb192
commit aa5653a88c
2 changed files with 12 additions and 5 deletions

3
changelog/18934.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:improvement
openapi: Change gen_openapi.sh to generate schema with generic mount paths
```

View File

@@ -36,7 +36,7 @@ while read -r line; do
codeLinesStarted=true
elif [[ $line == *"databasePlugins:"* ]] ; then
break
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* ]] ; then
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* || $line == *"consts.Removed"* ]] ; then
auth_plugin_previous=""
elif [ $codeLinesStarted = true ] && [[ $line =~ ^\s*\"(.*)\"\:.*$ ]] ; then
auth_plugin_current=${BASH_REMATCH[1]}
@@ -63,7 +63,7 @@ while read -r line; do
codeLinesStarted=true
elif [[ $line == *"addExternalPlugins("* ]] ; then
break
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* ]] ; then
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* || $line == *"consts.Removed"* ]] ; then
secrets_plugin_previous=""
elif [ $codeLinesStarted = true ] && [[ $line =~ ^\s*\"(.*)\"\:.*$ ]] ; then
secrets_plugin_current=${BASH_REMATCH[1]}
@@ -94,7 +94,7 @@ if [ -f $entRegFile ] && [[ -n "${VAULT_LICENSE}" ]]; then
codeLinesStarted=true
elif [[ $line == *"addExtPluginsEntImpl("* ]] ; then
break
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* ]] ; then
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* || $line == *"consts.Removed"* ]] ; then
secrets_plugin_previous=""
elif [ $codeLinesStarted = true ] && [[ $line =~ ^\s*\"(.*)\"\:.*$ ]] ; then
ent_plugin_current=${BASH_REMATCH[1]}
@@ -116,9 +116,13 @@ fi
# Output OpenAPI, optionally formatted
if [ "$1" == "-p" ]; then
curl -H "X-Vault-Token: root" "http://127.0.0.1:8200/v1/sys/internal/specs/openapi" | jq > openapi.json
curl --header 'X-Vault-Token: root' \
--data '{"generic_mount_paths": true}' \
'http://127.0.0.1:8200/v1/sys/internal/specs/openapi' | jq > openapi.json
else
curl -H "X-Vault-Token: root" "http://127.0.0.1:8200/v1/sys/internal/specs/openapi" > openapi.json
curl --header 'X-Vault-Token: root' \
--data '{"generic_mount_paths": true}' \
'http://127.0.0.1:8200/v1/sys/internal/specs/openapi' > openapi.json
fi
kill $VAULT_PID