Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package perl-JSON-Validator for
openSUSE:Factory checked in at 2021-04-12 17:10:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old)
and /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON-Validator"
Mon Apr 12 17:10:31 2021 rev:30 rq:880886 version:4.16
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes
2021-02-25 18:28:48.438233871 +0100
+++
/work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.2401/perl-JSON-Validator.changes
2021-04-12 17:10:34.242578673 +0200
@@ -1,0 +2,15 @@
+Wed Mar 24 03:06:35 UTC 2021 - Tina M??ller <[email protected]>
+
+- updated to 4.16
+ see /usr/share/doc/packages/perl-JSON-Validator/Changes
+
+ 4.16 2021-03-24T08:57:46+0900
+ - Fix handling OpenAPIv2 "responses" $ref when bundling
+
+ 4.15 2021-03-24T07:57:58+0900
+ - Fix validating nullable inside anyOf for OpenAPIv3 #241
+ - Fix t/id-keyword-draft*.t test failures with Mojolicious 9.11 #242 #243
+ - Removed deprecated functions joi() and validate_json()
+ - Removed deprecated methods singleton() and version()
+
+-------------------------------------------------------------------
Old:
----
JSON-Validator-4.14.tar.gz
New:
----
JSON-Validator-4.16.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-JSON-Validator.spec ++++++
--- /var/tmp/diff_new_pack.4UhtJj/_old 2021-04-12 17:10:35.734580324 +0200
+++ /var/tmp/diff_new_pack.4UhtJj/_new 2021-04-12 17:10:35.734580324 +0200
@@ -18,7 +18,7 @@
%define cpan_name JSON-Validator
Name: perl-JSON-Validator
-Version: 4.14
+Version: 4.16
Release: 0
Summary: Validate data against a JSON schema
License: Artistic-2.0
@@ -33,9 +33,11 @@
BuildRequires: perl(Test::Deep)
BuildRequires: perl(Test::More) >= 1.30
BuildRequires: perl(YAML::PP) >= 0.020
+BuildRequires: perl(YAML::XS) >= 0.67
Requires: perl(List::Util) >= 1.45
Requires: perl(Mojolicious) >= 7.28
Requires: perl(YAML::PP) >= 0.020
+Requires: perl(YAML::XS) >= 0.67
%{perl_requires}
%description
++++++ JSON-Validator-4.14.tar.gz -> JSON-Validator-4.16.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/Changes
new/JSON-Validator-4.16/Changes
--- old/JSON-Validator-4.14/Changes 2021-02-23 06:58:07.000000000 +0100
+++ new/JSON-Validator-4.16/Changes 2021-03-24 00:57:46.000000000 +0100
@@ -1,5 +1,14 @@
Revision history for perl distribution JSON-Validator
+4.16 2021-03-24T08:57:46+0900
+ - Fix handling OpenAPIv2 "responses" $ref when bundling
+
+4.15 2021-03-24T07:57:58+0900
+ - Fix validating nullable inside anyOf for OpenAPIv3 #241
+ - Fix t/id-keyword-draft*.t test failures with Mojolicious 9.11 #242 #243
+ - Removed deprecated functions joi() and validate_json()
+ - Removed deprecated methods singleton() and version()
+
4.14 2021-02-23T14:58:07+0900
- Add routes() to Schema::OpenAPIv2 and OpenAPIv3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/META.json
new/JSON-Validator-4.16/META.json
--- old/JSON-Validator-4.14/META.json 2021-02-23 06:58:09.000000000 +0100
+++ new/JSON-Validator-4.16/META.json 2021-03-24 00:57:47.000000000 +0100
@@ -36,7 +36,7 @@
"requires" : {
"List::Util" : "1.45",
"Mojolicious" : "7.28",
- "YAML::PP" : "0.020",
+ "YAML::XS" : "0.67",
"perl" : "5.010001"
}
},
@@ -63,6 +63,6 @@
},
"x_IRC" : "irc://irc.freenode.net/#perl-openapi"
},
- "version" : "4.14",
+ "version" : "4.16",
"x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/META.yml
new/JSON-Validator-4.16/META.yml
--- old/JSON-Validator-4.14/META.yml 2021-02-23 06:58:08.000000000 +0100
+++ new/JSON-Validator-4.16/META.yml 2021-03-24 00:57:47.000000000 +0100
@@ -24,7 +24,7 @@
requires:
List::Util: '1.45'
Mojolicious: '7.28'
- YAML::PP: '0.020'
+ YAML::XS: '0.67'
perl: '5.010001'
resources:
IRC: irc://irc.freenode.net/#perl-openapi
@@ -32,5 +32,5 @@
homepage: https://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/mojolicious/json-validator.git
-version: '4.14'
+version: '4.16'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/JSON-Validator-4.14/lib/JSON/Validator/Schema/Draft4.pm
new/JSON-Validator-4.16/lib/JSON/Validator/Schema/Draft4.pm
--- old/JSON-Validator-4.14/lib/JSON/Validator/Schema/Draft4.pm 2020-10-14
01:23:11.000000000 +0200
+++ new/JSON-Validator-4.16/lib/JSON/Validator/Schema/Draft4.pm 2021-03-04
00:10:33.000000000 +0100
@@ -23,10 +23,6 @@
};
}
-sub _definitions_path_for_ref { ['definitions'] }
-
-sub _id_key {'id'}
-
sub _validate_number_max {
my ($self, $value, $path, $schema, $expected) = @_;
return unless defined(my $cmp_with = $schema->{maximum});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv2.pm
new/JSON-Validator-4.16/lib/JSON/Validator/Schema/OpenAPIv2.pm
--- old/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv2.pm
2021-02-23 06:57:46.000000000 +0100
+++ new/JSON-Validator-4.16/lib/JSON/Validator/Schema/OpenAPIv2.pm
2021-03-24 00:57:32.000000000 +0100
@@ -202,6 +202,12 @@
return $val->{value} = [split /,/, $val->{value}];
}
+sub _definitions_path_for_ref {
+ my ($self, $ref) = @_;
+ my $path = Mojo::Path->new($ref->fqn =~
m!^.*#/(definitions|parameters|responses/.+)$!)->to_dir->parts;
+ return $path->[0] ? $path : ['definitions'];
+}
+
sub _find_all_nodes {
my ($self, $pointer, $leaf) = @_;
my @found;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv3.pm
new/JSON-Validator-4.16/lib/JSON/Validator/Schema/OpenAPIv3.pm
--- old/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv3.pm
2021-02-23 06:02:51.000000000 +0100
+++ new/JSON-Validator-4.16/lib/JSON/Validator/Schema/OpenAPIv3.pm
2021-03-23 23:57:14.000000000 +0100
@@ -256,6 +256,21 @@
return;
}
+sub _validate_type_boolean {
+ my $self = shift;
+ return $_[2]->{nullable} && !defined $_[0] ? () :
$self->SUPER::_validate_type_boolean(@_);
+}
+
+sub _validate_type_integer {
+ my $self = shift;
+ return $_[2]->{nullable} && !defined $_[0] ? () :
$self->SUPER::_validate_type_integer(@_);
+}
+
+sub _validate_type_number {
+ my $self = shift;
+ return $_[2]->{nullable} && !defined $_[0] ? () :
$self->SUPER::_validate_type_number(@_);
+}
+
sub _validate_type_object {
my ($self, $data, $path, $schema) = @_;
return E $path, [object => type => data_type $data] if ref $data ne 'HASH';
@@ -272,15 +287,6 @@
return $self->_validate($data, $path, $self->get($url));
}
- my %properties = %{$schema->{properties} || {}};
- local $schema->{properties} = \%properties;
- for my $key (keys %properties) {
- next unless $properties{$key}{nullable};
- my $tied = tied %{$properties{$key}};
- $properties{$key} = $tied ? {%{$tied->schema}} : {%{$properties{$key}}};
- $properties{$key}{type} = ['null', _to_list($properties{$key}{type})];
- }
-
return $self->{validate_request}
? $self->_validate_type_object_request($_[1], $path, $schema)
: $self->_validate_type_object_response($_[1], $path, $schema);
@@ -326,6 +332,11 @@
);
}
+sub _validate_type_string {
+ my $self = shift;
+ return $_[2]->{nullable} && !defined $_[0] ? () :
$self->SUPER::_validate_type_string(@_);
+}
+
1;
=encoding utf8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/lib/JSON/Validator/Schema.pm
new/JSON-Validator-4.16/lib/JSON/Validator/Schema.pm
--- old/JSON-Validator-4.14/lib/JSON/Validator/Schema.pm 2021-01-24
05:50:55.000000000 +0100
+++ new/JSON-Validator-4.16/lib/JSON/Validator/Schema.pm 2021-03-23
23:24:31.000000000 +0100
@@ -54,6 +54,8 @@
return JSON::Validator::Util::schema_extract(shift->data, @_);
}
+sub load_and_validate_schema { Carp::confess('load_and_validate_schema(...) is
unsupported.') }
+
sub new {
return shift->SUPER::new(@_) if @_ % 2;
my ($class, $data) = (shift, shift);
@@ -73,17 +75,11 @@
return $self->_validate($_[1], '', $schema || $self->data);
}
-# Should not be called on JSON::Validator::Schema
-for my $method (qw(load_and_validate_schema schema singleton version)) {
- my $super = "JSON::Validator::$method";
- Mojo::Util::monkey_patch(__PACKAGE__,
- $method => sub {
- my $class = ref $_[0];
- carp "$class\::$method(...) is unsupported and will be removed.";
- shift->$super(@_);
- }
- );
-}
+sub schema { $_[0]->can('data') ? $_[0] : $_[0]->SUPER::schema }
+
+sub _definitions_path_for_ref { ['definitions'] }
+
+sub _id_key {'id'}
sub _register_root_schema {
my ($self, $id, $schema) = @_;
@@ -220,6 +216,10 @@
See L<Mojo::JSON::Pointer/get>.
+=head2 load_and_validate_schema
+
+This method will be removed in a future release.
+
=head2 new
my $schema = JSON::Validator::Schema->new($data);
@@ -239,6 +239,10 @@
If C<$data> is an C<$url> on contains "$ref" pointing to an URL, then these
schemas will be downloaded and resolved as well.
+=head2 schema
+
+This method will be removed in a future release.
+
=head2 validate
my @errors = $schema->validate($any);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/lib/JSON/Validator.pm
new/JSON-Validator-4.16/lib/JSON/Validator.pm
--- old/JSON-Validator-4.14/lib/JSON/Validator.pm 2021-02-23
06:58:07.000000000 +0100
+++ new/JSON-Validator-4.16/lib/JSON/Validator.pm 2021-03-24
00:57:46.000000000 +0100
@@ -16,7 +16,7 @@
use constant RECURSION_LIMIT => $ENV{JSON_VALIDATOR_RECURSION_LIMIT} || 100;
-our $VERSION = '4.14';
+our $VERSION = '4.16';
our @EXPORT_OK = qw(joi validate_json);
our %SCHEMAS = (
@@ -43,14 +43,6 @@
Mojo::Util::monkey_patch(__PACKAGE__, $method => sub {
shift->store->$method(@_) });
}
-sub version {
- my $self = shift;
- Mojo::Util::deprecated('version() will be removed in future version.');
- return $self->{version} || 4 unless @_;
- $self->{version} = shift;
- $self;
-}
-
sub bundle {
my ($self, $args) = @_;
my $cloner;
@@ -140,19 +132,10 @@
sub get { JSON::Validator::Util::schema_extract(shift->schema->data, shift) }
-sub joi {
- Mojo::Util::deprecated('JSON::Validator::joi() is replaced by
JSON::Validator::Joi::joi().');
- require JSON::Validator::Joi;
- return JSON::Validator::Joi->new unless @_;
- my ($data, $joi) = @_;
- return $joi->validate($data, $joi);
-}
-
sub load_and_validate_schema {
my ($self, $schema, $args) = @_;
- $self->{version} = $1 if !$self->{version} and ($args->{schema} ||
'draft-04') =~ m!draft-0+(\w+)!;
-
+ delete $self->{schema};
my $schema_obj = $self->_new_schema($schema, %$args);
confess join "\n", "Invalid JSON specification", (ref $schema eq 'HASH' ?
Mojo::Util::dumper($schema) : $schema),
map {"- $_"} @{$schema_obj->errors}
@@ -175,11 +158,6 @@
return $self;
}
-sub singleton {
- Mojo::Util::deprecated('singleton() will be removed in future version.');
- state $jv = shift->new;
-}
-
sub validate {
my ($self, $data, $schema) = @_;
$schema //= $self->schema->data;
@@ -192,11 +170,6 @@
return @errors;
}
-sub validate_json {
- Mojo::Util::deprecated('validate_json() will be removed in future version.');
- __PACKAGE__->singleton->schema($_[1])->validate($_[0]);
-}
-
sub _build_formats {
return {
'byte' => JSON::Validator::Formats->can('check_byte'),
@@ -308,7 +281,7 @@
}
}
-sub _id_key { ($_[0]->{version} || 4) < 7 ? 'id' : '$id' }
+sub _id_key { $_[0]->schema ? $_[0]->schema->_id_key : 'id' }
sub _new_schema {
my ($self, $source, %attrs) = @_;
@@ -324,15 +297,12 @@
my $store = $self->store;
my $schema = $loadable ? $store->get($store->load($source)) : $source;
- if (!$attrs{specification} and is_type $schema, 'HASH' and
$schema->{'$schema'}) {
- $attrs{specification} = $schema->{'$schema'};
- }
- if (!$attrs{specification} and $self->{version}) {
- $attrs{specification} = sprintf
'http://json-schema.org/draft-%02s/schema#', $self->{version};
- }
$attrs{formats} ||= $self->{formats} if $self->{formats};
- $attrs{version} ||= $self->{version} if $self->{version};
+ $attrs{specification} = $schema->{'$schema'}
+ if !$attrs{specification}
+ and is_type $schema, 'HASH'
+ and $schema->{'$schema'};
$attrs{store} = $store;
return $self->_schema_class($attrs{specification} || $schema)->new($source,
%attrs);
@@ -437,7 +407,7 @@
}
}
- my $schema_class = $spec && $SCHEMAS{$spec} || 'JSON::Validator::Schema';
+ my $schema_class = $spec && $SCHEMAS{$spec} ||
'JSON::Validator::Schema::Draft4';
$schema_class =~ s!^\+(.+)$!JSON::Validator::Schema::$1!;
confess "Could not load $schema_class: $@" unless $schema_class->can('new')
or eval "require $schema_class;1";
@@ -950,7 +920,7 @@
firstName => joi->string->required,
lastName => joi->string->required,
age => joi->integer->min(0),
- });
+ }),
);
=head1 DESCRIPTION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/t/backcompat.t
new/JSON-Validator-4.16/t/backcompat.t
--- old/JSON-Validator-4.14/t/backcompat.t 2020-10-13 05:31:27.000000000
+0200
+++ new/JSON-Validator-4.16/t/backcompat.t 2021-03-04 00:10:33.000000000
+0100
@@ -3,11 +3,9 @@
package JSON::Validator::L01;
use Mojo::Base 'JSON::Validator';
-has version => 42;
package main;
my $legacy = JSON::Validator::L01->new;
-is $legacy->version, 42;
my @errors = eval { $legacy->schema({properties => {foo => {type =>
'integer'}}})->validate({foo => '42'}); };
ok !$@, 'did not fail' or diag $@;
like "@errors", qr{Expected integer}, 'correct validation';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/t/id-keyword-draft4.t
new/JSON-Validator-4.16/t/id-keyword-draft4.t
--- old/JSON-Validator-4.14/t/id-keyword-draft4.t 2020-10-13
05:31:27.000000000 +0200
+++ new/JSON-Validator-4.16/t/id-keyword-draft4.t 2021-03-23
23:27:23.000000000 +0100
@@ -7,9 +7,9 @@
my ($base_url, $jv, $t, @e);
use Mojolicious::Lite;
-get '/invalid-fragment' => 'invalid-fragment';
-get '/invalid-relative' => 'invalid-relative';
-get '/relative-to-the-root' => 'relative-to-the-root';
+get '/invalid-fragment' => [format => ['json']] => 'invalid-fragment';
+get '/invalid-relative' => [format => ['json']] => 'invalid-relative';
+get '/relative-to-the-root' => [format => ['json']] => 'relative-to-the-root';
$t = Test::Mojo->new;
$jv = JSON::Validator->new(ua => $t->ua);
@@ -19,7 +19,6 @@
like $base_url, qr{^http}, 'got base_url to web server';
is $jv->_id_key, 'id', 'default id_key';
-delete $jv->{version};
eval { $jv->load_and_validate_schema("${base_url}relative-to-the-root.json") };
ok !$@, "${base_url}relative-to-the-root.json" or diag $@;
isa_ok $jv->schema, 'JSON::Validator::Schema::Draft4';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/t/id-keyword-draft7.t
new/JSON-Validator-4.16/t/id-keyword-draft7.t
--- old/JSON-Validator-4.14/t/id-keyword-draft7.t 2020-10-13
05:31:27.000000000 +0200
+++ new/JSON-Validator-4.16/t/id-keyword-draft7.t 2021-03-23
23:27:23.000000000 +0100
@@ -6,8 +6,8 @@
my ($base_url, $jv, $t, @e);
use Mojolicious::Lite;
-get '/person' => 'person';
-get '/invalid-relative' => 'invalid-relative';
+get '/person' => [format => ['json']] => 'person';
+get '/invalid-relative' => [format => ['json']] => 'invalid-relative';
$t = Test::Mojo->new;
$jv = JSON::Validator->new(ua => $t->ua);
@@ -20,7 +20,6 @@
ok !$@, "${base_url}schema.json" or diag $@;
isa_ok $jv->schema, 'JSON::Validator::Schema::Draft7';
-is $jv->{version}, 7, 'detected version from draft-07';
is $jv->schema->id, 'http://example.com/person.json',
'schema id';
is $jv->schema->moniker, 'draft07',
'moniker';
is $jv->schema->specification, 'http://json-schema.org/draft-07/schema#',
'schema specification';
@@ -33,7 +32,7 @@
__DATA__
@@ invalid-relative.json.ep
-{"$id": "whatever"}
+{"$id": "whatever", "$schema": "http://json-schema.org/draft-07/schema#"}
@@ person.json.ep
{
"$id": "http://example.com/person.json",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/JSON-Validator-4.14/t/openapiv3-nullable.t
new/JSON-Validator-4.16/t/openapiv3-nullable.t
--- old/JSON-Validator-4.14/t/openapiv3-nullable.t 2021-01-24
05:50:54.000000000 +0100
+++ new/JSON-Validator-4.16/t/openapiv3-nullable.t 2021-03-23
23:55:20.000000000 +0100
@@ -15,6 +15,11 @@
is "@errors", "", "$path - name is undef";
}
+$schema = JSON::Validator->new->schema('data://main/issue-241.json')->schema;
+$body = {exists => 1, value => {name => undef}};
+@errors = $schema->validate_response([get => '/test'], {body => \&body});
+is "@errors", "", "nullable inside oneOf";
+
done_testing;
sub body {$body}
@@ -64,3 +69,38 @@
}
}
}
+@@ issue-241.json
+{
+ "openapi": "3.0.0",
+ "info": { "title": "Nullable", "version": "" },
+ "paths": {
+ "/test": {
+ "get": {
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "oneOf": [
+ { "$ref": "#/components/schemas/name1" },
+ { "$ref": "#/components/schemas/name2" }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "name1": { "type": "string", "nullable": "true" },
+ "name2": { "type": "integer" } }
+ }
+}