go.mod: Update oapi-codegen and kin-openapi
This commit is contained in:
parent
add17bba45
commit
a83cf95d5b
156 changed files with 29663 additions and 2248 deletions
44
vendor/github.com/getkin/kin-openapi/openapi3/content.go
generated
vendored
44
vendor/github.com/getkin/kin-openapi/openapi3/content.go
generated
vendored
|
|
@ -12,6 +12,32 @@ func NewContent() Content {
|
|||
return make(map[string]*MediaType, 4)
|
||||
}
|
||||
|
||||
func NewContentWithSchema(schema *Schema, consumes []string) Content {
|
||||
if len(consumes) == 0 {
|
||||
return Content{
|
||||
"*/*": NewMediaType().WithSchema(schema),
|
||||
}
|
||||
}
|
||||
content := make(map[string]*MediaType, len(consumes))
|
||||
for _, mediaType := range consumes {
|
||||
content[mediaType] = NewMediaType().WithSchema(schema)
|
||||
}
|
||||
return content
|
||||
}
|
||||
|
||||
func NewContentWithSchemaRef(schema *SchemaRef, consumes []string) Content {
|
||||
if len(consumes) == 0 {
|
||||
return Content{
|
||||
"*/*": NewMediaType().WithSchemaRef(schema),
|
||||
}
|
||||
}
|
||||
content := make(map[string]*MediaType, len(consumes))
|
||||
for _, mediaType := range consumes {
|
||||
content[mediaType] = NewMediaType().WithSchemaRef(schema)
|
||||
}
|
||||
return content
|
||||
}
|
||||
|
||||
func NewContentWithJSONSchema(schema *Schema) Content {
|
||||
return Content{
|
||||
"application/json": NewMediaType().WithSchema(schema),
|
||||
|
|
@ -23,6 +49,18 @@ func NewContentWithJSONSchemaRef(schema *SchemaRef) Content {
|
|||
}
|
||||
}
|
||||
|
||||
func NewContentWithFormDataSchema(schema *Schema) Content {
|
||||
return Content{
|
||||
"multipart/form-data": NewMediaType().WithSchema(schema),
|
||||
}
|
||||
}
|
||||
|
||||
func NewContentWithFormDataSchemaRef(schema *SchemaRef) Content {
|
||||
return Content{
|
||||
"multipart/form-data": NewMediaType().WithSchemaRef(schema),
|
||||
}
|
||||
}
|
||||
|
||||
func (content Content) Get(mime string) *MediaType {
|
||||
// If the mime is empty then short-circuit to the wildcard.
|
||||
// We do this here so that we catch only the specific case of
|
||||
|
|
@ -66,10 +104,10 @@ func (content Content) Get(mime string) *MediaType {
|
|||
return content["*/*"]
|
||||
}
|
||||
|
||||
func (content Content) Validate(c context.Context) error {
|
||||
for _, v := range content {
|
||||
func (value Content) Validate(ctx context.Context) error {
|
||||
for _, v := range value {
|
||||
// Validate MediaType
|
||||
if err := v.Validate(c); err != nil {
|
||||
if err := v.Validate(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue