@@ -323,7 +323,9 @@ def maxItems(
323
323
validator : Validator , mI : Any , instance : Any , schema : dict [str , Any ]
324
324
) -> ValidationResult : # pylint: disable=arguments-renamed
325
325
if validator .is_type (instance , "array" ) and len (instance ) > mI :
326
- yield ValidationError (f"{ instance !r} is too long ({ mI } )" )
326
+ yield ValidationError (
327
+ f"expected maximum item count: { mI } , found: { len (instance )} "
328
+ )
327
329
328
330
329
331
def maxLength (
@@ -333,7 +335,7 @@ def maxLength(
333
335
return
334
336
335
337
if len (instance ) > mL :
336
- yield ValidationError (f"{ instance !r } is longer than { mL } " )
338
+ yield ValidationError (f"expected maximum length: { mL } , found: { len ( instance ) } " )
337
339
338
340
339
341
def maxProperties (
@@ -342,7 +344,9 @@ def maxProperties(
342
344
if not validator .is_type (instance , "object" ):
343
345
return
344
346
if validator .is_type (instance , "object" ) and len (instance ) > mP :
345
- yield ValidationError (f"{ instance !r} has too many properties" )
347
+ yield ValidationError (
348
+ f"expected maximum property count: { mP } , found: { len (instance )} "
349
+ )
346
350
347
351
348
352
def maximum (
@@ -366,7 +370,9 @@ def minItems(
366
370
validator : Validator , mI : Any , instance : Any , schema : dict [str , Any ]
367
371
) -> ValidationResult :
368
372
if validator .is_type (instance , "array" ) and len (instance ) < mI :
369
- yield ValidationError (f"{ instance !r} is too short ({ mI } )" )
373
+ yield ValidationError (
374
+ f"expected minimum item count: { mI } , found: { len (instance )} "
375
+ )
370
376
371
377
372
378
def minLength (
@@ -376,14 +382,16 @@ def minLength(
376
382
return
377
383
378
384
if len (instance ) < mL :
379
- yield ValidationError (f"{ instance !r } is shorter than { mL } " )
385
+ yield ValidationError (f"expected minimum length: { mL } , found: { len ( instance ) } " )
380
386
381
387
382
388
def minProperties (
383
389
validator : Validator , mP : Any , instance : Any , schema : dict [str , Any ]
384
390
) -> ValidationResult :
385
391
if validator .is_type (instance , "object" ) and len (instance ) < mP :
386
- yield ValidationError (f"{ instance !r} does not have enough properties" )
392
+ yield ValidationError (
393
+ f"expected minimum property count: { mP } , found: { len (instance )} "
394
+ )
387
395
388
396
389
397
def minimum (
@@ -590,14 +598,14 @@ def uniqueItems(
590
598
validator : Validator , uI : Any , instance : Any , schema : dict [str , Any ]
591
599
) -> ValidationResult :
592
600
if uI and validator .is_type (instance , "array" ) and not uniq (instance ):
593
- yield ValidationError (f" { instance !r } has non-unique elements " )
601
+ yield ValidationError ("array items are not unique " )
594
602
595
603
596
604
def uniqueKeys (
597
605
validator : Validator , uKs : Any , instance : Any , schema : dict [str , Any ]
598
606
) -> ValidationResult :
599
607
if uKs and validator .is_type (instance , "array" ) and not uniq_keys (instance , uKs ):
600
- yield ValidationError (f"{ instance !r } has non-unique elements for keys { uKs !r} " )
608
+ yield ValidationError (f"array items are not unique for keys { uKs !r} " )
601
609
602
610
603
611
def type (
0 commit comments