func (a *ArraySchema) UnmarshalYAML(um func(interface{}) error) error {
	var y struct {
		SchemaFields `yaml:",inline"`
		ArrayFields  `yaml:",inline"`
		Items        yaml.MapSlice
	}
	if err := um(&y); err != nil {
		return err
	}
	a.SchemaFields = y.SchemaFields
	a.ArrayFields = y.ArrayFields
	var err error
	a.Items, err = unmarshalSchema(y.Items)
	return err
}
UnmarshalYAML unmarshals an ArraySchema from YAML or JSON.
package v2
import (
	"errors"
	"net/url"
	"github.com/go-yaml/yaml"
)
type Document struct {
	Version string  
	Info    *Info   
	Host     *string
	BasePath *string `yaml:"basePath"`
	Schemes  []string
	Consumes []string
	Produces []string
	Paths map[string]PathItem  
	Definitions *SchemaMap
	Parameters  *ParameterMap
	Responses   *map[string]Response
	SecurityDefinitions *SecuritySchemeMap `yaml:"securityDefinitions"`
	Security            []map[string][]string
	Tags          []Tag
	Documentation *ExternalDocumentation
}
type Info struct {
	Title       string  
	Description *string
	TermsOfService *string
	Contact        *Contact
	License        *License
	Version string  
}
type Contact struct {
	Name  *string
	URL   *url.URL
	Email *string
}
type License struct {
	Name string  
	URL  *url.URL
}
type PathItem struct {
	Reference *string
	Get     *Operation
	Put     *Operation
	Post    *Operation
	Delete  *Operation
	Options *Operation
	Head    *Operation
	Patch   *Operation
	Parameters Parameters
}
type Operation struct {
	Tags []string
	Summary       *string
	Description   *string
	Documentation *ExternalDocumentation
	OperationID *string
	Consumes []string
	Produces []string
	Parameters Parameters
	Responses  *Responses  
	Schemes []string
	Deprecated bool
	Security []map[string][]string
}
type ExternalDocumentation struct {
	Description *string
	URL         *url.URL  
}
type Parameters []Parameter
func (p *Parameters) UnmarshalYAML(um func(interface{}) error) error {
	var ys []map[string]interface{}
	if err := um(&ys); err != nil {
		return err
	}
	*p = make(Parameters, len(ys))
	var err error
	for i, y := range ys {
		if (*p)[i], err = unmarshalParameter(y); err != nil {
			return err
		}
	}
	return nil
}
type ParameterMap map[string]Parameter
func (p *ParameterMap) UnmarshalYAML(um func(interface{}) error) error {
	var ys map[string]map[string]interface{}
	if err := um(&ys); err != nil {
		return err
	}
	*p = make(map[string]Parameter, len(ys))
	var err error
	for k, y := range ys {
		if (*p)[k], err = unmarshalParameter(y); err != nil {
			return err
		}
	}
	return nil
}
func unmarshalParameter(y map[string]interface{}) (Parameter, error) {
	b, err := yaml.Marshal(&y)
	if err != nil {
		return nil, err
	}
	if _, ok := y["$ref"]; ok {
		var v ReferenceParamter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	} else if y["in"] == "body" {
		var v BodyParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	}
	switch y["type"] {
	case "string":
		var v StringParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	case "number":
		var v NumberParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	case "integer":
		var v IntegerParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	case "boolean":
		var v BooleanParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	case "array":
		var p ParameterFields
		if err = yaml.Unmarshal(b, &p); err != nil {
			return nil, err
		}
		v := ArrayParameter{ParameterFields: p}
		err = yaml.Unmarshal(b, &v)
		return &v, err
	case "file":
		var v FileParameter
		err = yaml.Unmarshal(b, &v)
		return &v, err
	default:
		return nil, errors.New("bad parameter type")
	}
}
type Parameter interface {
	GetName() string  
	GetIn() string    
	GetDescription() *string
	IsRequired() bool
}
type ReferenceParamter struct {
	Reference string `yaml:"$ref"`
}
func (ReferenceParamter) GetName() string { return "" }
func (ReferenceParamter) GetIn() string { return "" }
func (ReferenceParamter) GetDescription() *string { return nil }
func (ReferenceParamter) IsRequired() bool { return false }
type ParameterFields struct {
	Name        string  
	In          string  
	Description *string
	Required    bool
}
func (pf *ParameterFields) GetName() string { return pf.Name }
func (pf *ParameterFields) GetIn() string { return pf.In }
func (pf *ParameterFields) GetDescription() *string { return pf.Description }
func (pf *ParameterFields) IsRequired() bool { return pf.Required }
type BodyParameter struct {
	ParameterFields `yaml:",inline"`
	Schema          Schema  
}
func (b *BodyParameter) UnmarshalYAML(um func(interface{}) error) error {
	var y struct {
		ParameterFields `yaml:",inline"`
		Schema          yaml.MapSlice
	}
	if err := um(&y); err != nil {
		return err
	}
	b.ParameterFields = y.ParameterFields
	var err error
	b.Schema, err = unmarshalSchema(y.Schema)
	return err
}
type StringParameter struct {
	ParameterFields `yaml:",inline"`
	StringItem      `yaml:",inline"`
	AllowEmptyValue bool
}
type NumberParameter struct {
	ParameterFields `yaml:",inline"`
	NumberItem      `yaml:",inline"`
	AllowEmptyValue bool
}
type IntegerParameter struct {
	ParameterFields `yaml:",inline"`
	IntegerItem     `yaml:",inline"`
	AllowEmptyValue bool
}
type BooleanParameter struct {
	ParameterFields `yaml:",inline"`
	BooleanItem     `yaml:",inline"`
	AllowEmptyValue bool
}
type ArrayParameter struct {
	ParameterFields `yaml:",inline"`
	ArrayItem       `yaml:",inline"`
	AllowEmptyValue bool
}
type FileParameter struct {
	ParameterFields `yaml:",inline"`
	AllowEmptyValue bool
}
type Items interface {
	Type() string  
}
const (
	stringItem  = "string"
	numberItem  = "number"
	integerItem = "integer"
	booleanItem = "boolean"
	arrayItem   = "array"
)
func unmarshalItems(y map[string]interface{}) (Items, error) {
	b, err := yaml.Marshal(&y)
	if err != nil {
		return nil, err
	}
	switch y["type"] {
	case stringItem:
		var v StringItem
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case numberItem:
		var v NumberItem
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case integerItem:
		var v IntegerItem
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case booleanItem:
		var v BooleanItem
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case arrayItem:
		var v ArrayItem
		err := yaml.Unmarshal(b, &v)
		return &v, err
	default:
		return nil, errors.New("bad schema type: " + y["type"].(string))
	}
}
type StringItem struct {
	Format *string
	Default *string
	Enum    *[]string
	MaxLength *int64
	MinLength *int64
	Pattern   *string
}
func (StringItem) Type() string { return stringItem }
type NumberItem struct {
	Format *string
	Default *float64
	Enum    *[]float64
	Maximum          *float64
	ExclusiveMaximum bool
	Minium           *float64
	ExclusiveMinimum bool
	MultipleOf       *float64
}
func (NumberItem) Type() string { return numberItem }
type IntegerItem struct {
	Format *string
	Default *int64
	Enum    *[]int64
	Maximum          *int64
	ExclusiveMaximum bool
	Minium           *int64
	ExclusiveMinimum bool
	MultipleOf       *int64
}
func (IntegerItem) Type() string { return integerItem }
type BooleanItem struct {
	Default *bool
	Enum    *[]bool
}
func (BooleanItem) Type() string { return booleanItem }
type ArrayFields struct {
	CollectionFormat *string `yaml:"collectionFormat"`
	Default interface{}
	Enum    *[]interface{}
	MaxItems    *uint64
	MinItems    *uint64
	UniqueItems bool
}
type ArrayItem struct {
	ArrayFields `yaml:",inline"`
	Items       Items  
}
func (ArrayItem) Type() string { return arrayItem }
func (a *ArrayItem) UnmarshalYAML(um func(interface{}) error) error {
	var y struct {
		ArrayFields `yaml:",inline"`
		Items map[string]interface{}
	}
	if err := um(&y); err != nil {
		return err
	}
	a.ArrayFields = y.ArrayFields
	var err error
	a.Items, err = unmarshalItems(y.Items)
	return err
}
type Responses struct {
	Default *Response
	Codes   map[int]Response
}
func (r *Responses) UnmarshalYAML(um func(interface{}) error) error {
	var y map[interface{}]Response
	if err := um(&y); err != nil {
		return err
	}
	for k, v := range y {
		switch t := k.(type) {
		case int:
			if r.Codes == nil {
				r.Codes = make(map[int]Response)
			}
			r.Codes[t] = v
		case string:
			nv := v
			r.Default = &nv
		}
	}
	return nil
}
type Response struct {
	Reference   string `yaml:"$ref"`  
	Description string  
	Schema      Schema
	Headers     map[string]Header
	Examples    map[string]interface{}  
}
func (r *Response) UnmarshalYAML(um func(interface{}) error) error {
	var y struct {
		Reference   string `yaml:"$ref"`
		Description string
		Headers     map[string]Header
		Examples    map[string]interface{}
		Schema yaml.MapSlice
	}
	if err := um(&y); err != nil {
		return err
	}
	r.Reference = y.Reference
	r.Description = y.Description
	r.Headers = y.Headers
	r.Examples = y.Examples
	if y.Schema == nil {  
		return nil
	}
	var err error
	r.Schema, err = unmarshalSchema(y.Schema)
	return err
}
type Header interface {
	Description() *string
	Items
}
type HeaderFields struct {
	Description *string
}
func (h *HeaderFields) GetDescription() *string { return h.Description }
type StringHeader struct {
	HeaderFields `yaml:",inline"`
	StringItem   `yaml:",inline"`
}
type NumberHeader struct {
	HeaderFields `yaml:",inline"`
	NumberItem   `yaml:",inline"`
}
type IntegerHeader struct {
	HeaderFields `yaml:",inline"`
	IntegerItem  `yaml:",inline"`
}
type BooleanHeader struct {
	HeaderFields `yaml:",inline"`
	BooleanItem  `yaml:",inline"`
}
type ArrayHeader struct {
	HeaderFields `yaml:",inline"`
	ArrayItem    `yaml:",inline"`
}
type Tag struct {
	Name          string  
	Description   *string
	Documentation *ExternalDocumentation
}
type Schema interface {
	GetTitle() *string
	GetDescription() *string
	GetDocumentation() *ExternalDocumentation
	GetExample() interface{}
}
type SchemaMap []struct {
	Name   string
	Schema Schema
}
func (s *SchemaMap) UnmarshalYAML(um func(interface{}) error) error {
	var ys yaml.MapSlice
	if err := um(&ys); err != nil {
		return err
	}
	*s = make(SchemaMap, len(ys))
	for i, y := range ys {
		v, err := unmarshalSchema(y.Value.(yaml.MapSlice))
		if err != nil {
			return err
		}
		(*s)[i] = struct {
			Name   string
			Schema Schema
		}{y.Key.(string), v}
	}
	return nil
}
func unmarshalSchema(yms interface{}) (Schema, error) {
	b, err := yaml.Marshal(yms)
	if err != nil {
		return nil, err
	}
	var y map[string]interface{}
	if err = yaml.Unmarshal(b, &y); err != nil {
		return nil, err
	}
	if _, ok := y["$ref"]; ok {
		var v ReferenceSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	} else if _, ok := y["allOf"]; ok {
		var v AllOfSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	}
	switch y["type"] {
	case "object", nil:
		var v ObjectSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "null":
		var v NullSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "string":
		var v StringSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "number":
		var v NumberSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "integer":
		var v IntegerSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "boolean":
		var v BooleanSchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	case "array":
		var v ArraySchema
		err := yaml.Unmarshal(b, &v)
		return &v, err
	default:
		return nil, errors.New("bad schema type: " + y["type"].(string))
	}
}
type ReferenceSchema struct {
	Reference string `yaml:"$ref"`  
}
func (ReferenceSchema) GetTitle() *string { return nil }
func (ReferenceSchema) GetDescription() *string { return nil }
func (ReferenceSchema) GetDocumentation() *ExternalDocumentation { return nil }
func (ReferenceSchema) GetExample() interface{} { return nil }
type SchemaFields struct {
	Title         *string
	Description   *string
	Documentation *ExternalDocumentation
	Example       interface{}
	ReadOnly bool         
	XML      interface{}  
}
func (s *SchemaFields) GetTitle() *string { return s.Title }
func (s *SchemaFields) GetDescription() *string { return s.Description }
func (s *SchemaFields) GetDocumentation() *ExternalDocumentation { return s.Documentation }
func (s *SchemaFields) GetExample() interface{} { return s.Example }
type AllOfSchema struct {
	SchemaFields `yaml:",inline"`
	AllOf        []Schema `yaml:"allOf"`
}
func (a *AllOfSchema) UnmarshalYAML(um func(interface{}) error) error {
	var ay struct {
		SchemaFields `yaml:",inline"`
		AllOf        []yaml.MapSlice `yaml:"allOf"`
	}
	if err := um(&ay); err != nil {
		return err
	}
	a.AllOf = make([]Schema, len(ay.AllOf))
	var err error
	for i, y := range ay.AllOf {
		if a.AllOf[i], err = unmarshalSchema(y); err != nil {
			return err
		}
	}
	return nil
}
type ObjectSchema struct {
	SchemaFields  `yaml:",inline"`
	Descriminator *string
	Properties *SchemaMap
	Required   *[]string
	AdditionalProperties    Schema `yaml:"additionalProperties"`  
	AnyAdditionalProperties bool    
	MinProperties *uint64
	MaxProperties *uint64
}
func (o *ObjectSchema) UnmarshalYAML(um func(interface{}) error) error {
	var oy struct {
		SchemaFields  `yaml:",inline"`
		Descriminator *string
		Properties           *SchemaMap
		Required             *[]string
		AdditionalProperties interface{} `yaml:"additionalProperties"`  
		MinProperties *uint64
		MaxProperties *uint64
	}
	if err := um(&oy); err != nil {
		return err
	}
	o.SchemaFields = oy.SchemaFields
	o.Descriminator = oy.Descriminator
	o.Properties = oy.Properties
	o.Required = oy.Required
	o.MinProperties = oy.MinProperties
	o.MaxProperties = oy.MaxProperties
	switch t := oy.AdditionalProperties.(type) {
	case bool:
		o.AnyAdditionalProperties = t
		return nil
	case nil:
		return nil
	default:  
		var err error
		o.AdditionalProperties, err = unmarshalSchema(t)
		return err
	}
}
type NullSchema struct {
	SchemaFields `yaml:",inline"`
}
type StringSchema struct {
	SchemaFields `yaml:",inline"`
	StringItem   `yaml:",inline"`
}
type NumberSchema struct {
	SchemaFields `yaml:",inline"`
	NumberItem   `yaml:",inline"`
}
type IntegerSchema struct {
	SchemaFields `yaml:",inline"`
	IntegerItem  `yaml:",inline"`
}
type BooleanSchema struct {
	SchemaFields `yaml:",inline"`
	BooleanItem  `yaml:",inline"`
}
type ArraySchema struct {
	SchemaFields `yaml:",inline"`
	ArrayFields  `yaml:",inline"`
	Items        Schema  
}