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-11-25 23:05:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old)
 and      /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-JSON-Validator"

Thu Nov 25 23:05:48 2021 rev:37 rq:933808 version:5.03

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes  
2021-10-08 00:07:18.857881870 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.1895/perl-JSON-Validator.changes
        2021-11-25 23:06:10.969187383 +0100
@@ -1,0 +2,12 @@
+Sun Nov 21 03:10:27 UTC 2021 - Tina M??ller <timueller+p...@suse.de>
+
+- updated to 5.03
+   see /usr/share/doc/packages/perl-JSON-Validator/Changes
+
+  5.03 2021-11-20T13:32:42+0900
+   - Fix OpenAPIv3::add_default_response() will not overwrite nested $ref
+   - Fix finding "readOnly" and "writeOnly" inside nested $ref
+   - Fix joi required() with nested objects
+     Contributor: Tim Stallard
+
+-------------------------------------------------------------------

Old:
----
  JSON-Validator-5.02.tar.gz

New:
----
  JSON-Validator-5.03.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-JSON-Validator.spec ++++++
--- /var/tmp/diff_new_pack.2SdhE4/_old  2021-11-25 23:06:11.353186057 +0100
+++ /var/tmp/diff_new_pack.2SdhE4/_new  2021-11-25 23:06:11.357186043 +0100
@@ -18,7 +18,7 @@
 
 %define cpan_name JSON-Validator
 Name:           perl-JSON-Validator
-Version:        5.02
+Version:        5.03
 Release:        0
 Summary:        Validate data against a JSON schema
 License:        Artistic-2.0

++++++ JSON-Validator-5.02.tar.gz -> JSON-Validator-5.03.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/Changes 
new/JSON-Validator-5.03/Changes
--- old/JSON-Validator-5.02/Changes     2021-10-06 02:58:55.000000000 +0200
+++ new/JSON-Validator-5.03/Changes     2021-11-20 05:32:42.000000000 +0100
@@ -1,5 +1,11 @@
 Revision history for perl distribution JSON-Validator
 
+5.03 2021-11-20T13:32:42+0900
+ - Fix OpenAPIv3::add_default_response() will not overwrite nested $ref
+ - Fix finding "readOnly" and "writeOnly" inside nested $ref
+ - Fix joi required() with nested objects
+   Contributor: Tim Stallard
+
 5.02 2021-10-06T09:58:55+0900
  - Fix defaults for arrays with collectionFormat #263
    Contributor: Ilya Rassadin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/MANIFEST 
new/JSON-Validator-5.03/MANIFEST
--- old/JSON-Validator-5.02/MANIFEST    2021-10-06 02:58:56.000000000 +0200
+++ new/JSON-Validator-5.03/MANIFEST    2021-11-20 05:32:44.000000000 +0100
@@ -127,6 +127,7 @@
 't/spec/space bundle.json'
 t/spec/test-definitions-key.json
 t/spec/v2-petstore.json
+t/spec/v3-default-response-extra.yaml
 t/spec/v3-petstore.json
 t/spec/with-deep-mixed-ref.json
 t/spec/with-relative-ref.json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/META.json 
new/JSON-Validator-5.03/META.json
--- old/JSON-Validator-5.02/META.json   2021-10-06 02:58:56.000000000 +0200
+++ new/JSON-Validator-5.03/META.json   2021-11-20 05:32:43.000000000 +0100
@@ -63,6 +63,6 @@
       },
       "x_IRC" : "ircs://irc.libera.chat:6697/#perl-openapi"
    },
-   "version" : "5.02",
+   "version" : "5.03",
    "x_serialization_backend" : "JSON::PP version 4.06"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/META.yml 
