JSV::Validator - A perl implementation of JSON Schema (draft-04) validator
use feature qw(say); use JSV::Validator; JSV::Validator->load_environments("draft4"); my $v = JSV::Validator->new( environment => "draft4" ); my $schema = { type => "object", properties => { foo => { type => "integer" }, bar => { type => "string" } }, required => [ "foo" ] }; say $v->validate($schema, {}); # invalid say $v->validate($schema, { foo => 1 }); # valid say $v->validate($schema, { foo => 10, bar => "xyz" }); # valid say $v->validate($schema, { foo => 1.2, bar => "xyz" }); # invalid
JSV::Validator is implementation of JSON Schema draft-04. This module passes all test suites on https://github.com/json-schema/JSON-Schema-Test-Suite.
JSV::Validator passes all test suites for draft-04.
Copyright (C) Toru Yamaguchi
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Toru Yamaguchi <zigorou@cpan.org>
To install JSV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JSV
CPAN shell
perl -MCPAN -e shell install JSV
For more information on module installation, please visit the detailed CPAN module installation guide.