Skip to content

Commit

Permalink
openapi: Add default values to the thing_mount_path parameters (#18935)
Browse files Browse the repository at this point in the history
  • Loading branch information
averche authored Feb 1, 2023
1 parent aa5653a commit 6a9ca26
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/18935.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
openapi: Add default values to thing_mount_path parameters
```
3 changes: 3 additions & 0 deletions sdk/framework/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down

0 comments on commit 6a9ca26

Please sign in to comment.