diff options
author | Julian Berman <Julian@GrayVines.com> | 2017-06-11 12:15:33 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2017-10-29 17:21:53 -0400 |
commit | e89bcee96df4f52b0ca74438cf6385182e19cccb (patch) | |
tree | b83874000191d2c7bf903deb3c052daa11ef6764 /jsonschema/_validators.py | |
parent | d89c79cb388be65179d43eaf5752d68224763a86 (diff) | |
download | jsonschema-e89bcee96df4f52b0ca74438cf6385182e19cccb.tar.gz |
bignum
Diffstat (limited to 'jsonschema/_validators.py')
-rw-r--r-- | jsonschema/_validators.py | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py index 8666916..7183d66 100644 --- a/jsonschema/_validators.py +++ b/jsonschema/_validators.py @@ -82,7 +82,7 @@ def additionalItems(validator, aI, instance, schema): ) -def minimum(validator, minimum, instance, schema): +def minimum_draft3_draft4(validator, minimum, instance, schema): if not validator.is_type(instance, "number"): return @@ -99,7 +99,7 @@ def minimum(validator, minimum, instance, schema): ) -def maximum(validator, maximum, instance, schema): +def maximum_draft3_draft4(validator, maximum, instance, schema): if not validator.is_type(instance, "number"): return @@ -116,6 +116,50 @@ def maximum(validator, maximum, instance, schema): ) +def exclusiveMinimum_draft6(validator, minimum, instance, schema): + if not validator.is_type(instance, "number"): + return + + if instance <= minimum: + yield ValidationError( + "%r is less than or equal to the minimum of %r" % ( + instance, minimum, + ), + ) + + +def exclusiveMaximum_draft6(validator, maximum, instance, schema): + if not validator.is_type(instance, "number"): + return + + if instance >= maximum: + yield ValidationError( + "%r is greater than or equal to the maximum of %r" % ( + instance, maximum, + ), + ) + + +def minimum_draft6(validator, minimum, instance, schema): + if not validator.is_type(instance, "number"): + return + + if instance < minimum: + yield ValidationError( + "%r is less than the minimum of %r" % (instance, minimum) + ) + + +def maximum_draft6(validator, maximum, instance, schema): + if not validator.is_type(instance, "number"): + return + + if instance > maximum: + yield ValidationError( + "%r is greater than the maximum of %r" % (instance, maximum) + ) + + def multipleOf(validator, dB, instance, schema): if not validator.is_type(instance, "number"): return |