Hello community, here is the log from the commit of package perl-JSON-Validator for openSUSE:Factory checked in at 2020-01-30 09:41:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old) and /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON-Validator" Thu Jan 30 09:41:39 2020 rev:11 rq:768344 version:3.18 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes 2020-01-01 14:59:46.561977416 +0100 +++ /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.26092/perl-JSON-Validator.changes 2020-01-30 09:42:19.329519689 +0100 @@ -1,0 +2,10 @@ +Wed Jan 29 03:18:54 UTC 2020 - <timueller+p...@suse.de> + +- updated to 3.18 + see /usr/share/doc/packages/perl-JSON-Validator/Changes + + 3.18 2020-01-29T10:18:09+0900 + - Fix validating constants that are null or the empty string + Contributor: Karen Etheridge + +------------------------------------------------------------------- Old: ---- JSON-Validator-3.17.tar.gz New: ---- JSON-Validator-3.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-JSON-Validator.spec ++++++ --- /var/tmp/diff_new_pack.AS5lIZ/_old 2020-01-30 09:42:20.393520259 +0100 +++ /var/tmp/diff_new_pack.AS5lIZ/_new 2020-01-30 09:42:20.397520260 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-JSON-Validator # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: perl-JSON-Validator -Version: 3.17 +Version: 3.18 Release: 0 %define cpan_name JSON-Validator Summary: Validate data against a JSON schema ++++++ JSON-Validator-3.17.tar.gz -> JSON-Validator-3.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/Changes new/JSON-Validator-3.18/Changes --- old/JSON-Validator-3.17/Changes 2019-12-29 06:21:53.000000000 +0100 +++ new/JSON-Validator-3.18/Changes 2020-01-29 02:18:09.000000000 +0100 @@ -1,5 +1,9 @@ Revision history for perl distribution JSON-Validator +3.18 2020-01-29T10:18:09+0900 + - Fix validating constants that are null or the empty string + Contributor: Karen Etheridge + 3.17 2019-12-29T14:21:53+0900 - Fix for deep recursion on Windows #170 - Fix reading unicode specifiation from __DATA__ #179 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/META.json new/JSON-Validator-3.18/META.json --- old/JSON-Validator-3.17/META.json 2019-12-29 06:21:54.000000000 +0100 +++ new/JSON-Validator-3.18/META.json 2020-01-29 02:18:11.000000000 +0100 @@ -61,6 +61,6 @@ }, "x_IRC" : "irc://irc.freenode.net/#mojo" }, - "version" : "3.17", + "version" : "3.18", "x_serialization_backend" : "JSON::PP version 4.02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/META.yml new/JSON-Validator-3.18/META.yml --- old/JSON-Validator-3.17/META.yml 2019-12-29 06:21:54.000000000 +0100 +++ new/JSON-Validator-3.18/META.yml 2020-01-29 02:18:11.000000000 +0100 @@ -30,5 +30,5 @@ homepage: https://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/mojolicious/json-validator.git -version: '3.17' +version: '3.18' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/lib/JSON/Validator.pm new/JSON-Validator-3.18/lib/JSON/Validator.pm --- old/JSON-Validator-3.17/lib/JSON/Validator.pm 2019-12-29 06:21:53.000000000 +0100 +++ new/JSON-Validator-3.18/lib/JSON/Validator.pm 2020-01-29 02:18:09.000000000 +0100 @@ -23,7 +23,7 @@ use constant RECURSION_LIMIT => $ENV{JSON_VALIDATOR_RECURSION_LIMIT} || 100; use constant SPECIFICATION_URL => 'http://json-schema.org/draft-04/schema#'; -our $VERSION = '3.17'; +our $VERSION = '3.18'; our $YAML_LOADER = eval q[use YAML::XS 0.67; YAML::XS->can('Load')]; # internal our @EXPORT_OK = qw(joi validate_json); @@ -635,6 +635,13 @@ return @errors if @errors; } + if (exists $schema->{const}) { + push @errors, + $self->_validate_type_const($to_json ? $$to_json : $_[1], $path, $schema); + $self->_report_errors($path, 'enum', \@errors) if REPORT; + return @errors if @errors; + } + if ($schema->{enum}) { push @errors, $self->_validate_type_enum($to_json ? $$to_json : $_[1], $path, $schema); @@ -1108,7 +1115,7 @@ return _guessed_right(number => $_[1]) if defined $_[0]->{maximum} or defined $_[0]->{minimum}; - return 'const' if $_[0]->{const}; + return 'const' if exists $_[0]->{const}; return undef; } @@ -1545,6 +1552,8 @@ Ed J - C<moha...@users.noreply.github.com> +Karen Etheridge - C<et...@cpan.org> + Kevin Goess - C<c...@goess.org> Martin Renvoize - C<martin.renvo...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-array.t new/JSON-Validator-3.18/t/jv-array.t --- old/JSON-Validator-3.17/t/jv-array.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-array.t 2020-01-29 02:14:57.000000000 +0100 @@ -55,4 +55,9 @@ is encode_json(\@numbers), encode_json([1, 2, 1, 1, 3, 1]), 'coerced into numbers'; +my $array_constant = {type => 'array', const => [1, 'a', undef]}; +validate_ok [1, 'a', undef], $array_constant; +validate_ok [1, 'b', undef], $array_constant, + E('/', q{Does not match const: [1,"a",null].}); + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-boolean.t new/JSON-Validator-3.18/t/jv-boolean.t --- old/JSON-Validator-3.17/t/jv-boolean.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-boolean.t 2020-01-29 02:14:57.000000000 +0100 @@ -22,10 +22,22 @@ E('/', 'Expected boolean - got string.'); validate_ok undef, {properties => {}}, E('/', 'Expected object - got null.'); +my $bool_constant_false = {type => 'boolean', const => false}; +my $bool_constant_true = {type => 'boolean', const => true}; +validate_ok false, $bool_constant_false; +validate_ok true, $bool_constant_false, E('/', q{Does not match const: false.}); +validate_ok true, $bool_constant_true; +validate_ok false, $bool_constant_true, E('/', q{Does not match const: true.}); + jv->coerce('bool'); validate_ok {nick => 1000}, $schema; validate_ok {nick => 0.5}, $schema; +validate_ok 0, $bool_constant_false; +validate_ok 1000, $bool_constant_false, E('/', q{Does not match const: false.}); +validate_ok 1000, $bool_constant_true; +validate_ok 0, $bool_constant_true, E('/', q{Does not match const: true.}); + done_testing; package BoolTestOk; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-const.t new/JSON-Validator-3.18/t/jv-const.t --- old/JSON-Validator-3.17/t/jv-const.t 2018-12-15 06:40:27.000000000 +0100 +++ new/JSON-Validator-3.18/t/jv-const.t 2020-01-29 02:14:57.000000000 +0100 @@ -71,4 +71,17 @@ people => [{name => 'mr. chocolate fan', age => 42, likes => 'peanutbutter'}] }, $schema; +my $null_const = {const => undef}; +validate_ok 'foo', $null_const, E('/', q{Does not match const: null.}); +validate_ok undef, $null_const; + +my $empty_const = {const => ''}; +validate_ok 'foo', $empty_const, E('/', q{Does not match const: "".}); +validate_ok '', $empty_const; + +my $array_constant = {const => [1, 'a', undef]}; +validate_ok [1, 'a', undef], $array_constant; +validate_ok [1, 'b', undef], $array_constant, + E('/', q{Does not match const: [1,"a",null].}); + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-integer.t new/JSON-Validator-3.18/t/jv-integer.t --- old/JSON-Validator-3.17/t/jv-integer.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-integer.t 2020-01-29 02:14:57.000000000 +0100 @@ -18,6 +18,10 @@ $schema->{properties}{mynumber}{multipleOf} = 2; validate_ok {mynumber => 3}, $schema, E('/mynumber', 'Not multiple of 2.'); +my $int_constant = {type => 'integer', const => 2}; +validate_ok 2, $int_constant; +validate_ok 1, $int_constant, E('/', q{Does not match const: 2.}); + jv->coerce('num'); validate_ok {mynumber => '2'}, $schema; validate_ok {mynumber => '2xyz'}, $schema, @@ -26,4 +30,7 @@ $schema->{properties}{mynumber}{minimum} = -3; validate_ok {mynumber => '-2'}, $schema; +validate_ok '2', $int_constant; +validate_ok '1', $int_constant, E('/', q{Does not match const: 2.}); + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-number.t new/JSON-Validator-3.18/t/jv-number.t --- old/JSON-Validator-3.17/t/jv-number.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-number.t 2020-01-29 02:14:57.000000000 +0100 @@ -11,6 +11,10 @@ validate_ok {mynumber => '2'}, $schema, E('/mynumber', 'Expected number - got string.'); +my $numeric_constant = {type => 'number', const => 2.1}; +validate_ok 2.1, $numeric_constant; +validate_ok 1, $numeric_constant, E('/', q{Does not match const: 2.1.}); + jv->coerce('numbers'); validate_ok {mynumber => '-0.3'}, $schema; validate_ok {mynumber => '0.1e+1'}, $schema; @@ -24,4 +28,7 @@ properties => {validNumber => {type => 'number', multipleOf => 0.01}} }; +validate_ok '2.1', $numeric_constant; +validate_ok '1', $numeric_constant, E('/', q{Does not match const: 2.1.}); + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-object.t new/JSON-Validator-3.18/t/jv-object.t --- old/JSON-Validator-3.17/t/jv-object.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-object.t 2020-01-29 02:14:57.000000000 +0100 @@ -132,4 +132,9 @@ validate_ok $obj, {properties => {age => {type => 'integer'}}}, E('/age', 'Expected integer - got string.', 'age is not a string'); +my $object_constant = {type => 'object', const => {a => 1}}; +validate_ok {a => 1}, $object_constant; +validate_ok {b => 1}, $object_constant, + E('/', q{Does not match const: {"a":1}.}); + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-3.17/t/jv-string.t new/JSON-Validator-3.18/t/jv-string.t --- old/JSON-Validator-3.17/t/jv-string.t 2019-09-27 03:36:58.000000000 +0200 +++ new/JSON-Validator-3.18/t/jv-string.t 2020-01-29 02:14:57.000000000 +0100 @@ -40,4 +40,12 @@ } ); +my $string_constant = {type => 'string', const => 'foo'}; +validate_ok 'foo', $string_constant; +validate_ok 'bar', $string_constant, E('/', q{Does not match const: "foo".}); + +my $empty_string_constant = {type => 'string', const => ''}; +validate_ok '', $empty_string_constant; +validate_ok 'bar', $empty_string_constant, E('/', q{Does not match const: "".}); + done_testing;