Make request objects required (#17909)
This commit is contained in:
parent
4c4798417f
commit
b554a453e2
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
openapi: Mark request body objects as required
|
||||
```
|
|
@ -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)},
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
"summary": "Synopsis",
|
||||
"tags": ["secrets"],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
"summary": "Update Summary",
|
||||
"description": "Update Description",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
|
|
Loading…
Reference in New Issue