Closed brettviren closed 3 years ago
There are five numeric constraints currently supported by JSON Schema:
multipleOf
, can be set to 1.0
in order to imply "integer value" (int/float is a whole can of worms)exclusiveMinimum
and exclusiveMaximum
strict inequalities. Note, reject JSON Schema Draft 4 which treats these as literal Boolean instead of literal numbers.minimum
and maximum
includes equality
Add support for specifying constraints in the
number
class ofoschema
and implement them in at leastotypes
.Support at least those listed in JSON Schema:
https://json-schema.org/understanding-json-schema/reference/numeric.html
Currently the
number
schema class constructor accepts aconstraints
argument, which it then ignores. This was my place holder for this known missing feature. Rethink keeping this vs making JSON Schema constraints as first class kwargs to the constructor. Their cardinality is on the edge of "too many" and "ah, it's okay".The
moo.otypes
fornumber
should also check the constraints andmoo validate
should apply them.