func (i *Info) WithContact(val Contact) *Info {
	i.Contact = &val
	return i
}
WithContact sets Contact value.
package openapi3
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"reflect"
	"regexp"
)
type Spec struct {
	Openapi       string                 `json:"openapi"`
	Info          Info                   `json:"info"`  
	ExternalDocs  *ExternalDocumentation `json:"externalDocs,omitempty"`
	Servers       []Server               `json:"servers,omitempty"`
	Security      []map[string][]string  `json:"security,omitempty"`
	Tags          []Tag                  `json:"tags,omitempty"`
	Paths         Paths                  `json:"paths"`  
	Components    *Components            `json:"components,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"`  
}
func (s *Spec) WithOpenapi(val string) *Spec {
	s.Openapi = val
	return s
}
func (s *Spec) WithInfo(val Info) *Spec {
	s.Info = val
	return s
}
func (s *Spec) WithExternalDocs(val ExternalDocumentation) *Spec {
	s.ExternalDocs = &val
	return s
}
func (s *Spec) ExternalDocsEns() *ExternalDocumentation {
	if s.ExternalDocs == nil {
		s.ExternalDocs = new(ExternalDocumentation)
	}
	return s.ExternalDocs
}
func (s *Spec) WithServers(val ...Server) *Spec {
	s.Servers = val
	return s
}
func (s *Spec) WithSecurity(val ...map[string][]string) *Spec {
	s.Security = val
	return s
}
func (s *Spec) WithTags(val ...Tag) *Spec {
	s.Tags = val
	return s
}
func (s *Spec) WithPaths(val Paths) *Spec {
	s.Paths = val
	return s
}
func (s *Spec) WithComponents(val Components) *Spec {
	s.Components = &val
	return s
}
func (s *Spec) ComponentsEns() *Components {
	if s.Components == nil {
		s.Components = new(Components)
	}
	return s.Components
}
func (s *Spec) WithMapOfAnything(val map[string]interface{}) *Spec {
	s.MapOfAnything = val
	return s
}
func (s *Spec) WithMapOfAnythingItem(key string, val interface{}) *Spec {
	if s.MapOfAnything == nil {
		s.MapOfAnything = make(map[string]interface{}, 1)
	}
	s.MapOfAnything[key] = val
	return s
}
type marshalSpec Spec
var knownKeysSpec = []string{
	"openapi",
	"info",
	"externalDocs",
	"servers",
	"security",
	"tags",
	"paths",
	"components",
}
var requireKeysSpec = []string{
	"openapi",
	"info",
	"paths",
}
func (s *Spec) UnmarshalJSON(data []byte) error {
	var err error
	ms := marshalSpec(*s)
	err = json.Unmarshal(data, &ms)
	if err != nil {
		return err
	}
	var rawMap map[string]json.RawMessage
	err = json.Unmarshal(data, &rawMap)
	if err != nil {
		rawMap = nil
	}
	for _, key := range requireKeysSpec {
		if _, found := rawMap[key]; !found {
			return errors.New("required key missing: " + key)
		}
	}
	for _, key := range knownKeysSpec {
		delete(rawMap, key)
	}
	for key, rawValue := range rawMap {
		matched := false
		if regexX.MatchString(key) {
			matched = true
			if ms.MapOfAnything == nil {
				ms.MapOfAnything = make(map[string]interface{}, 1)
			}
			var val interface{}
			err = json.Unmarshal(rawValue, &val)
			if err != nil {
				return err
			}
			ms.MapOfAnything[key] = val
		}
		if matched {
			delete(rawMap, key)
		}
	}
	if len(rawMap) != 0 {
		offendingKeys := make([]string, 0, len(rawMap))
		for key := range rawMap {
			offendingKeys = append(offendingKeys, key)
		}
		return fmt.Errorf("additional properties not allowed in Spec: %v", offendingKeys)
	}
	*s = Spec(ms)
	return nil
}
func (s Spec) MarshalJSON() ([]byte, error) {
	return marshalUnion(marshalSpec(s), s.MapOfAnything)
}
type Info struct {
	Title          string                 `json:"title"`  
	Description    *string                `json:"description,omitempty"`
	TermsOfService *string                `json:"termsOfService,omitempty"`  
	Contact        *Contact               `json:"contact,omitempty"`
	License        *License               `json:"license,omitempty"`
	Version        string                 `json:"version"`  
	MapOfAnything  map[string]interface{} `json:"-"`        
}
func (i *Info) WithTitle(val string) *Info {
	i.Title = val
	return i
}
func (i *Info) WithDescription(val string) *Info {
	i.Description = &val
	return i
}
func (i *Info) WithTermsOfService(val string) *Info {
	i.TermsOfService = &val
	return i
}