mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Distinguish LIST-only paths in OpenAPI (#13643)
* Distinguish LIST-only paths in OpenAPI * add changelog * Put enum field inside schema
This commit is contained in:
@@ -320,7 +320,7 @@ func TestOpenAPI_Paths(t *testing.T) {
|
||||
testPath(t, p, sp, expected("legacy"))
|
||||
})
|
||||
|
||||
t.Run("Operations", func(t *testing.T) {
|
||||
t.Run("Operations - All Operations", func(t *testing.T) {
|
||||
p := &Path{
|
||||
Pattern: "foo/" + GenericNameRegex("id"),
|
||||
Fields: map[string]*FieldSchema{
|
||||
@@ -395,6 +395,65 @@ func TestOpenAPI_Paths(t *testing.T) {
|
||||
testPath(t, p, sp, expected("operations"))
|
||||
})
|
||||
|
||||
t.Run("Operations - List Only", func(t *testing.T) {
|
||||
p := &Path{
|
||||
Pattern: "foo/" + GenericNameRegex("id"),
|
||||
Fields: map[string]*FieldSchema{
|
||||
"id": {
|
||||
Type: TypeString,
|
||||
Description: "id path parameter",
|
||||
},
|
||||
"flavors": {
|
||||
Type: TypeCommaStringSlice,
|
||||
Description: "the flavors",
|
||||
},
|
||||
"name": {
|
||||
Type: TypeNameString,
|
||||
Default: "Larry",
|
||||
Description: "the name",
|
||||
},
|
||||
"age": {
|
||||
Type: TypeInt,
|
||||
Description: "the age",
|
||||
AllowedValues: []interface{}{1, 2, 3},
|
||||
Required: true,
|
||||
DisplayAttrs: &DisplayAttributes{
|
||||
Name: "Age",
|
||||
Sensitive: true,
|
||||
Group: "Some Group",
|
||||
Value: 7,
|
||||
},
|
||||
},
|
||||
"x-abc-token": {
|
||||
Type: TypeHeader,
|
||||
Description: "a header value",
|
||||
AllowedValues: []interface{}{"a", "b", "c"},
|
||||
},
|
||||
"format": {
|
||||
Type: TypeString,
|
||||
Description: "a query param",
|
||||
Query: true,
|
||||
},
|
||||
},
|
||||
HelpSynopsis: "Synopsis",
|
||||
HelpDescription: "Description",
|
||||
Operations: map[logical.Operation]OperationHandler{
|
||||
logical.ListOperation: &PathOperation{
|
||||
Summary: "List Summary",
|
||||
Description: "List Description",
|
||||
},
|
||||
},
|
||||
DisplayAttrs: &DisplayAttributes{
|
||||
Navigation: true,
|
||||
},
|
||||
}
|
||||
|
||||
sp := &logical.Paths{
|
||||
Root: []string{"foo*"},
|
||||
}
|
||||
testPath(t, p, sp, expected("operations_list"))
|
||||
})
|
||||
|
||||
t.Run("Responses", func(t *testing.T) {
|
||||
p := &Path{
|
||||
Pattern: "foo",
|
||||
|
||||
Reference in New Issue
Block a user