@@ -883,7 +883,7 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
883883 Value : value ,
884884 Schema : schema ,
885885 SchemaField : "enum" ,
886- Reason : "value is not one of the allowed values" ,
886+ Reason : fmt . Sprintf ( "value %q is not one of the allowed values" , value ) ,
887887 customizeMessageError : settings .customizeMessageError ,
888888 }
889889 }
@@ -1085,7 +1085,7 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
10851085 Value : value ,
10861086 Schema : schema ,
10871087 SchemaField : "type" ,
1088- Reason : "Value must be an integer" ,
1088+ Reason : fmt . Sprintf ( "Value \" %g \" must be an integer" , value ) ,
10891089 customizeMessageError : settings .customizeMessageError ,
10901090 }
10911091 if ! settings .multiError {
@@ -1305,7 +1305,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
13051305 Value : value ,
13061306 Schema : schema ,
13071307 SchemaField : "pattern" ,
1308- Reason : fmt .Sprintf (`string doesn't match the regular expression "%s"` , schema .Pattern ),
1308+ Reason : fmt .Sprintf (`value %q doesn't match the regular expression "%s"` , value , schema .Pattern ),
13091309 customizeMessageError : settings .customizeMessageError ,
13101310 }
13111311 if ! settings .multiError {
@@ -1322,7 +1322,7 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
13221322 switch {
13231323 case f .regexp != nil && f .callback == nil :
13241324 if cp := f .regexp ; ! cp .MatchString (value ) {
1325- formatStrErr = fmt .Sprintf (`string doesn't match the format %q (regular expression "%s")` , format , cp .String ())
1325+ formatStrErr = fmt .Sprintf (`value %q doesn't match the format %q (regular expression "%s")` , value , format , cp .String ())
13261326 }
13271327 case f .regexp == nil && f .callback != nil :
13281328 if err := f .callback (value ); err != nil {
@@ -1650,7 +1650,7 @@ func (schema *Schema) expectedType(settings *schemaValidationSettings, typ strin
16501650 Value : typ ,
16511651 Schema : schema ,
16521652 SchemaField : "type" ,
1653- Reason : "Field must be set to " + schema . Type + " or not be present" ,
1653+ Reason : fmt . Sprintf ( "Field must be set to %q or not be present" , schema . Type ) ,
16541654 customizeMessageError : settings .customizeMessageError ,
16551655 }
16561656}
0 commit comments