Make request objects required (#17909)

This commit is contained in:
AnPucel 2022-11-11 14:05:12 -08:00 committed by GitHub
parent 4c4798417f
commit b554a453e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 0 deletions

3
changelog/17909.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
openapi: Mark request body objects as required
```

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)},

View File

@ -38,6 +38,7 @@
"summary": "Synopsis",
"tags": ["secrets"],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {

View File

@ -63,6 +63,7 @@
"summary": "Update Summary",
"description": "Update Description",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {