Skip to content

Commit 1231120

Browse files
authored
Do not escape regular expressions again (#429) (#435)
1 parent 5a162f6 commit 1231120

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openapi3/schema.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
11671167
Value: value,
11681168
Schema: schema,
11691169
SchemaField: "pattern",
1170-
Reason: fmt.Sprintf("string doesn't match the regular expression %q", schema.Pattern),
1170+
Reason: fmt.Sprintf("string doesn't match the regular expression \"%s\"", schema.Pattern),
11711171
}
11721172
if !settings.multiError {
11731173
return err
@@ -1182,7 +1182,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
11821182
switch {
11831183
case f.regexp != nil && f.callback == nil:
11841184
if cp := f.regexp; !cp.MatchString(value) {
1185-
formatErr = fmt.Sprintf("string doesn't match the format %q (regular expression %q)", format, cp.String())
1185+
formatErr = fmt.Sprintf("string doesn't match the format %q (regular expression \"%s\")", format, cp.String())
11861186
}
11871187
case f.regexp == nil && f.callback != nil:
11881188
if err := f.callback(value); err != nil {

0 commit comments

Comments
 (0)