in core.go [145:164]
func setupWalkObserver() (walkObserver, *CompiledSchema) {
compiled := make(CompiledSchema, 0)
return func(current walkObserverInfo) error {
kind := current.value.Kind()
isCollection := kind == reflect.Map || kind == reflect.Slice
isEmptyCollection := isCollection && current.value.Len() == 0
// We do comparisons on all leaf nodes. If the leaf is an empty collection
// we do a comparison to let us test empty structures.
if !isCollection || isEmptyCollection {
isDef, isIsDef := current.value.Interface().(isdef.IsDef)
if !isIsDef {
isDef = isdef.IsEqual(current.value.Interface())
}
compiled = append(compiled, flatValidator{current.path, isDef})
}
return nil
}, &compiled
}