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