From 7b356f036615fe2997a6fa3b1678154b112d527f Mon Sep 17 00:00:00 2001 From: Anton Averchenkov <84287187+averche@users.noreply.github.com> Date: Tue, 31 Jan 2023 19:37:16 -0500 Subject: [PATCH] openapi: Add default values to the thing_mount_path parameters (#18935) --- changelog/18935.txt | 3 +++ sdk/framework/openapi.go | 3 +++ vault/logical_system.go | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog/18935.txt diff --git a/changelog/18935.txt b/changelog/18935.txt new file mode 100644 index 000000000..c55cda115 --- /dev/null +++ b/changelog/18935.txt @@ -0,0 +1,3 @@ +```release-note:improvement +openapi: Add default values to thing_mount_path parameters +``` diff --git a/sdk/framework/openapi.go b/sdk/framework/openapi.go index 692062edc..579066728 100644 --- a/sdk/framework/openapi.go +++ b/sdk/framework/openapi.go @@ -910,6 +910,9 @@ func (d *OASDocument) CreateOperationIDs(context string) { continue } + // Discard "_mount_path" from any {thing_mount_path} parameters + path = strings.Replace(path, "_mount_path", "", 1) + // Space-split on non-words, title case everything, recombine opID := nonWordRe.ReplaceAllString(strings.ToLower(path), " ") opID = strings.Title(opID) diff --git a/vault/logical_system.go b/vault/logical_system.go index 057a1f1b5..47c75676e 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -4606,9 +4606,10 @@ func (b *SystemBackend) pathInternalOpenAPI(ctx context.Context, req *logical.Re Description: "Path that the backend was mounted at", In: "path", Schema: &framework.OASSchema{ - Type: "string", + Type: "string", + Default: strings.TrimRight(mount, "/"), }, - Required: true, + Required: false, }) }