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-02-25 18:28:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old) and /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON-Validator" Thu Feb 25 18:28:46 2021 rev:29 rq:874860 version:4.14 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes 2021-02-02 14:24:59.339328109 +0100 +++ /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.2378/perl-JSON-Validator.changes 2021-02-25 18:28:48.438233871 +0100 @@ -1,0 +2,9 @@ +Wed Feb 24 03:08:07 UTC 2021 - Tina M??ller <timueller+p...@suse.de> + +- updated to 4.14 + see /usr/share/doc/packages/perl-JSON-Validator/Changes + + 4.14 2021-02-23T14:58:07+0900 + - Add routes() to Schema::OpenAPIv2 and OpenAPIv3 + +------------------------------------------------------------------- Old: ---- JSON-Validator-4.13.tar.gz New: ---- JSON-Validator-4.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-JSON-Validator.spec ++++++ --- /var/tmp/diff_new_pack.XeFP0U/_old 2021-02-25 18:28:49.334234452 +0100 +++ /var/tmp/diff_new_pack.XeFP0U/_new 2021-02-25 18:28:49.338234455 +0100 @@ -18,7 +18,7 @@ %define cpan_name JSON-Validator Name: perl-JSON-Validator -Version: 4.13 +Version: 4.14 Release: 0 Summary: Validate data against a JSON schema License: Artistic-2.0 ++++++ JSON-Validator-4.13.tar.gz -> JSON-Validator-4.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/Changes new/JSON-Validator-4.14/Changes --- old/JSON-Validator-4.13/Changes 2021-01-28 10:22:43.000000000 +0100 +++ new/JSON-Validator-4.14/Changes 2021-02-23 06:58:07.000000000 +0100 @@ -1,5 +1,8 @@ Revision history for perl distribution JSON-Validator +4.14 2021-02-23T14:58:07+0900 + - Add routes() to Schema::OpenAPIv2 and OpenAPIv3 + 4.13 2021-01-28T18:22:43+0900 - Fix handling offset in RFC3339 date-time #236 - Add CLEAR method to JSON::Validator::Ref #237 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/META.json new/JSON-Validator-4.14/META.json --- old/JSON-Validator-4.13/META.json 2021-01-28 10:22:44.000000000 +0100 +++ new/JSON-Validator-4.14/META.json 2021-02-23 06:58:09.000000000 +0100 @@ -61,8 +61,8 @@ "url" : "https://github.com/mojolicious/json-validator.git", "web" : "https://github.com/mojolicious/json-validator" }, - "x_IRC" : "irc://irc.freenode.net/#mojo" + "x_IRC" : "irc://irc.freenode.net/#perl-openapi" }, - "version" : "4.13", + "version" : "4.14", "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/META.yml new/JSON-Validator-4.14/META.yml --- old/JSON-Validator-4.13/META.yml 2021-01-28 10:22:44.000000000 +0100 +++ new/JSON-Validator-4.14/META.yml 2021-02-23 06:58:08.000000000 +0100 @@ -27,10 +27,10 @@ YAML::PP: '0.020' perl: '5.010001' resources: - IRC: irc://irc.freenode.net/#mojo + IRC: irc://irc.freenode.net/#perl-openapi bugtracker: https://github.com/mojolicious/json-validator/issues homepage: https://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/mojolicious/json-validator.git -version: '4.13' +version: '4.14' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/Makefile.PL new/JSON-Validator-4.14/Makefile.PL --- old/JSON-Validator-4.13/Makefile.PL 2020-10-13 05:31:27.000000000 +0200 +++ new/JSON-Validator-4.14/Makefile.PL 2021-01-28 23:47:41.000000000 +0100 @@ -16,10 +16,10 @@ VERSION_FROM => 'lib/JSON/Validator.pm', META_MERGE => { 'dynamic_config' => 0, - 'meta-spec' => {version => 2}, - 'no_index' => {directory => ['examples', 't']}, - 'prereqs' => {runtime => {requires => {perl => '5.010001'}}}, - 'resources' => { + 'meta-spec' => {version => 2}, + 'no_index' => {directory => ['examples', 't']}, + 'prereqs' => {runtime => {requires => {perl => '5.010001'}}}, + 'resources' => { bugtracker => {web => 'https://github.com/mojolicious/json-validator/issues'}, homepage => 'https://mojolicious.org', license => ['http://www.opensource.org/licenses/artistic-license-2.0'], @@ -28,7 +28,7 @@ url => 'https://github.com/mojolicious/json-validator.git', web => 'https://github.com/mojolicious/json-validator', }, - x_IRC => 'irc://irc.freenode.net/#mojo', + x_IRC => 'irc://irc.freenode.net/#perl-openapi', }, }, PREREQ_PM => {'List::Util' => '1.45', 'Mojolicious' => '7.28', @PREREQ_YAML}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/lib/JSON/Validator/Schema/OpenAPIv2.pm new/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv2.pm --- old/JSON-Validator-4.13/lib/JSON/Validator/Schema/OpenAPIv2.pm 2021-01-24 05:50:55.000000000 +0100 +++ new/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv2.pm 2021-02-23 06:57:46.000000000 +0100 @@ -2,6 +2,9 @@ use Mojo::Base 'JSON::Validator::Schema::Draft4'; use JSON::Validator::Util qw(E data_type negotiate_content_type schema_type); +use Mojo::Collection; + +my $X_RE = qr{^x-}; has errors => sub { my $self = shift; @@ -95,6 +98,26 @@ return $self->{cache}{$cache_key} = \@parameters; } +sub routes { + my $self = shift; + + my @sorted_paths + = map { $_->[0] } + sort { $a->[1] <=> $b->[1] || length $a->[0] <=> length $b->[0] } + map { [$_, /\{/ ? 1 : 0] } grep { $_ !~ $X_RE } keys %{$self->get('/paths') || {}}; + + my @operations; + for my $path (@sorted_paths) { + next unless my $methods = $self->get([paths => $path]); + for my $method (sort keys %$methods) { + next if $method =~ $X_RE or $method eq 'parameters'; + push @operations, {method => $method, operation_id => $methods->{$method}{operationId}, path => $path}; + } + } + + return Mojo::Collection->new(@operations); +} + sub validate_request { my ($self, $method_path, $req) = @_; my $parameters = $self->parameters_for_request($method_path); @@ -431,6 +454,20 @@ The return value MUST not be mutated. +=head2 routes + + $collection = $schema->routes; + +Used to gather all available routes in the schema and return them sorted. The +result is a L<Mojo::Collection> object, where each item has a hash looking like +this: + + { + method => 'get', + path => '/user/{id}', + operation_id => 'getUser', # Might be undef() + } + =head2 validate_request @errors = $schema->validate_request([$method, $path], \%req); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/lib/JSON/Validator/Schema/OpenAPIv3.pm new/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv3.pm --- old/JSON-Validator-4.13/lib/JSON/Validator/Schema/OpenAPIv3.pm 2021-01-24 05:50:55.000000000 +0100 +++ new/JSON-Validator-4.14/lib/JSON/Validator/Schema/OpenAPIv3.pm 2021-02-23 06:02:51.000000000 +0100 @@ -13,8 +13,8 @@ # some methods are shared with OpenAPIv2 monkey_patch __PACKAGE__, $_ => JSON::Validator::Schema::OpenAPIv2->can($_) - for qw(coerce validate_request validate_response), - qw(_coerce_arrays _coerce_default_value _find_all_nodes _prefix_error_path), qw(_validate_request_or_response); + for qw(coerce routes validate_request validate_response), + qw(_coerce_arrays _coerce_default_value _find_all_nodes _prefix_error_path _validate_request_or_response); sub new { my $self = shift->SUPER::new(@_); @@ -409,6 +409,12 @@ The return value MUST not be mutated. +=head2 routes + + $collection = $schema->routes; + +Shares the same interface as L<JSON::Validator::Schema::OpenAPIv2/routes>. + =head2 validate_request @errors = $schema->validate_request([$method, $path], \%req); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/lib/JSON/Validator.pm new/JSON-Validator-4.14/lib/JSON/Validator.pm --- old/JSON-Validator-4.13/lib/JSON/Validator.pm 2021-01-28 10:22:43.000000000 +0100 +++ new/JSON-Validator-4.14/lib/JSON/Validator.pm 2021-02-23 06:58:07.000000000 +0100 @@ -16,7 +16,7 @@ use constant RECURSION_LIMIT => $ENV{JSON_VALIDATOR_RECURSION_LIMIT} || 100; -our $VERSION = '4.13'; +our $VERSION = '4.14'; our @EXPORT_OK = qw(joi validate_json); our %SCHEMAS = ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/t/jv-formats.t new/JSON-Validator-4.14/t/jv-formats.t --- old/JSON-Validator-4.13/t/jv-formats.t 2021-01-28 10:20:53.000000000 +0100 +++ new/JSON-Validator-4.14/t/jv-formats.t 2021-01-28 10:26:45.000000000 +0100 @@ -25,9 +25,12 @@ subtest 'date-time' => sub { local $schema->{properties}{v}{format} = 'date-time'; - validate_ok {v => $_}, $schema - for ('2017-03-29T23:02:55.831Z', '2017-03-29t23:02:55.01z', '2017-03-29 23:02:55-12:00', - '2016-02-29T23:02:55+05:00', '2006-01-02 15:04:05+23:59', '2006-01-02 15:04:05-23:59'); + validate_ok {v => $_}, + $schema + for ( + '2017-03-29T23:02:55.831Z', '2017-03-29t23:02:55.01z', '2017-03-29 23:02:55-12:00', + '2016-02-29T23:02:55+05:00', '2006-01-02 15:04:05+23:59', '2006-01-02 15:04:05-23:59' + ); validate_ok {v => "2017-03-29\t23:02:55-12:00"}, $schema, E('/v', 'Does not match date-time format.'); validate_ok {v => '2017-03-29T23:02:55+0:0'}, $schema, E('/v', 'Does not match date-time format.'); @@ -39,18 +42,18 @@ validate_ok {v => '2017-03-29T23:02:55-12'}, $schema, E('/v', 'Does not match date-time format.'); validate_ok {v => 'xxxx-xx-xxtxx:xx:xxz'}, $schema, E('/v', 'Does not match date-time format.'); - validate_ok {v => '2017-03-29T23:02:60Z'}, $schema, E('/v', 'Second out of range.'); - validate_ok {v => '2017-03-29T23:61:55Z'}, $schema, E('/v', 'Minute out of range.'); - validate_ok {v => '2017-03-29T24:02:55Z'}, $schema, E('/v', 'Hour out of range.'); - validate_ok {v => '2017-03-32T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); - validate_ok {v => '2017-02-29T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); - validate_ok {v => '2017-02-30T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); - validate_ok {v => '2017-03-00T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); - validate_ok {v => '2017-00-29T23:02:55Z'}, $schema, E('/v', 'Month out of range.'); - validate_ok {v => '2017-13-29T23:02:55Z'}, $schema, E('/v', 'Month out of range.'); + validate_ok {v => '2017-03-29T23:02:60Z'}, $schema, E('/v', 'Second out of range.'); + validate_ok {v => '2017-03-29T23:61:55Z'}, $schema, E('/v', 'Minute out of range.'); + validate_ok {v => '2017-03-29T24:02:55Z'}, $schema, E('/v', 'Hour out of range.'); + validate_ok {v => '2017-03-32T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); + validate_ok {v => '2017-02-29T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); + validate_ok {v => '2017-02-30T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); + validate_ok {v => '2017-03-00T23:02:55Z'}, $schema, E('/v', 'Day out of range.'); + validate_ok {v => '2017-00-29T23:02:55Z'}, $schema, E('/v', 'Month out of range.'); + validate_ok {v => '2017-13-29T23:02:55Z'}, $schema, E('/v', 'Month out of range.'); - validate_ok {v => '2017-03-29T23:02:55+23:60'}, $schema, E('/v', 'Time offset minute out of range.'); - validate_ok {v => '2017-03-29T23:02:55+24:00'}, $schema, E('/v', 'Time offset hour out of range.'); + validate_ok {v => '2017-03-29T23:02:55+23:60'}, $schema, E('/v', 'Time offset minute out of range.'); + validate_ok {v => '2017-03-29T23:02:55+24:00'}, $schema, E('/v', 'Time offset hour out of range.'); }; subtest 'double' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/t/openapiv2-basic.t new/JSON-Validator-4.14/t/openapiv2-basic.t --- old/JSON-Validator-4.13/t/openapiv2-basic.t 2021-01-28 01:30:45.000000000 +0100 +++ new/JSON-Validator-4.14/t/openapiv2-basic.t 2021-02-23 06:57:46.000000000 +0100 @@ -21,6 +21,16 @@ $schema = JSON::Validator->new->schema($cwd->child(qw(spec v2-petstore.json)))->schema->resolve; isa_ok $schema, 'JSON::Validator::Schema::OpenAPIv2'; + + is_deeply( + $schema->routes->to_array, + [ + {method => 'get', operation_id => 'listPets', path => '/pets'}, + {method => 'post', operation_id => 'createPets', path => '/pets'}, + {method => 'get', operation_id => 'showPetById', path => '/pets/{petId}'}, + ], + 'routes' + ); }; subtest 'validate schema' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-4.13/t/openapiv3-basic.t new/JSON-Validator-4.14/t/openapiv3-basic.t --- old/JSON-Validator-4.13/t/openapiv3-basic.t 2021-01-28 01:30:45.000000000 +0100 +++ new/JSON-Validator-4.14/t/openapiv3-basic.t 2021-02-23 06:57:46.000000000 +0100 @@ -17,6 +17,16 @@ @errors = @{JSON::Validator->new->schema({openapi => '3.0.0', paths => {}})->schema->errors}; is "@errors", '/info: Missing property.', 'invalid schema'; + + is_deeply( + $schema->routes->to_array, + [ + {method => 'get', operation_id => 'listPets', path => '/pets'}, + {method => 'post', operation_id => 'createPets', path => '/pets'}, + {method => 'get', operation_id => 'showPetById', path => '/pets/{petId}'}, + ], + 'routes' + ); }; subtest 'parameters_for_request' => sub {