func (b *TypeVisitorBuilder) buildVisitArrayType() func(*TypeVisitor, *ArrayType, interface{}) (Type, error) {
	if b.VisitArrayType == nil {
		return IdentityVisitOfArrayType
	}
	switch v := b.VisitArrayType.(type) {
	case func(*TypeVisitor, *ArrayType, interface{}) (Type, error):
		return v
	case func(*ArrayType) (Type, error):
		return func(_ *TypeVisitor, it *ArrayType, _ interface{}) (Type, error) {
			return v(it)
		}
	case func(*ArrayType) Type:
		return func(_ *TypeVisitor, it *ArrayType, _ interface{}) (Type, error) {
			return v(it), nil
		}
	}
	panic(fmt.Sprintf("unexpected ArrayType func %#v", b.VisitArrayType))
}
buildVisitArrayType returns a function to use in the TypeVisitor
If the field VisitArrayType is nil, we return an identity visitor. Otherwise we attempt to
convert the func found in the field, triggering a panic if no suitable func is found.
package astmodel
import "fmt"
type TypeVisitorBuilder struct {
	VisitTypeName      interface{}
	VisitOneOfType     interface{}
	VisitAllOfType     interface{}
	VisitArrayType     interface{}
	VisitPrimitive     interface{}
	VisitObjectType    interface{}
	VisitMapType       interface{}
	VisitOptionalType  interface{}
	VisitEnumType      interface{}
	VisitResourceType  interface{}
	VisitFlaggedType   interface{}
	VisitValidatedType interface{}
	VisitErroredType   interface{}
}
func (b TypeVisitorBuilder) Build() TypeVisitor {
	return TypeVisitor{
		visitTypeName:      b.buildVisitTypeName(),
		visitOneOfType:     b.buildVisitOneOfType(),
		visitAllOfType:     b.buildVisitAllOfType(),
		visitArrayType:     b.buildVisitArrayType(),
		visitPrimitive:     b.buildVisitPrimitive(),
		visitObjectType:    b.buildVisitObjectType(),
		visitMapType:       b.buildVisitMapType(),
		visitOptionalType:  b.buildVisitOptionalType(),
		visitEnumType:      b.buildVisitEnumType(),
		visitResourceType:  b.buildVisitResourceType(),
		visitFlaggedType:   b.buildVisitFlaggedType(),
		visitValidatedType: b.buildVisitValidatedType(),
		visitErroredType:   b.buildVisitErroredType(),
	}
}
func (b *TypeVisitorBuilder) buildVisitTypeName() func(*TypeVisitor, TypeName, interface{}) (Type, error) {
	if b.VisitTypeName == nil {
		return IdentityVisitOfTypeName
	}
	switch v := b.VisitTypeName.(type) {
	case func(*TypeVisitor, TypeName, interface{}) (Type, error):
		return v
	case func(TypeName) (Type, error):
		return func(_ *TypeVisitor, it TypeName, _ interface{}) (Type, error) {
			return v(it)
		}
	case func(TypeName) Type:
		return func(_ *TypeVisitor, it TypeName, _ interface{}) (Type, error) {
			return v(it), nil
		}
	}
	panic(fmt.Sprintf("unexpected TypeName func %#v", b.VisitTypeName))
}
func (b *TypeVisitorBuilder) buildVisitOneOfType() func(*TypeVisitor, *OneOfType, interface{}) (Type, error) {
	if b.VisitOneOfType == nil {
		return IdentityVisitOfOneOfType
	}
	switch v := b.VisitOneOfType.(type) {
	case func(*TypeVisitor, *OneOfType, interface{}) (Type, error):
		return v
	case func(*OneOfType) (Type, error):
		return func(_ *TypeVisitor, it *OneOfType, _ interface{}) (Type, error) {
			return v(it)
		}
	case func(*OneOfType) Type:
		return func(_ *TypeVisitor, it *OneOfType, _ interface{}) (Type, error) {
			return v(it), nil
		}
	}
	panic(fmt.Sprintf("unexpected OneOfType func %#v", b.VisitOneOfType))
}
func (b *TypeVisitorBuilder) buildVisitAllOfType() func(*TypeVisitor, *AllOfType, interface{}) (Type, error) {
	if b.VisitAllOfType == nil {
		return IdentityVisitOfAllOfType
	}
	switch v := b.VisitAllOfType.(type) {
	case func(*TypeVisitor, *AllOfType, interface{}) (Type, error):
		return v
	case func(*AllOfType) (Type, error):
		return func(_ *TypeVisitor, it *AllOfType, _ interface{}) (Type, error) {
			return v(it)
		}
	case func(*AllOfType) Type:
		return func(_ *TypeVisitor, it *AllOfType, _ interface{}) (Type, error) {
			return v(it), nil
		}
	}
	panic(fmt.Sprintf("unexpected AllOfType func %#v", b.VisitAllOfType))
}