Skip to content

Commit

Permalink
Do not escape regular expressions again (#429) (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmml97 authored Oct 8, 2021
1 parent 5a162f6 commit 1231120
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openapi3/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
Value: value,
Schema: schema,
SchemaField: "pattern",
Reason: fmt.Sprintf("string doesn't match the regular expression %q", schema.Pattern),
Reason: fmt.Sprintf("string doesn't match the regular expression \"%s\"", schema.Pattern),
}
if !settings.multiError {
return err
Expand All @@ -1182,7 +1182,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
switch {
case f.regexp != nil && f.callback == nil:
if cp := f.regexp; !cp.MatchString(value) {
formatErr = fmt.Sprintf("string doesn't match the format %q (regular expression %q)", format, cp.String())
formatErr = fmt.Sprintf("string doesn't match the format %q (regular expression \"%s\")", format, cp.String())
}
case f.regexp == nil && f.callback != nil:
if err := f.callback(value); err != nil {
Expand Down

0 comments on commit 1231120

Please sign in to comment.