@@ -244,11 +244,11 @@ func getValidationTests(t *testing.T) []*validationTest {
244244 },
245245 wantErrParam : "status" ,
246246 wantErrParamIn : "query" ,
247- wantErrSchemaReason : "value is not one of the allowed values" ,
247+ wantErrSchemaReason : "value \" available,sold \" is not one of the allowed values" ,
248248 wantErrSchemaPath : "/0" ,
249249 wantErrSchemaValue : "available,sold" ,
250250 wantErrResponse : & ValidationError {Status : http .StatusBadRequest ,
251- Title : "value is not one of the allowed values" ,
251+ Title : "value \" available,sold \" is not one of the allowed values" ,
252252 Detail : "value available,sold at /0 must be one of: available, pending, sold; " +
253253 // TODO: do we really want to use this heuristic to guess
254254 // that they're using the wrong serialization?
@@ -262,11 +262,11 @@ func getValidationTests(t *testing.T) []*validationTest {
262262 },
263263 wantErrParam : "status" ,
264264 wantErrParamIn : "query" ,
265- wantErrSchemaReason : "value is not one of the allowed values" ,
265+ wantErrSchemaReason : "value \" watdis \" is not one of the allowed values" ,
266266 wantErrSchemaPath : "/1" ,
267267 wantErrSchemaValue : "watdis" ,
268268 wantErrResponse : & ValidationError {Status : http .StatusBadRequest ,
269- Title : "value is not one of the allowed values" ,
269+ Title : "value \" watdis \" is not one of the allowed values" ,
270270 Detail : "value watdis at /1 must be one of: available, pending, sold" ,
271271 Source : & ValidationErrorSource {Parameter : "status" }},
272272 },
@@ -278,11 +278,11 @@ func getValidationTests(t *testing.T) []*validationTest {
278278 },
279279 wantErrParam : "kind" ,
280280 wantErrParamIn : "query" ,
281- wantErrSchemaReason : "value is not one of the allowed values" ,
281+ wantErrSchemaReason : "value \" fish,with,commas \" is not one of the allowed values" ,
282282 wantErrSchemaPath : "/1" ,
283283 wantErrSchemaValue : "fish,with,commas" ,
284284 wantErrResponse : & ValidationError {Status : http .StatusBadRequest ,
285- Title : "value is not one of the allowed values" ,
285+ Title : "value \" fish,with,commas \" is not one of the allowed values" ,
286286 Detail : "value fish,with,commas at /1 must be one of: dog, cat, turtle, bird,with,commas" ,
287287 // No 'perhaps you intended' because its the right serialization format
288288 Source : & ValidationErrorSource {Parameter : "kind" }},
@@ -304,11 +304,11 @@ func getValidationTests(t *testing.T) []*validationTest {
304304 },
305305 wantErrParam : "x-environment" ,
306306 wantErrParamIn : "header" ,
307- wantErrSchemaReason : "value is not one of the allowed values" ,
307+ wantErrSchemaReason : "value \" watdis \" is not one of the allowed values" ,
308308 wantErrSchemaPath : "/" ,
309309 wantErrSchemaValue : "watdis" ,
310310 wantErrResponse : & ValidationError {Status : http .StatusBadRequest ,
311- Title : "value is not one of the allowed values" ,
311+ Title : "value \" watdis \" is not one of the allowed values" ,
312312 Detail : "value watdis at / must be one of: demo, prod" ,
313313 Source : & ValidationErrorSource {Parameter : "x-environment" }},
314314 },
@@ -323,11 +323,11 @@ func getValidationTests(t *testing.T) []*validationTest {
323323 r : newPetstoreRequest (t , http .MethodPost , "/pet" , bytes .NewBufferString (`{"status":"watdis"}` )),
324324 },
325325 wantErrReason : "doesn't match the schema" ,
326- wantErrSchemaReason : "value is not one of the allowed values" ,
326+ wantErrSchemaReason : "value \" watdis \" is not one of the allowed values" ,
327327 wantErrSchemaValue : "watdis" ,
328328 wantErrSchemaPath : "/status" ,
329329 wantErrResponse : & ValidationError {Status : http .StatusUnprocessableEntity ,
330- Title : "value is not one of the allowed values" ,
330+ Title : "value \" watdis \" is not one of the allowed values" ,
331331 Detail : "value watdis at /status must be one of: available, pending, sold" ,
332332 Source : & ValidationErrorSource {Pointer : "/status" }},
333333 },
@@ -379,13 +379,13 @@ func getValidationTests(t *testing.T) []*validationTest {
379379 bytes .NewBufferString (`{"name":"Bahama","photoUrls":"http://cat"}` )),
380380 },
381381 wantErrReason : "doesn't match the schema" ,
382- wantErrSchemaReason : "Field must be set to array or not be present" ,
382+ wantErrSchemaReason : "field must be set to array or not be present" ,
383383 wantErrSchemaPath : "/photoUrls" ,
384384 wantErrSchemaValue : "string" ,
385385 // TODO: this shouldn't say "or not be present", but this requires recursively resolving
386386 // innerErr.JSONPointer() against e.RequestBody.Content["application/json"].Schema.Value (.Required, .Properties)
387387 wantErrResponse : & ValidationError {Status : http .StatusUnprocessableEntity ,
388- Title : "Field must be set to array or not be present" ,
388+ Title : "field must be set to array or not be present" ,
389389 Source : & ValidationErrorSource {Pointer : "/photoUrls" }},
390390 },
391391 {
@@ -659,7 +659,7 @@ func TestValidationHandler_ServeHTTP(t *testing.T) {
659659 body , err := ioutil .ReadAll (resp .Body )
660660 require .NoError (t , err )
661661 require .Equal (t , http .StatusUnprocessableEntity , resp .StatusCode )
662- require .Equal (t , "[422][][] Field must be set to array or not be present [source pointer=/photoUrls]" , string (body ))
662+ require .Equal (t , "[422][][] field must be set to array or not be present [source pointer=/photoUrls]" , string (body ))
663663 })
664664}
665665
@@ -701,6 +701,6 @@ func TestValidationHandler_Middleware(t *testing.T) {
701701 body , err := ioutil .ReadAll (resp .Body )
702702 require .NoError (t , err )
703703 require .Equal (t , http .StatusUnprocessableEntity , resp .StatusCode )
704- require .Equal (t , "[422][][] Field must be set to array or not be present [source pointer=/photoUrls]" , string (body ))
704+ require .Equal (t , "[422][][] field must be set to array or not be present [source pointer=/photoUrls]" , string (body ))
705705 })
706706}
0 commit comments