func (self *Doc) Validate() error {
	if self.Swagger == "" {
		return fmt.Errorf("Doc.swagger is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Swagger)
		if !val.Valid {
			return fmt.Errorf("Doc.swagger does not contain a valid String (%v)", val.Error)
		}
	}
	if self.Info == nil {
		return fmt.Errorf("Doc: Missing required field: info")
	}
	if self.BasePath == "" {
		return fmt.Errorf("Doc.basePath is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.BasePath)
		if !val.Valid {
			return fmt.Errorf("Doc.basePath does not contain a valid String (%v)", val.Error)
		}
	}
	if self.Paths == nil {
		return fmt.Errorf("Doc: Missing required field: paths")
	}
	if self.Definitions == nil {
		return fmt.Errorf("Doc: Missing required field: definitions")
	}
	return nil
}
Validate - checks for missing required fields, etc
package swagger
import (
	"encoding/json"
	"fmt"
	rdl "github.com/ardielle/ardielle-go/rdl"
)
var _ = rdl.Version
var _ = json.Marshal
var _ = fmt.Printf
type Contact struct {
	Name  string `json:"name,omitempty" rdl:"optional"`
	Url   string `json:"url,omitempty" rdl:"optional"`
	Email string `json:"email,omitempty" rdl:"optional"`
}
func NewContact(init ...*Contact) *Contact {
	var o *Contact
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Contact)
	}
	return o
}
type rawContact Contact
func (self *Contact) UnmarshalJSON(b []byte) error {
	var r rawContact
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Contact(r)
		*self = o
		err = self.Validate()
	}
	return err
}
func (self *Contact) Validate() error {
	return nil
}
type License struct {
	Name string `json:"name,omitempty" rdl:"optional"`
	Url  string `json:"url,omitempty" rdl:"optional"`
}
func NewLicense(init ...*License) *License {
	var o *License
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(License)
	}
	return o
}
type rawLicense License
func (self *License) UnmarshalJSON(b []byte) error {
	var r rawLicense
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := License(r)
		*self = o
		err = self.Validate()
	}
	return err
}
func (self *License) Validate() error {
	return nil
}
type Info struct {
	Title          string   `json:"title"`
	Version        string   `json:"version,omitempty" rdl:"optional"`
	Description    string   `json:"description,omitempty" rdl:"optional"`
	TermsOfService string   `json:"termsOfService,omitempty" rdl:"optional"`
	Contact        *Contact `json:"contact,omitempty" rdl:"optional"`
	License        *License `json:"license,omitempty" rdl:"optional"`
}
func NewInfo(init ...*Info) *Info {
	var o *Info
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Info)
	}
	return o
}
type rawInfo Info
func (self *Info) UnmarshalJSON(b []byte) error {
	var r rawInfo
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Info(r)
		*self = o
		err = self.Validate()
	}
	return err
}
func (self *Info) Validate() error {
	if self.Title == "" {
		return fmt.Errorf("Info.title is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Title)
		if !val.Valid {
			return fmt.Errorf("Info.title does not contain a valid String (%v)", val.Error)
		}
	}
	return nil
}
type Type map[string]interface{}
type Parameter struct {
	Name string `json:"name"`
	In               string `json:"in"`
	Schema           Type   `json:"schema,omitempty" rdl:"optional"`
	Type             string `json:"type,omitempty" rdl:"optional"`
	Format           string `json:"format,omitempty" rdl:"optional"`
	CollectionFormat string `json:"collectionFormat" rdl:"default=csv"`
	Required    bool   `json:"required,omitempty" rdl:"default=false"`
	Description string `json:"description,omitempty" rdl:"optional"`
}
func NewParameter(init ...*Parameter) *Parameter {
	var o *Parameter
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Parameter)
	}
	return o.Init()
}
func (self *Parameter) Init() *Parameter {
	if self.CollectionFormat == "" {
		self.CollectionFormat = "csv"
	}
	return self
}
type rawParameter Parameter
func (self *Parameter) UnmarshalJSON(b []byte) error {
	var r rawParameter
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Parameter(r)
		*self = *((&o).Init())
		err = self.Validate()
	}
	return err
}
func (self *Parameter) Validate() error {
	if self.Name == "" {
		return fmt.Errorf("Parameter.name is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Name)
		if !val.Valid {
			return fmt.Errorf("Parameter.name does not contain a valid String (%v)", val.Error)
		}
	}
	if self.In == "" {
		return fmt.Errorf("Parameter.in is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.In)
		if !val.Valid {
			return fmt.Errorf("Parameter.in does not contain a valid String (%v)", val.Error)
		}
	}
	if self.CollectionFormat == "" {
		return fmt.Errorf("Parameter.collectionFormat is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.CollectionFormat)
		if !val.Valid {
			return fmt.Errorf("Parameter.collectionFormat does not contain a valid String (%v)", val.Error)
		}
	}
	return nil
}
type Response struct {
	Description string `json:"description"`
	Schema      Type   `json:"schema"`
}
func NewResponse(init ...*Response) *Response {
	var o *Response
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Response)
	}
	return o.Init()
}
func (self *Response) Init() *Response {
	if self.Schema == nil {
		self.Schema = make(Type)
	}
	return self
}
type rawResponse Response
func (self *Response) UnmarshalJSON(b []byte) error {
	var r rawResponse
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Response(r)
		*self = *((&o).Init())
		err = self.Validate()
	}
	return err
}
func (self *Response) Validate() error {
	if self.Description == "" {
		return fmt.Errorf("Response.description is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Description)
		if !val.Valid {
			return fmt.Errorf("Response.description does not contain a valid String (%v)", val.Error)
		}
	}
	if self.Schema == nil {
		return fmt.Errorf("Response: Missing required field: schema")
	}
	return nil
}
type Operation struct {
	Tags        []string             `json:"tags,omitempty" rdl:"optional"`
	Summary     string               `json:"summary,omitempty" rdl:"optional"`
	OperationID string               `json:"operationId,omitempty" rdl:"optional"`
	Consumes    []string             `json:"consumes,omitempty" rdl:"optional"`
	Produces    []string             `json:"produces,omitempty" rdl:"optional"`
	Parameters  []*Parameter         `json:"parameters,omitempty" rdl:"optional"`
	Responses   map[string]*Response `json:"responses"`
}
func NewOperation(init ...*Operation) *Operation {
	var o *Operation
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Operation)
	}
	return o.Init()
}
func (self *Operation) Init() *Operation {
	if self.Responses == nil {
		self.Responses = make(map[string]*Response)
	}
	return self
}
type rawOperation Operation
func (self *Operation) UnmarshalJSON(b []byte) error {
	var r rawOperation
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Operation(r)
		*self = *((&o).Init())
		err = self.Validate()
	}
	return err
}
func (self *Operation) Validate() error {
	if self.Responses == nil {
		return fmt.Errorf("Operation: Missing required field: responses")
	}
	return nil
}
type PathItem struct {
	Ref     string     `json:"$ref,omitempty" rdl:"optional"`
	Get     *Operation `json:"get,omitempty" rdl:"optional"`
	Put     *Operation `json:"put,omitempty" rdl:"optional"`
	Post    *Operation `json:"post,omitempty" rdl:"optional"`
	Delete  *Operation `json:"delete,omitempty" rdl:"optional"`
	Options *Operation `json:"options,omitempty" rdl:"optional"`
	Head    *Operation `json:"head,omitempty" rdl:"optional"`
	Patch   *Operation `json:"patch,omitempty" rdl:"optional"`
}
func NewPathItem(init ...*PathItem) *PathItem {
	var o *PathItem
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(PathItem)
	}
	return o
}
type rawPathItem PathItem
func (self *PathItem) UnmarshalJSON(b []byte) error {
	var r rawPathItem
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := PathItem(r)
		*self = o
		err = self.Validate()
	}
	return err
}
func (self *PathItem) Validate() error {
	return nil
}
type SecurityDef struct {
	In   string `json:"in"`
	Name string `json:"name"`
	Type string `json:"type"`
}
func NewSecurityDef(init ...*SecurityDef) *SecurityDef {
	var o *SecurityDef
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(SecurityDef)
	}
	return o
}
type rawSecurityDef SecurityDef
func (self *SecurityDef) UnmarshalJSON(b []byte) error {
	var r rawSecurityDef
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := SecurityDef(r)
		*self = o
		err = self.Validate()
	}
	return err
}
func (self *SecurityDef) Validate() error {
	if self.In == "" {
		return fmt.Errorf("SecurityDef.in is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.In)
		if !val.Valid {
			return fmt.Errorf("SecurityDef.in does not contain a valid String (%v)", val.Error)
		}
	}
	if self.Name == "" {
		return fmt.Errorf("SecurityDef.name is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Name)
		if !val.Valid {
			return fmt.Errorf("SecurityDef.name does not contain a valid String (%v)", val.Error)
		}
	}
	if self.Type == "" {
		return fmt.Errorf("SecurityDef.type is missing but is a required field")
	} else {
		val := rdl.Validate(SwaggerSchema(), "String", self.Type)
		if !val.Valid {
			return fmt.Errorf("SecurityDef.type does not contain a valid String (%v)", val.Error)
		}
	}
	return nil
}
type Doc struct {
	Swagger             string                  `json:"swagger"`
	Info                *Info                   `json:"info"`
	BasePath            string                  `json:"basePath"`
	Host                string                  `json:"host,omitempty" rdl:"optional"`
	Schemes             []string                `json:"schemes,omitempty" rdl:"optional"`
	Paths               map[string]*PathItem    `json:"paths"`
	Definitions         map[string]Type         `json:"definitions"`
	SecurityDefinitions map[string]*SecurityDef `json:"securityDefinitions,omitempty" rdl:"optional"`
}
func NewDoc(init ...*Doc) *Doc {
	var o *Doc
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Doc)
	}
	return o.Init()
}
func (self *Doc) Init() *Doc {
	if self.Info == nil {
		self.Info = NewInfo()
	}
	if self.Paths == nil {
		self.Paths = make(map[string]*PathItem)
	}
	if self.Definitions == nil {
		self.Definitions = make(map[string]Type)
	}
	return self
}
type rawDoc Doc
func (self *Doc) UnmarshalJSON(b []byte) error {
	var r rawDoc
	err := json.Unmarshal(b, &r)
	if err == nil {
		o := Doc(r)
		*self = *((&o).Init())
		err = self.Validate()
	}
	return err
}