openapi: Add default values to the thing_mount_path parameters (#18935)

This commit is contained in:
Anton Averchenkov 2023-01-31 19:37:16 -05:00 committed by GitHub
parent 6487fe6ae8
commit 7b356f0366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

3
changelog/18935.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
openapi: Add default values to thing_mount_path parameters
```

View File

@ -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)

View File

@ -4607,8 +4607,9 @@ func (b *SystemBackend) pathInternalOpenAPI(ctx context.Context, req *logical.Re
In: "path",
Schema: &framework.OASSchema{
Type: "string",
Default: strings.TrimRight(mount, "/"),
},
Required: true,
Required: false,
})
}