Make request objects required (#17909)

This commit is contained in:
AnPucel
2022-11-11 14:05:12 -08:00
committed by GitHub
parent fc9dfa2a7d
commit 3b59ff0bb9
4 changed files with 7 additions and 0 deletions

View File

@@ -146,6 +146,7 @@ type OASParameter struct {
type OASRequestBody struct {
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
Content OASContent `json:"content,omitempty"`
}
@@ -391,6 +392,7 @@ func documentPath(p *Path, specialPaths *logical.Paths, requestResponsePrefix st
requestName := constructRequestName(requestResponsePrefix, path)
doc.Components.Schemas[requestName] = s
op.RequestBody = &OASRequestBody{
Required: true,
Content: OASContent{
"application/json": &OASMediaTypeObject{
Schema: &OASSchema{Ref: fmt.Sprintf("#/components/schemas/%s", requestName)},