diff options
Diffstat (limited to 'jsonschema/_legacy_validators.py')
-rw-r--r-- | jsonschema/_legacy_validators.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/jsonschema/_legacy_validators.py b/jsonschema/_legacy_validators.py index 7cb6df9..63adf49 100644 --- a/jsonschema/_legacy_validators.py +++ b/jsonschema/_legacy_validators.py @@ -32,9 +32,8 @@ def dependencies_draft3(validator, dependencies, instance, schema): yield error elif validator.is_type(dependency, "string"): if dependency not in instance: - yield ValidationError( - "%r is a dependency of %r" % (dependency, property) - ) + message = "%r is a dependency of %r" + yield ValidationError(message % (dependency, property)) else: for each in dependency: if each not in instance: @@ -77,7 +76,7 @@ def disallow_draft3(validator, disallow, instance, schema): for disallowed in _utils.ensure_list(disallow): if validator.is_valid(instance, {"type": [disallowed]}): yield ValidationError( - "%r is disallowed for %r" % (disallowed, instance) + "%r is disallowed for %r" % (disallowed, instance), ) @@ -136,7 +135,7 @@ def minimum_draft3_draft4(validator, minimum, instance, schema): if failed: yield ValidationError( - "%r is %s the minimum of %r" % (instance, cmp, minimum) + "%r is %s the minimum of %r" % (instance, cmp, minimum), ) @@ -153,7 +152,7 @@ def maximum_draft3_draft4(validator, maximum, instance, schema): if failed: yield ValidationError( - "%r is %s the maximum of %r" % (instance, cmp, maximum) + "%r is %s the maximum of %r" % (instance, cmp, maximum), ) @@ -208,5 +207,5 @@ def contains_draft6_draft7(validator, contains, instance, schema): if not any(validator.is_valid(element, contains) for element in instance): yield ValidationError( - "None of %r are valid under the given schema" % (instance,) + "None of %r are valid under the given schema" % (instance,), ) |