Group
Extension

Matches 14

JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV.pm ( view source; MetaCPAN )

our $VERSION = "0.08";

1;
__END__

=encoding utf-8

=head1 NAME

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

=head1 SYNOPSIS

=head1 DESCRIPTION

See e.g. L<JSV::Validator>

=he
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Type.pm ( view source; MetaCPAN )
e JSV::Keyword::Draft4::Type;

use strict;
use warnings;
use parent qw(JSV::Keyword);

use B;
use JSON;
use List::Util qw(first);
use Scalar::Util qw(blessed);

use JSV::Keyword qw(:constants);

sub i
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Context.pm ( view source; MetaCPAN )
ow_immediate
        enable_history
        enable_format
        formats
        history
        json
        loose_type
    /],
    ro  => [qw/
        errors
        current_type
        current_ke
        current_schema_pointer
        schema_pointer_history
    /],
);

use Carp qw(croak);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(detect_instance_type detect_instance_typ
ance {
    my $self = shift;

    my $instance;
    if ( JSON::is_bool($self->current_instance) ) {
        if ( $self->current_instance == JSON::true ) {
            $instance = "true";
        }
   
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/Test/JSV/Suite.pm ( view source; MetaCPAN )
Suite;

use strict;
use warnings;

use Carp;
use File::Basename;
use File::Spec;
use FindBin;
use JSON;
use Test::More;

sub run {
    my ($class, %opts) = @_;

    %opts = (
        base_dir  => $opt
n} ? ( $self->{base_dir}, $self->{version} ) : ( $self->{base_dir} ), 
        $self->{suite} . ".json"
    );

    note $test_suite_file;

    unless (-f $test_suite_file) {
        croak sprintf("No
@$self{qw/base_dir version suite/});
    }

    open(my $fh, "<", $test_suite_file) or croak $!;
    my $test_suite = decode_json(do { local $/; <$fh> });
    close $fh;
    return $test_suite;
}

1;
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Reference.pm ( view source; MetaCPAN )
ge JSV::Reference;

use strict;
use warnings;

use Carp;
use Clone qw(clone);
use Data::Walk;
use JSON::Pointer;
use Scalar::Util qw(weaken);
use URI;
use URI::Split qw(uri_split uri_join);

my %memo;
e reference: uri = %s", $uri);
    }

    if ( $fragment ) {
        eval {
            $schema = JSON::Pointer->get($schema, $fragment, 1);
        };
        if (my $e = $@ ) {
            die sprin
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Maximum.pm ( view source; MetaCPAN )
ackage JSV::Keyword::Draft4::Maximum;

use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSON;

use JSV::Keyword qw(:constants);

sub instance_type() { INSTANCE_TYPE_NUMERIC(); }
sub keyword(
value($schema);
    my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false;

    if ($exclusive_maximum) {
        if ($instance >= $maximum) {
            $context-
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Util/Type.pm ( view source; MetaCPAN )
e Scalar::Util qw(blessed looks_like_number);
use JSON;

our @EXPORT_OK = (qw/
    detect_instance_type
    detect_instance_type_loose
    escape_json_pointer
/);

our %REF_TYPE_MAP = (
    HASH  => "
  if (!blessed $instance) {
            return $REF_TYPE_MAP{$ref_type};
        }
        elsif (JSON::is_bool($instance)) {
            return "boolean";
        }
        else {
            croak(s
$/;
            return "number_or_string";
        }
    }
    return $type_strict;
}

sub escape_json_pointer {
    my $property = shift;
    return unless defined $property;

    # according to http
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Enum.pm ( view source; MetaCPAN )
um;

use strict;
use warnings;
use parent qw(JSV::Keyword);

use JSV::Keyword qw(:constants);
use JSON;
use List::MoreUtils qw(firstidx);

sub instance_type() { INSTANCE_TYPE_ANY(); }
sub keyword() { 
>keyword_value($schema);
    my $instance_as_json = $context->json->encode($instance);
    my $matched_idx = firstidx { $instance_as_json eq $context->json->encode($_); } @$enum;

    if ($matched_idx
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/UniqueItems.pm ( view source; MetaCPAN )
value($schema);

    if ($keyword_value) {
        $context->json->canonical(1);
        my @unique = uniq map {
            $context->json->encode($_)
        } @$instance;

        if (scalar @uniqu
e != scalar @$instance) {
            $context->log_error("The instance array is not unique");
        }
        $context->json->canonical(0);
    }
}

1;
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Items.pm ( view source; MetaCPAN )
ict;
use warnings;
use parent qw(JSV::Keyword);

use JSON;

use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(detect_instance_type escape_json_pointer);

sub instance_type() { INSTANCE_TYPE_ARRA
i]);
            }
            elsif ($additional_items_type eq "boolean" && $additional_items == JSON::false) {
                $context->log_error("additionalItems are not allowed");
            }
 
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Minimum.pm ( view source; MetaCPAN )
ackage JSV::Keyword::Draft4::Minimum;

use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSON;

use JSV::Keyword qw(:constants);

sub instance_type() { INSTANCE_TYPE_NUMERIC(); }
sub keyword(
value($schema);
    my $exclusive_minimum = $class->keyword_value($schema, "exclusiveMinimum") || JSON::false;

    if ($exclusive_minimum) {
        if ($instance <= $minimum) {
            $context-
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Dependencies.pm ( view source; MetaCPAN )
ngs;
use parent qw(JSV::Keyword);

use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(escape_json_pointer);
use List::Util qw(first);

sub instance_type() { INSTANCE_TYPE_OBJECT(); }
sub keyword(
 . "/" . escape_json_pointer( $property );
        local $context->{current_schema_pointer} =
            $context->{current_schema_pointer} . "/" . $class->keyword . "/" . escape_json_pointer( $prope
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Keyword/Draft4/Properties.pm ( view source; MetaCPAN )
V::Keyword);

use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(detect_instance_type escape_json_pointer);

sub instance_type() { INSTANCE_TYPE_OBJECT(); }
sub keyword() { 'properties' }
sub add
nstance) {
        local $context->{current_pointer} = $context->{current_pointer} . "/" . escape_json_pointer( $property );

        if (exists $properties->{$property}) {
            local $context-
nt_schema_pointer} =
                $context->{current_schema_pointer} . "/properties/" . escape_json_pointer( $property );
            $context->validate($properties->{$property}, $instance->{$prope
JSV ( Z/ZI/ZIGOROU/JSV-0.08.tar.gz, ZIGOROU, 2016; MetaCPAN )
JSV/lib/JSV/Validator.pm ( view source; MetaCPAN )
ry
        throw_error
        throw_immediate
        formats
    /]
);
use Clone qw(clone);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Reference;
use JSV::Context;
use Module::Pluggable::Ob

        current_schema_pointer => "",
        schema_pointer_history => [],
        json                   => JSON->new->allow_nonref,
        loose_type             => $opts->{loose_type},
    );

 
alidator;
}

1;

__END__

=encoding utf-8

=head1 NAME

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

=head1 SYNOPSIS

  use feature qw(say);
  use JSV::Validator;

  JSV

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.