The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JSV::Validator - A perl implementation of JSON Schema (draft-04) validator

SYNOPSIS

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

DESCRIPTION

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.

METHODS

load_enviroments()

new

validate

instance_type_keywords

register_schema

unregister_schema

register_format

SEE ALSO

http://json-schema.org/
https://github.com/json-schema/JSON-Schema-Test-Suite

JSV::Validator passes all test suites for draft-04.

B
Class::Accessor::Lite
Data::Clone
Exporter
JSON
JSON::Pointer
List::Util
List::MoreUtils
Module::Pluggable::Object
Scalar::Util
URI
URI::Split

LICENSE

Copyright (C) Toru Yamaguchi

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Toru Yamaguchi <zigorou@cpan.org>