Output default as part of OpenAPI (#6222)
This commit is contained in:
parent
524b65cb9b
commit
6485850886
|
@ -155,6 +155,7 @@ type OASSchema struct {
|
|||
Format string `json:"format,omitempty"`
|
||||
Pattern string `json:"pattern,omitempty"`
|
||||
Enum []interface{} `json:"enum,omitempty"`
|
||||
Default interface{} `json:"default,omitempty"`
|
||||
Example interface{} `json:"example,omitempty"`
|
||||
Deprecated bool `json:"deprecated,omitempty"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
|
@ -263,6 +264,7 @@ func documentPath(p *Path, specialPaths *logical.Paths, backendType logical.Back
|
|||
Type: t.baseType,
|
||||
Pattern: t.pattern,
|
||||
Enum: field.AllowedValues,
|
||||
Default: field.Default,
|
||||
DisplayName: field.DisplayName,
|
||||
DisplayValue: field.DisplayValue,
|
||||
DisplaySensitive: field.DisplaySensitive,
|
||||
|
@ -321,6 +323,7 @@ func documentPath(p *Path, specialPaths *logical.Paths, backendType logical.Back
|
|||
Format: openapiField.format,
|
||||
Pattern: openapiField.pattern,
|
||||
Enum: field.AllowedValues,
|
||||
Default: field.Default,
|
||||
Required: field.Required,
|
||||
Deprecated: field.Deprecated,
|
||||
DisplayName: field.DisplayName,
|
||||
|
|
|
@ -326,6 +326,7 @@ func TestOpenAPI_Paths(t *testing.T) {
|
|||
},
|
||||
"name": {
|
||||
Type: TypeNameString,
|
||||
Default: "Larry",
|
||||
Description: "the name",
|
||||
},
|
||||
"age": {
|
||||
|
|
1
logical/framework/testdata/operations.json
vendored
1
logical/framework/testdata/operations.json
vendored
|
@ -85,6 +85,7 @@
|
|||
"name": {
|
||||
"type": "string",
|
||||
"description": "the name",
|
||||
"default": "Larry",
|
||||
"pattern": "\\w([\\w-.]*\\w)?"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue