Skip to content

Instantly share code, notes, and snippets.

@akarelas-pt
Created November 24, 2017 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarelas-pt/2e31f39445a039272aa33d1f6e74aa4a to your computer and use it in GitHub Desktop.
Save akarelas-pt/2e31f39445a039272aa33d1f6e74aa4a to your computer and use it in GitHub Desktop.
no rules returns error
#!/usr/bin/env perl
use v5.16;
use warnings;
use lib 'local/lib/perl5';
use JSON::Validator;
use Data::Dumper;
my $v = JSON::Validator->new;
$v->schema({});
my @errors = $v->validate({a => 1});
print Dumper(\@errors);
__END__
prints this:
$VAR1 = [
bless( {
'path' => '/',
'message' => 'No validation rules defined.'
}, 'JSON::Validator::Error' )
];
However this page: http://json-schema.org/ says that schema {} allows (should allow) anything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment