Group
Extension

Matches 6

JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema.pm ( view source; MetaCPAN )
package JSON::Schema;

use 5.010;
use strict;

use Carp;
use HTTP::Link::Parser qw[parse_links_to_rdfjson relationship_uri];
use JSON;
use JSON::Hyper;
use JSON::Schema::Error;
use JSON::Schema::Helpe
ma = from_json($schema) unless ref $schema;
	$options{format} //= {};
	
	return bless { %options, schema => $schema }, $class;
}

sub detect
{
	my ($class, $source) = @_;
	
	my $hyper = JSON::Hyper->n
l);
	
	if ($source->isa('HTTP::Response'))
	{
		$url    = $source->request->uri;
		$object = from_json($source->decoded_content);
	}
	else
	{
		$url = "$source";
		($source, my $frag) = split /\#/, $s
JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema/Result.pm ( view source; MetaCPAN )
package JSON::Schema::Result;

use 5.010;
use strict;
use overload bool => \&valid;

use JSON::Schema::Error;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.016';

sub new
{
	my ($class, $resul
{ JSON::Schema::Error->new($_); } @{$self->{'errors'}};
}

1;

__END__

=head1 NAME

JSON::Schema::Result - the result of checking an instance against a schema

=head1 SYNOPSIS

 my $validator = JSON:
:Schema->new($schema);
 my $json      = from_json( ... );
 my $result    = $validator->validate($json);
 
 if ($result)
 {
   print "Valid!\n";
 }
 else
 {
   print "Errors\n";
	print " - $_\n" foreac
JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema/Null.pm ( view source; MetaCPAN )
package JSON::Schema::Null;

use 5.010;
use strict;
use overload '""' => sub { return '' };

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.016';

sub new
{
	my ($class) = @_;
	my $x = '';
	retu
rn bless \$x, $class;
}

sub TO_JSON
{
	return undef;
}

1;

__END__

=head1 NAME

JSON::Schema::Null - represents JSON's null value

=head1 SEE ALSO

L<JSON::Schema>.

=head1 AUTHOR

Toby Inkster E<l
JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema/Error.pm ( view source; MetaCPAN )
package JSON::Schema::Error;

use 5.010;
use strict;
use overload '""' => \&to_string;

use JSON::Path;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.016';

sub new
{
	my ($class, $e) = @_;
	r
eturn bless $e, $class;
}

sub property
{
	my ($self) = @_;
	return JSON::Path->new($self->{property});
}

sub message
{
	my ($self) = @_;
	return $self->{message};
}

sub title
{
	my ($self) = @_;
	r
head1 NAME

JSON::Schema::Error - an error that occurred when checking an instance against a schema

=head1 SYNOPSIS

 my $validator = JSON::Schema->new($schema);
 my $json      = from_json( ... );
 m
JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema/Helper.pm ( view source; MetaCPAN )
package JSON::Schema::Helper;

### 
# JSONSchema Validator - Validates JavaScript objects using JSON Schemas 
#	(http://www.json.com/json-schema-proposal/)
#
# Copyright (c) 2007 Kris Zyp SitePen (www
.sitepen.com)
# Licensed under the MIT (MIT-LICENSE.txt) license.
#To use the validator call JSONSchema.validate with an instance object and an optional schema object.
#If a schema is provided, it wil
t FALSE => !1;
use constant TRUE  => !!1;
no autovivification;

use JSON qw[-convert_blessed_universally];
use JSON::Hyper;
use JSON::Schema::Null;
use POSIX qw[modf];
use Scalar::Util qw[blessed];
us
JSON-Schema ( T/TO/TOBYINK/JSON-Schema-0.016.tar.gz, TOBYINK, 2014; MetaCPAN )
JSON-Schema/lib/JSON/Schema/Examples.pod ( view source; MetaCPAN )
=head1 NAME

JSON::Schema::Examples - examples of JSON::Schema

=head1 EXAMPLES

=head2 Validate some JSON contact info against nested schemas.

The card schema at L<http://json-schema.org/card> is tr
eed to be followed. But JSON::Schema
handles it with ease...

 use JSON qw[to_json];
 use JSON::Schema;
 use LWP::Simple qw[get];
 
 # Here's some data...
 my $contact = to_json({
   fn        => 'Tob
n => 'East Sussex' },
 });
 
 # Now we create our JSON Schema validator:
 my $card_schema = get('http://json-schema.org/card'); 
 my $validator = JSON::Schema->new($card_schema);
 
 # Validate:
 my $v

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