brettviren / moo

ruminants on module oriented programming
GNU General Public License v3.0
4 stars 4 forks source link

Implement numeric constraints #17

Closed brettviren closed 3 years ago

brettviren commented 3 years ago

Add support for specifying constraints in the number class of oschema and implement them in at least otypes.

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 a constraints 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 for number should also check the constraints and moo validate should apply them.

brettviren commented 3 years ago

Spurred by https://github.com/DUNE-DAQ/dfmodules/issues/29

brettviren commented 3 years ago

There are five numeric constraints currently supported by JSON Schema: