diff --git a/openapi3/schema.go b/openapi3/schema.go index de3e5167d..5f1ee60b4 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -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 @@ -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 {