func (ex *exampleValidator) isVisited(path string) bool {
	found := ex.visitedSchemas[path]
	if !found {
		frags := strings.Split(path, ".")
		if len(frags) < 2 {
			return found
		}
		last := len(frags) - 1
		var currentFragStr, parent string
		for i := range frags {
			if i == 0 {
				currentFragStr = frags[last]
			} else {
				currentFragStr = strings.Join([]string{frags[last-i], currentFragStr}, ".")
			}
			if i < last {
				parent = strings.Join(frags[0:last-i], ".")
			} else {
				parent = ""
			}
			if strings.HasSuffix(parent, currentFragStr) {
				found = true
				break
			}
		}
	}
	return found
}
isVisited tells if a path has already been visited
package validate
import (
	"fmt"
	"strings"
	"github.com/go-openapi/spec"
)
type exampleValidator struct {
	SpecValidator  *SpecValidator
	visitedSchemas map[string]bool
}
func (ex *exampleValidator) resetVisited() {
	ex.visitedSchemas = map[string]bool{}
}
func (ex *exampleValidator) beingVisited(path string) {
	ex.visitedSchemas[path] = true
}