debian-forge-composer/vendor/github.com/getkin/kin-openapi/openapi3/header.go
Ondřej Budai 2241a8d9ed 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>
2021-02-01 15:32:58 +01:00

33 lines
1.1 KiB
Go

package openapi3
import (
"context"
"github.com/getkin/kin-openapi/jsoninfo"
)
type Header struct {
ExtensionProps
// Optional description. Should use CommonMark syntax.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
Example interface{} `json:"example,omitempty" yaml:"example,omitempty"`
Examples map[string]*ExampleRef `json:"examples,omitempty" yaml:"examples,omitempty"`
Content Content `json:"content,omitempty" yaml:"content,omitempty"`
}
func (value *Header) UnmarshalJSON(data []byte) error {
return jsoninfo.UnmarshalStrictStruct(data, value)
}
func (value *Header) Validate(c context.Context) error {
if v := value.Schema; v != nil {
if err := v.Validate(c); err != nil {
return err
}
}
return nil
}