new/JSON-Validator-5.03/META.yml
--- old/JSON-Validator-5.02/META.yml    2021-10-06 02:58:55.000000000 +0200
+++ new/JSON-Validator-5.03/META.yml    2021-11-20 05:32:43.000000000 +0100
@@ -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: '5.02'
+version: '5.03'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/lib/JSON/Validator/Joi.pm 
new/JSON-Validator-5.03/lib/JSON/Validator/Joi.pm
--- old/JSON-Validator-5.02/lib/JSON/Validator/Joi.pm   2021-06-18 
04:29:55.000000000 +0200
+++ new/JSON-Validator-5.03/lib/JSON/Validator/Joi.pm   2021-11-13 
01:37:39.000000000 +0100
@@ -57,7 +57,8 @@
     $clone->{items} = dclone($by->{items}) if $by->{items};
   }
   elsif ($self->type eq 'object') {
-    $clone->{required} = [uniq @{$clone->{required}}, @{$by->{required}}] if 
ref $by->{required} eq 'ARRAY';
+    $clone->{required_props} = [uniq @{$clone->{required_props}}, 
@{$by->{required_props}}]
+      if defined $by->{required_props};
     $clone->{properties}{$_} = dclone($by->{properties}{$_}) for keys 
%{$by->{properties} || {}};
   }
 
@@ -82,7 +83,7 @@
   my %properties = ref $_[0] ? %{$_[0]} : @_;
 
   while (my ($name, $property) = each %properties) {
-    push @{$self->{required}}, $name if $property->{required};
+    push @{$self->{required_props}}, $name if $property->{required};
     $self->{properties}{$name} = $property->compile;
   }
 
@@ -140,12 +141,12 @@
   my $self = shift;
   my $json = {type => $self->type};
 
-  $json->{additionalProperties} = false               if $self->{strict};
-  $json->{maxProperties}        = $self->{max}        if defined $self->{max};
-  $json->{minProperties}        = $self->{min}        if defined $self->{min};
-  $json->{patternProperties}    = $self->{regex}      if $self->{regex};
-  $json->{properties}           = $self->{properties} if ref 
$self->{properties} eq 'HASH';
-  $json->{required}             = $self->{required}   if ref $self->{required} 
eq 'ARRAY';
+  $json->{additionalProperties} = false                   if $self->{strict};
+  $json->{maxProperties}        = $self->{max}            if defined 
$self->{max};
+  $json->{minProperties}        = $self->{min}            if defined 
$self->{min};
+  $json->{patternProperties}    = $self->{regex}          if $self->{regex};
+  $json->{properties}           = $self->{properties}     if ref 
$self->{properties} eq 'HASH';
+  $json->{required}             = $self->{required_props} if defined 
$self->{required_props};
 
   return $json;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/JSON-Validator-5.02/lib/JSON/Validator/Schema/Draft201909.pm 
new/JSON-Validator-5.03/lib/JSON/Validator/Schema/Draft201909.pm
--- old/JSON-Validator-5.02/lib/JSON/Validator/Schema/Draft201909.pm    
2021-10-03 23:34:02.000000000 +0200
+++ new/JSON-Validator-5.03/lib/JSON/Validator/Schema/Draft201909.pm    
2021-11-20 04:35:56.000000000 +0100
@@ -71,7 +71,8 @@
   my ($self, $data, $state) = @_;
   my ($path, $schema) = @$state{qw(path schema)};
   return unless exists $schema->{contains};
-  return if defined $schema->{minContains} and $schema->{minContains} == 0;
+  return if defined $schema->{minContains} and $schema->{minContains} == 0 and 
!$schema->{maxContains};
+  return if defined $schema->{minContains} and $schema->{minContains} == 0 and 
!@$data;
 
   my ($n_valid, @e, @errors) = (0);
   for my $i (0 .. @$data - 1) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/JSON-Validator-5.02/lib/JSON/Validator/Schema/OpenAPIv2.pm 
