go: vendor the oapi-codegen cmd
See the comment in tools.go, I cannot fully explain what's happening here. Somehow, Go 1.14 wants to use the vendored version of oapi-codegen but without this file, oapi-codegen isn't vendored so the generation fails. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
1a3cbb282a
commit
2241a8d9ed
75 changed files with 11211 additions and 0 deletions
69
vendor/github.com/getkin/kin-openapi/openapi3/request_body.go
generated
vendored
Normal file
69
vendor/github.com/getkin/kin-openapi/openapi3/request_body.go
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
package openapi3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/getkin/kin-openapi/jsoninfo"
|
||||
)
|
||||
|
||||
// RequestBody is specified by OpenAPI/Swagger 3.0 standard.
|
||||
type RequestBody struct {
|
||||
ExtensionProps
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
|
||||
Content Content `json:"content,omitempty" yaml:"content,omitempty"`
|
||||
}
|
||||
|
||||
func NewRequestBody() *RequestBody {
|
||||
return &RequestBody{}
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) WithDescription(value string) *RequestBody {
|
||||
requestBody.Description = value
|
||||
return requestBody
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) WithRequired(value bool) *RequestBody {
|
||||
requestBody.Required = value
|
||||
return requestBody
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) WithContent(content Content) *RequestBody {
|
||||
requestBody.Content = content
|
||||
return requestBody
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) WithJSONSchemaRef(value *SchemaRef) *RequestBody {
|
||||
requestBody.Content = NewContentWithJSONSchemaRef(value)
|
||||
return requestBody
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) WithJSONSchema(value *Schema) *RequestBody {
|
||||
requestBody.Content = NewContentWithJSONSchema(value)
|
||||
return requestBody
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) GetMediaType(mediaType string) *MediaType {
|
||||
m := requestBody.Content
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return m[mediaType]
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) MarshalJSON() ([]byte, error) {
|
||||
return jsoninfo.MarshalStrictStruct(requestBody)
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) UnmarshalJSON(data []byte) error {
|
||||
return jsoninfo.UnmarshalStrictStruct(data, requestBody)
|
||||
}
|
||||
|
||||
func (requestBody *RequestBody) Validate(c context.Context) error {
|
||||
if v := requestBody.Content; v != nil {
|
||||
if err := v.Validate(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue