func (tv *TypeVisitor) Visit(t Type, ctx interface{}) (Type, error) {
	if t == nil {
		return nil, nil
	}
	switch it := t.(type) {
	case TypeName:
		return tv.visitTypeName(tv, it, ctx)
	case *OneOfType:
		return tv.visitOneOfType(tv, it, ctx)
	case *AllOfType:
		return tv.visitAllOfType(tv, it, ctx)
	case *ArrayType:
		return tv.visitArrayType(tv, it, ctx)
	case *PrimitiveType:
		return tv.visitPrimitive(tv, it, ctx)
	case *ObjectType:
		return tv.visitObjectType(tv, it, ctx)
	case *MapType:
		return tv.visitMapType(tv, it, ctx)
	case *OptionalType:
		return tv.visitOptionalType(tv, it, ctx)
	case *EnumType:
		return tv.visitEnumType(tv, it, ctx)
	case *ResourceType:
		return tv.visitResourceType(tv, it, ctx)
	case *FlaggedType:
		return tv.visitFlaggedType(tv, it, ctx)
	case *ValidatedType:
		return tv.visitValidatedType(tv, it, ctx)
	case *ErroredType:
		return tv.visitErroredType(tv, it, ctx)
	}
	panic(fmt.Sprintf("unhandled type: (%T) %v", t, t))
}
Visit invokes the appropriate VisitX on TypeVisitor
package astmodel
import (
	"fmt"
	"github.com/pkg/errors"
	kerrors "k8s.io/apimachinery/pkg/util/errors"
)
type TypeVisitor struct {
	visitTypeName      func(this *TypeVisitor, it TypeName, ctx interface{}) (Type, error)
	visitOneOfType     func(this *TypeVisitor, it *OneOfType, ctx interface{}) (Type, error)
	visitAllOfType     func(this *TypeVisitor, it *AllOfType, ctx interface{}) (Type, error)
	visitArrayType     func(this *TypeVisitor, it *ArrayType, ctx interface{}) (Type, error)
	visitPrimitive     func(this *TypeVisitor, it *PrimitiveType, ctx interface{}) (Type, error)
	visitObjectType    func(this *TypeVisitor, it *ObjectType, ctx interface{}) (Type, error)
	visitMapType       func(this *TypeVisitor, it *MapType, ctx interface{}) (Type, error)
	visitOptionalType  func(this *TypeVisitor, it *OptionalType, ctx interface{}) (Type, error)
	visitEnumType      func(this *TypeVisitor, it *EnumType, ctx interface{}) (Type, error)
	visitResourceType  func(this *TypeVisitor, it *ResourceType, ctx interface{}) (Type, error)
	visitFlaggedType   func(this *TypeVisitor, it *FlaggedType, ctx interface{}) (Type, error)
	visitValidatedType func(this *TypeVisitor, it *ValidatedType, ctx interface{}) (Type, error)
	visitErroredType   func(this *TypeVisitor, it *ErroredType, ctx interface{}) (Type, error)
}