new/JSON-Validator-5.03/lib/JSON/Validator/Schema/OpenAPIv2.pm
--- old/JSON-Validator-5.02/lib/JSON/Validator/Schema/OpenAPIv2.pm      
2021-10-06 01:22:35.000000000 +0200
+++ new/JSON-Validator-5.03/lib/JSON/Validator/Schema/OpenAPIv2.pm      
2021-11-20 05:07:39.000000000 +0100
@@ -373,7 +373,7 @@
 
   my (@errors, %ro);
   for my $name (keys %{$schema->{properties} || {}}) {
-    next unless $schema->{properties}{$name}{readOnly};
+    next unless $self->_get(['readOnly'], {path => [], schema => 
$schema->{properties}{$name}});
     push @errors, E [@$path, $name], "Read-only." if exists $data->{$name};
     $ro{$name} = 1;
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/JSON-Validator-5.02/lib/JSON/Validator/Schema/OpenAPIv3.pm 
new/JSON-Validator-5.03/lib/JSON/Validator/Schema/OpenAPIv3.pm
--- old/JSON-Validator-5.02/lib/JSON/Validator/Schema/OpenAPIv3.pm      
2021-10-06 02:56:19.000000000 +0200
+++ new/JSON-Validator-5.03/lib/JSON/Validator/Schema/OpenAPIv3.pm      
2021-11-20 05:31:13.000000000 +0100
@@ -32,8 +32,9 @@
   for my $route ($self->routes->each) {
     my $op = $self->get([paths => @$route{qw(path method)}]);
     for my $status (@{$params->{status}}) {
-      $op->{responses}{$status}{description} //= $params->{description};
+      next if $self->get(['paths', @$route{qw(path method)}, 'responses', 
$status]);
       $op->{responses}{$status}{content}{'application/json'} //= {schema => 
$ref};
+      $op->{responses}{$status}{description} //= $params->{description};
     }
   }
 
@@ -185,7 +186,7 @@
   my $explode = $param->{explode} // (grep { $style eq $_ } qw(cookie query)) 
? 1 : 0;
 
   if ($explode) {
-    return if $style eq 'form';
+    return $self->_coerce_parameter_style_object_form($val, $param) if $style 
eq 'form';
     state $style_re = {label => qr{\.}, matrix => qr{;}, simple => qr{,}};
     return unless my $re = $style_re->{$style};
     return if $style eq 'matrix' && $val->{value} !~ s/^;//;
@@ -241,6 +242,16 @@
   return $val->{exists} = 0;
 }
 
