code: func validateWithValidator(validator *validator, typename string, data interface{}) Validation {
  	typelist := validator.schema.Types
  	if typelist == nil {
  		return validator.bad("top level", "Schema contains no types", data, "")
  	}
  	if typename == "" {
  		//iterate over the types until we find the most (defined last) general match
  		//But: not always useful: if structs are not "closed", they match on almost anything.
  		for i := len(typelist) - 1; i >= 0; i-- {
  			t := typelist[i]
  			tName, _, _ := TypeInfo(t)
  			v := validator.validate(t, data, string(tName))
  			if v.Error == "" {
  				return v
  			}
  		}
  		return validator.bad("top level", "Cannot determine type of data in schema", data, "")
  	}
  
  	context := typename
  	typedef := validator.registry.FindType(TypeRef(typename))
  
  	if typedef != nil {
  		return validator.validate(typedef, data, context)
  	}
  	return validator.bad(context, "No such type", nil, "")
  }
docs: // ValidateWithValidator tests the provided generic data using the supplied validator.  If the typename is empty,
  // an attempt to guess the type is made, otherwise the check is done against the single type.
  // Supplying the validator allows it to be reused between validations rather than constructing anew