diff --git a/lib/JSON/Validator/Schema/Draft201909.pm b/lib/JSON/Validator/Schema/Draft201909.pm index 427bc58f..ebb58b8d 100644 --- a/lib/JSON/Validator/Schema/Draft201909.pm +++ b/lib/JSON/Validator/Schema/Draft201909.pm @@ -71,7 +71,8 @@ sub _validate_type_array_contains { 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 --git a/t/draft2019-09-acceptance.t b/t/draft2019-09-acceptance.t index e4848f7d..28a467a8 100644 --- a/t/draft2019-09-acceptance.t +++ b/t/draft2019-09-acceptance.t @@ -11,6 +11,7 @@ push @todo_tests, ['', 'float and integers are equal up to 64-bit 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 --git a/t/draft4-acceptance.t b/t/draft4-acceptance.t index dd112104..08ccf47d 100644 --- a/t/draft4-acceptance.t +++ b/t/draft4-acceptance.t @@ -7,7 +7,8 @@ plan skip_all => 'TEST_ACCEPTANCE=1' unless $ENV{TEST_ACCEPTANCE}; 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 --git a/t/draft6-acceptance.t b/t/draft6-acceptance.t index 978aa7fe..c18b1bf6 100644 --- a/t/draft6-acceptance.t +++ b/t/draft6-acceptance.t @@ -9,6 +9,7 @@ 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, ['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 --git a/t/draft7-acceptance.t b/t/draft7-acceptance.t index 8d5e7b98..e7e6cd89 100644 --- a/t/draft7-acceptance.t +++ b/t/draft7-acceptance.t @@ -9,6 +9,7 @@ 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, ['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'];