Ejemplo n.º 1
0
// Pattern validates a string against a regular expression
func Pattern(path, in, data, pattern string) *errors.Validation {
	re := regexp.MustCompile(pattern)
	if !re.MatchString(data) {
		return errors.FailedPattern(path, in, pattern)
	}
	return nil
}
func patternFailItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.FailedPattern(path, in, items.Pattern)
}
Ejemplo n.º 3
0
func patternFail(param *spec.Parameter) *errors.Validation {
	return errors.FailedPattern(param.Name, param.In, param.Pattern)
}