+sub _coerce_parameter_style_object_form {
+  my ($self, $val, $param) = @_;
+  return unless my $properties = $param->{schema} && 
$param->{schema}{properties};
+
+  for my $k (keys %{$val->{value}}) {
+    next unless my $type = $properties->{$k} && $properties->{$k}{type};
+    $val->{value}{$k} = [$val->{value}{$k}] if $type eq 'array' and ref 
$val->{value}{$k} ne 'ARRAY';
+  }
+}
+
 sub _get_parameter_value {
   my ($self, $param, $get) = @_;
   my $schema_type = schema_type $param->{schema};
@@ -345,7 +356,7 @@
 
   my (@errors, %ro);
   for my $name (keys %{$schema->{properties} || {}}) {
-    next unless $schema->{properties}{$name}{readOnly};
+    next unless $self->_get(['readOnly'], {path => [], schema => 
$schema->{properties}{$name}});
     push @errors, E [@$path, $name], "Read-only." if exists $data->{$name};
     $ro{$name} = 1;
   }
@@ -366,7 +377,7 @@
 
   my (@errors, %rw);
   for my $name (keys %{$schema->{properties} || {}}) {
-    next unless $schema->{properties}{$name}{writeOnly};
+    next unless $self->_get(['writeOnly'], {path => [], schema => 
$schema->{properties}{$name}});
     push @errors, E [@$path, $name], "Write-only." if exists $data->{$name};
     $rw{$name} = 1;
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/lib/JSON/Validator.pm 
new/JSON-Validator-5.03/lib/JSON/Validator.pm
--- old/JSON-Validator-5.02/lib/JSON/Validator.pm       2021-10-06 
02:58:55.000000000 +0200
+++ new/JSON-Validator-5.03/lib/JSON/Validator.pm       2021-11-20 
05:32:42.000000000 +0100
@@ -7,7 +7,7 @@
 use Mojo::Util qw(sha1_sum);
 use Scalar::Util qw(blessed);
 
-our $VERSION = '5.02';
+our $VERSION = '5.03';
 
 our %SCHEMAS = (
   'http://json-schema.org/draft-04/schema#'             => '+Draft4',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/draft2019-09-acceptance.t 
new/JSON-Validator-5.03/t/draft2019-09-acceptance.t
--- old/JSON-Validator-5.02/t/draft2019-09-acceptance.t 2021-07-20 
15:22:40.000000000 +0200
+++ new/JSON-Validator-5.03/t/draft2019-09-acceptance.t 2021-11-20 
04:35:56.000000000 +0100
@@ -11,6 +11,7 @@
 push @todo_tests, ['defs.json',      'invalid definition'];
 push @todo_tests, ['defs.json',      'validate definition against metaschema'];
 push @todo_tests, ['id.json',        '$id inside an enum is not a real 
identifier'];
+push @todo_tests, ['ref.json',       '$ref prevents a sibling $id from 
changing the base uri'];
 push @todo_tests, ['ref.json',       'ref creates new scope when adjacent to 
keywords'];
 push @todo_tests, ['ref.json',       'remote ref, containing refs itself', 
'remote ref invalid'];
 push @todo_tests, ['ref.json',       'refs with relative uris and defs'];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/draft4-acceptance.t 
new/JSON-Validator-5.03/t/draft4-acceptance.t
--- old/JSON-Validator-5.02/t/draft4-acceptance.t       2021-07-20 
00:30:56.000000000 +0200
+++ new/JSON-Validator-5.03/t/draft4-acceptance.t       2021-11-20 
04:28:07.000000000 +0100
@@ -7,7 +7,8 @@
 delete $ENV{TEST_ACCEPTANCE} if $ENV{TEST_ACCEPTANCE} eq '1';
 
 my @todo_tests;
-push @todo_tests, ['id.json', 'id inside an enum is not a real identifier'];
+push @todo_tests, ['id.json',  'id inside an enum is not a real identifier'];
+push @todo_tests, ['ref.json', '$ref prevents a sibling id from changing the 
base uri'];
 
 t::Helper->acceptance('JSON::Validator::Schema::Draft4', todo_tests => 
\@todo_tests);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/draft6-acceptance.t 
new/JSON-Validator-5.03/t/draft6-acceptance.t
--- old/JSON-Validator-5.02/t/draft6-acceptance.t       2021-07-20 
00:32:23.000000000 +0200
+++ new/JSON-Validator-5.03/t/draft6-acceptance.t       2021-11-20 
04:35:57.000000000 +0100
@@ -9,6 +9,7 @@
 my @todo_tests;
 push @todo_tests, ['id.json',             'id inside an enum is not a real 
identifier'];
 push @todo_tests, ['const.json',          'float and integers are equal up to 
64-bit representation limits'];
+push @todo_tests, ['ref.json',            '$ref prevents a sibling $id from 
changing the base uri'];
 push @todo_tests, ['refRemote.json',      'remote ref with ref to 
definitions'];
 push @todo_tests, ['unknownKeyword.json', '$id inside an unknown keyword is 
not a real identifier'];
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/draft7-acceptance.t 
new/JSON-Validator-5.03/t/draft7-acceptance.t
--- old/JSON-Validator-5.02/t/draft7-acceptance.t       2021-06-18 
04:29:53.000000000 +0200
+++ new/JSON-Validator-5.03/t/draft7-acceptance.t       2021-11-20 
04:35:57.000000000 +0100
@@ -9,6 +9,7 @@
 my @todo_tests;
 push @todo_tests, ['id.json',             'id inside an enum is not a real 
identifier'];
 push @todo_tests, ['const.json',          'float and integers are equal up to 
64-bit representation limits'];
+push @todo_tests, ['ref.json',            '$ref prevents a sibling $id from 
changing the base uri'];
 push @todo_tests, ['refRemote.json',      'remote ref with ref to 
definitions'];
 push @todo_tests, ['unknownKeyword.json', '$id inside an unknown keyword is 
not a real identifier'];
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/get.t 
new/JSON-Validator-5.03/t/get.t
--- old/JSON-Validator-5.02/t/get.t     2021-10-06 01:22:35.000000000 +0200
+++ new/JSON-Validator-5.03/t/get.t     2021-11-20 03:20:57.000000000 +0100
@@ -6,7 +6,7 @@
 
 subtest 'setup' => sub {
   $jv = JSON::Validator::Schema::Draft201909->new({
-    '$defs'    => {z1 => {'$ref' => '#/$defs/z2'}, z2 => {type => 'string'}},
+    '$defs'    => {z1 => {'$ref' => '#/$defs/z2', minLength => 1}, z2 => {type 
=> 'string'}},
     properties => {
       bar    => {items => [{properties => {y => {'$ref' => '#/$defs/z1'}, x => 
{type => 'integer'}}}]},
       foo    => {items => [{properties => {y => {type   => 'string'}}}]},
@@ -34,7 +34,8 @@
 };
 
 subtest '$ref' => sub {
-  is_deeply $jv->get('/properties/bar/items/0/properties/y'), {type => 
'string'}, 'get /bar/items/0/properties/y';
+  is_deeply $jv->get('/properties/bar/items/0/properties/y'), {minLength => 1, 
type => 'string'},
+    'get /bar/items/0/properties/y';
   is $jv->get('/properties/bar/items/0/properties/y/$ref'), '#/$defs/z1', 'get 
/bar/items/0/properties/y/$ref';
   is_deeply $jv->get('/properties/bar/items/0/properties'), {y => {'$ref' => 
'#/$defs/z1'}, x => {type => 'integer'}},
     'get /bar/items/0/properties';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/joi.t 
new/JSON-Validator-5.03/t/joi.t
--- old/JSON-Validator-5.02/t/joi.t     2021-06-18 04:29:55.000000000 +0200
+++ new/JSON-Validator-5.03/t/joi.t     2021-11-13 01:37:39.000000000 +0100
@@ -87,6 +87,16 @@
   );
 }
 
+note "can omit non-required objects containing required properties";
+joi_ok({}, joi->object->props(a => joi->object->props(b => 
joi->integer->required)));
+
+note "must include required objects containing required properties";
+joi_ok(
+  {},
+  joi->object->props(a => joi->object->required->props(b => 
joi->integer->required)),
+  E('/a', 'Missing property.'),
+);
+
 eval { joi->number->extend(joi->integer) };
 like $@, qr{Cannot extend joi 'number' by 'integer'}, 'need to extend same 
type';
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/openapiv2-readonly.t 
new/JSON-Validator-5.03/t/openapiv2-readonly.t
--- old/JSON-Validator-5.02/t/openapiv2-readonly.t      2021-06-18 
04:29:53.000000000 +0200
+++ new/JSON-Validator-5.03/t/openapiv2-readonly.t      2021-11-20 
03:04:57.000000000 +0100
@@ -31,20 +31,24 @@
     "/user": {
       "post": {
         "parameters": [
-          {"name":"body", "in":"body", "schema": { "$ref": 
"#/definitions/User" }}
+          {"name":"body", "in":"body", "schema": {"$ref": 
"#/definitions/User"}}
         ],
         "responses": {
-          "200": { "description": "ok", "schema": { "$ref": 
"#/definitions/User" } }
+          "200": { "description": "ok", "schema": {"$ref": 
"#/definitions/User"}}
         }
       }
     }
   },
   "definitions": {
+    "age": {
+      "type": "integer",
+      "readOnly": true
+    },
     "User": {
       "type": "object",
       "required": ["age"],
       "properties": {
-        "age": {"type": "integer", "readOnly": true}
+        "age": {"$ref": "#/definitions/age"}
       }
     }
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/openapiv3-basic.t 
new/JSON-Validator-5.03/t/openapiv3-basic.t
--- old/JSON-Validator-5.02/t/openapiv3-basic.t 2021-10-02 03:11:50.000000000 
+0200
+++ new/JSON-Validator-5.03/t/openapiv3-basic.t 2021-11-20 04:23:26.000000000 
+0100
@@ -30,15 +30,15 @@
 };
 
 subtest base_url => sub {
-  is $schema->base_url, 'http://petstore.swagger.io/v1', 'get';
-  is $schema->base_url('https://api.example.com:8080/api'), $schema, 'set url';
-  is $schema->get('/servers/0/url'), 'https://api.example.com:8080/api', 
'servers changed';
+  is $schema->base_url,                                     
'http://petstore.swagger.io/v1',    'get';
+  is $schema->base_url('https://api.example.com:8080/api'), $schema,           
                 'set url';
+  is $schema->get('/servers/0/url'),                        
'https://api.example.com:8080/api', 'servers changed';
 
-  is $schema->base_url(Mojo::URL->new('//api2.example.com')), $schema, 'set 
without scheme';
-  is $schema->get('/servers/0/url'), 'https://api2.example.com', 'servers 
changed';
+  is $schema->base_url(Mojo::URL->new('//api2.example.com')), $schema,         
           'set without scheme';
+  is $schema->get('/servers/0/url'),                          
'https://api2.example.com', 'servers changed';
 
-  is $schema->base_url(Mojo::URL->new('/v1')), $schema, 'set path';
-  is $schema->base_url->to_string, 'https://api2.example.com/v1', 'get';
+  is $schema->base_url(Mojo::URL->new('/v1')), $schema,                       
'set path';
+  is $schema->base_url->to_string,             'https://api2.example.com/v1', 
'get';
 };
 
 subtest 'parameters_for_request' => sub {
@@ -143,8 +143,8 @@
 };
 
 subtest add_default_response => sub {
-  $schema = JSON::Validator->new->schema($cwd->child(qw(spec 
v3-petstore.json)))->schema;
-  ok !$schema->get('/components/schemas/DefaultResponse'), 'default response 
missing';
+  my $schema = JSON::Validator->new->schema($cwd->child(qw(spec 
v3-petstore.json)))->schema;
+  ok !$schema->get('/components/schemas/DefaultResponse'),          'default 
response missing';
   ok !$schema->get([paths => '/petss', 'get', 'responses', '400']), 'default 
response missing for 400';
   $schema->add_default_response;
   ok $schema->get('/components/schemas/DefaultResponse'), 'default response 
added';
@@ -157,10 +157,20 @@
   is_deeply $schema->errors, [], 'errors';
 };
 
+subtest 'add_default_response do not overwrite $ref' => sub {
+  my $schema = JSON::Validator->new->schema($cwd->child(qw(spec 
v3-default-response-extra.yaml)))->schema;
+  $schema->add_default_response;
+  is $schema->get([qw(paths /item/{id} get summary)]), 'get a single item', 
'summary';
+  is $schema->get([qw(paths /item/{id} get responses 200 content 
application/json schema type)]), 'object',
+    'responses 200';
+  is $schema->get([qw(paths /item/{id} get responses 404 description)]), 
'Custom 404', 'responses 404';
+  is $schema->get([qw(paths /item/{id} get responses 500 description)]), 
'Custom 500', 'responses 500';
+};
+
 subtest 'v3.1.x' => sub {
   my $schema = JSON::Validator->new->schema({openapi => '3.1.0', paths => 
{}})->schema;
-  is $schema->specification, 
'https://spec.openapis.org/oas/3.1/schema/2021-05-20', 'specification';
-  is join(', ', @{$schema->errors}), '/info: Missing property.', 'errors';
+  is $schema->specification,         
'https://spec.openapis.org/oas/3.1/schema/2021-05-20', 'specification';
+  is join(', ', @{$schema->errors}), '/info: Missing property.',               
             'errors';
 };
 
 subtest 'coerce defaults' => sub {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-5.02/t/openapiv3-style-explode.t 
new/JSON-Validator-5.03/t/openapiv3-style-explode.t
--- old/JSON-Validator-5.02/t/openapiv3-style-explode.t 2021-10-02 
03:12:54.000000000 +0200
+++ new/JSON-Validator-5.03/t/openapiv3-style-explode.t 2021-11-20 
05:31:13.000000000 +0100
@@ -56,12 +56,12 @@
 test(
   'get /object/query',
   [{}, {}, ''],
-  [{query => {ff => ''}},                 {all => {ff => ''},                 
ff => {}}],
-  [{query => {pf => ''}},                 {all => {pf => ''},                 
pf => {}}],
-  [{query => {sf => ''}},                 {all => {sf => ''},                 
sf => {}}],
-  [{query => {ff => 'name,birdy,age,1'}}, {all => {ff => 'name,birdy,age,1'}, 
ff => {age => 1, name => 'birdy'}}],
-  [{query => {pf => 'name|birdy|age|2'}}, {all => {pf => 'name|birdy|age|2'}, 
pf => {age => 2, name => 'birdy'}}],
-  [{query => {sf => 'name birdy age 3'}}, {all => {sf => 'name birdy age 3'}, 
sf => {age => 3, name => 'birdy'}}],
+  [{query => {ff => ''}},                 {all => {ff => ['']},                
 ff => {}}],
+  [{query => {pf => ''}},                 {all => {pf => ''},                  
 pf => {}}],
+  [{query => {sf => ''}},                 {all => {sf => ''},                  
 sf => {}}],
+  [{query => {ff => 'name,birdy,age,1'}}, {all => {ff => 
['name,birdy,age,1']}, ff => {age => 1, name => 'birdy'}}],
+  [{query => {pf => 'name|birdy|age|2'}}, {all => {pf => 'name|birdy|age|2'},  
 pf => {age => 2, name => 'birdy'}}],
+  [{query => {sf => 'name birdy age 3'}}, {all => {sf => 'name birdy age 3'},  
 sf => {age => 3, name => 'birdy'}}],
 );
 
 test(
@@ -308,7 +308,12 @@
             "in": "query",
             "style": "form",
             "explode": true,
-            "schema": { "type": "object" }
+            "schema": {
+              "type": "object",
+              "properties": {
+                "ff": {"type": "array", "items": {"type": "string"}}
+              }
+            }
           },
           {
             "name": "sf",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/JSON-Validator-5.02/t/spec/v3-default-response-extra.yaml 
new/JSON-Validator-5.03/t/spec/v3-default-response-extra.yaml
--- old/JSON-Validator-5.02/t/spec/v3-default-response-extra.yaml       
1970-01-01 01:00:00.000000000 +0100
+++ new/JSON-Validator-5.03/t/spec/v3-default-response-extra.yaml       
2021-11-20 03:34:08.000000000 +0100
@@ -0,0 +1,50 @@
+openapi: 3.0.0
+info:
+  title: v3-default-response-extra
+  version: 0.0.1
+components:
+  schemas:
+    base:
+      type: object
+      required: [status, reason]
+      properties:
+        status:
+          type: integer
+        reason:
+          type: string
+    not_found:
+      type: object
+      allOf:
+        - $ref: '#/components/schemas/base'
+    exception:
+      type: object
+      allOf:
+        - $ref: '#/components/schemas/base'
+  responses:
+    '404':
+      description: Custom 404
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/not_found'
+paths:
+  /item/{id}:
+    get:
+      summary: get a single item
+      description: get a single item from the database
+      x-mojo-name: item
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/base'
+        '404':
+          $ref: '#/components/responses/404'
+        '500':
+          description: Custom 500
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/exception'

Reply via email to