Closed jhthorsen closed 6 years ago
Looking good so far.
I'm going to merge this now, even though I don't use this API myself. Will remove EXPERIMENTAL later after someone tells me that "joi" is useful and no apparent design flaws have been discovered.
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
lib/JSON/Validator.pm 95.4 90.2 80.1 94.0 75.0 89.2 90.7
lib/JSON/Validator/Error.pm 100.0 n/a 75.0 100.0 75.0 0.1 93.5
lib/JSON/Validator/Joi.pm 98.9 77.0 60.0 100.0 100.0 1.0 93.3
...JSON/Validator/OpenAPI.pm 96.3 80.0 72.9 80.6 100.0 3.5 86.0
...or/OpenAPI/Mojolicious.pm 73.3 65.3 n/a 83.3 n/a 4.9 70.9
lib/JSON/Validator/Ref.pm 90.4 100.0 66.6 85.7 60.0 1.0 85.1
Total 95.1 86.0 78.1 92.3 87.7 100.0 89.4
---------------------------- ------ ------ ------ ------ ------ ------ ------
This PR is not yet complete! Opening it to track changes myself and for others to have a look.
The idea is that the new "Joi" module should make it easier to write schemas, without knowing how to write JSON-Schema. As in should I write "max" or "maximum"..? Joi will document what is valid and translate attributes such as "max" into "maximum", "maxLength", "maxItems" or "maxProperties".
TODO:
Here is the inspiration: