- JSON::Validator version: 5.14
- Perl version: 5.38
- Operating system: Debian 12.1
Steps to reproduce the behavior
In an attempt to diagnose an issue I was seeing in my app (which turned out to be the fourth item below), I stumbled across what seem to be some errors in the documentation.
- JSON::Validator::Joi POD->SYNOPSIS: the schema declaration for the email field does not include
->string causing it to default to object, so testing the sample code does not work as expected.
- JSON::Validator::Joi POD->SYNOPSIS: the data value for the email field should be
'jhthorsen@cpan.org' not "jhthorsen@cpan.org"
- JSON::Validator POD->SYNOPSIS: In the "Using Joi" section, if the code under "joi() can also validate directly" is run as written, it results in the
@errors array containing a JSON::Validator::Joi object rather than any JSON::Validator::Error objects. As there is no corroborating documentation for the joi() function, I'm unsure whether this is a bug in the code, or just incorrect documentation.
- JSON::Validator POD->SYNPOSIS: in the "Using Joi" section under "Use joi() to build the schema", the code will partially function, but without adding
->compile, some errors (like those related to the required and strict attributes) won't be output
Expected behavior
- No validation errors (unless the point of this section is to demonstrate such a validation error, in which case that should be specifically called out)
- No errors
- The
@errors array should contain /age: -42 < minimum(0) (JSON::Validator::Error)
- The expectation is that everything stated in the code would be validated, if
->validate were to be called (though as the documentation is written, it is not)
Actual behavior
/email: Expected object - got string. (JSON::Validator::Error)
Global symbol "@cpan" requires explicit package name (did you forget to declare "my @cpan"?)
- The
@errors array contains only a JSON::Validator::Joi object
- Provided that the code was extrapolated into a complete "thought," the
required attribute would be ignored, resulting in validation errors not being produced when they should be.
Steps to reproduce the behavior
In an attempt to diagnose an issue I was seeing in my app (which turned out to be the fourth item below), I stumbled across what seem to be some errors in the documentation.
->stringcausing it to default toobject, so testing the sample code does not work as expected.'jhthorsen@cpan.org'not"jhthorsen@cpan.org"@errorsarray containing aJSON::Validator::Joiobject rather than anyJSON::Validator::Errorobjects. As there is no corroborating documentation for thejoi()function, I'm unsure whether this is a bug in the code, or just incorrect documentation.->compile, some errors (like those related to therequiredandstrictattributes) won't be outputExpected behavior
@errorsarray should contain/age: -42 < minimum(0) (JSON::Validator::Error)->validatewere to be called (though as the documentation is written, it is not)Actual behavior
/email: Expected object - got string. (JSON::Validator::Error)Global symbol "@cpan" requires explicit package name (did you forget to declare "my @cpan"?)@errorsarray contains only aJSON::Validator::Joiobjectrequiredattribute would be ignored, resulting in validation errors not being produced when they should be.