Branch Coverage

blib/lib/JSON/Schema/Modern/Vocabulary/Applicator.pm
Criterion Covered Total %
branch 187 194 96.3


line true false branch
45 19 73 $spec_version eq 'draft7' ? :
45 47 !($spec_version =~ qr/^draft(7|2019-09)$/u) ? :
47 45 $spec_version =~ qr/^draft(7|2019-09)$/u ? :
28 64 $spec_version eq 'draft2019-09' ? :
74 1739 443 if ($self->eval($data, $schema->{'allOf'}[$idx], {%$state, 'schema_path', $state->{'schema_path'} . '/allOf/' . $idx})) { }
79 159 284 if $state->{'short_circuit'}
83 502 392 if @invalid == 0
86 40 352 $pl ? :
40 352 $pl ? :
96 687 486 unless $self->eval($data, $schema->{'anyOf'}[$idx], {%$state, "errors", \@errors, "schema_path", $state->{'schema_path'} . "/anyOf/" . $idx})
98 150 336 if $state->{'short_circuit'}
101 425 223 if $valid
112 692 475 unless $self->eval($data, $schema->{'oneOf'}[$idx], {%$state, "errors", \@errors, "schema_path", $state->{'schema_path'} . "/oneOf/" . $idx})
114 27 84 if @valid > 1 and $state->{'short_circuit'}
117 256 264 if @valid == 1
119 156 108 if (not @valid) { }
132 50 103 unless $self->eval($data, $schema->{'not'}, {%$state, "schema_path", $state->{'schema_path'} . "/not", "short_circuit_suggested", 1, "collect_annotations", 0, "errors", []})
146 33 20 unless exists $schema->{'then'} or exists $schema->{'else'} or $state->{'collect_annotations'}
150 167 157 $self->eval($data, $schema->{'if'}, {%$state, 'schema_path', $state->{'schema_path'} . '/if', 'short_circuit_suggested', !$state->{'collect_annotations'}, 'errors', []}) ? :
154 66 258 unless exists $schema->{$keyword}
156 160 98 if $self->eval($data, $schema->{$keyword}, {%$state, "schema_path", $state->{'schema_path'} . "/" . $keyword})
163 128 197 unless is_type("object", $data)
167 102 121 unless exists $data->{$property}
169 18 103 if ($self->eval($data, $schema->{'dependentSchemas'}{$property}, {%$state, "schema_path", jsonp($state->{'schema_path'}, "dependentSchemas", $property)}))
175 47 56 if $state->{'short_circuit'}
178 103 94 unless $valid
183 0 182 unless assert_keyword_type($state, $schema, "object")
187 61 171 if (is_type('array', $schema->{'dependencies'}{$property})) { }
192 0 69 unless is_type("string", $schema->{'dependencies'}{$property}[$index])
196 0 61 unless is_elements_unique($schema->{'dependencies'}{$property})
200 0 171 unless $self->traverse_property_schema($schema, $state, $property)
207 61 121 unless is_type("object", $data)
211 86 81 unless exists $data->{$property}
213 23 58 if (is_type('array', $schema->{'dependencies'}{$property})) { }
215 13 10 if (my(@missing) = grep((!exists $data->{$_}), @{$$schema{"dependencies"}{$property}}))
216 3 10 @missing > 1 ? :
222 9 49 if ($self->eval($data, $schema->{'dependencies'}{$property}, {%$state, "schema_path", jsonp($state->{'schema_path'}, "dependencies", $property)}))
228 22 27 if $state->{'short_circuit'}
232 61 60 unless $valid
241 658 641 if (XXX)
243 2 656 unless $state->{'spec_version'} =~ /^draft(?:7|2019-09)$/u
252 690 770 if XXX
259 33 181 unless exists $state->{'_last_items_index'}
265 217 900 unless is_type("array", $data)
266 123 777 if ($state->{'_last_items_index'} // -1) == $#$data
271 286 1299 if $idx > $#{$$schema{$state->{'keyword'}}}
274 302 997 if (is_type('boolean', $$schema{$state->{'keyword'}}[$idx])) { }
922 75 elsif ($self->eval($data->[$idx], $$schema{$state->{'keyword'}}[$idx], {%$state, 'data_path', $state->{'data_path'} . '/' . $idx, 'schema_path', $state->{'schema_path'} . '/' . $state->{'keyword'} . '/' . $idx, 'collect_annotations', $state->{'collect_annotations'} & 18446744073709551614})) { }
275 191 111 if $$schema{$state->{'keyword'}}[$idx]
290 49 0 $state->{'keyword'} eq 'items' ? :
26 49 $state->{'keyword'} eq 'prefixItems' ? :
63 123 if $state->{'short_circuit'} and not exists $$schema{$state->{'keyword'} eq "prefixItems" ? "items" : ($state->{'keyword'} eq "items" ? "additionalItems" : die())}
294 487 290 $state->{'_last_items_index'} == $#$data ? :
295 183 594 unless $valid
301 156 795 unless is_type("array", $data)
302 242 553 if ($state->{'_last_items_index'} // -1) == $#$data
307 114 752 if (is_type('boolean', $$schema{$state->{'keyword'}})) { }
308 34 80 if $$schema{$state->{'keyword'}}
311 31 49 exists $schema->{'prefixItems'} || $state->{'keyword'} eq 'additionalItems' ? :
314 509 238 if ($self->eval($data->[$idx], $$schema{$state->{'keyword'}}, {%$state, "data_path", $state->{'data_path'} . "/" . $idx, "schema_path", $state->{'schema_path'} . "/" . $state->{'keyword'}, "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
323 115 203 if $state->{'short_circuit'}
330 36 237 $state->{'keyword'} eq 'additionalItems' ? :
273 275 unless $valid
337 217 506 unless is_type("array", $data)
343 411 275 if ($self->eval($data->[$idx], $schema->{'contains'}, {%$state, "errors", \@errors, "data_path", $state->{'data_path'} . "/" . $idx, "schema_path", $state->{'schema_path'} . "/contains", "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
353 105 60 if $state->{'short_circuit'} and !exists $schema->{'maxContains'} || $state->{'_num_contains'} > $schema->{'maxContains'} and $state->{'_num_contains'} >= ($schema->{'minContains'} // 1)
358 200 12 if (not $state->{'_num_contains'} and ($schema->{'minContains'} // 1) > 0 || $state->{'spec_version'} eq 'draft7')
364 91 51 @valid == @$data ? :
164 142 $state->{'spec_version'} =~ /^draft(?:7|2019-09)$/u ? :
371 271 3952 unless is_type("object", $data)
376 11740 2445 unless exists $data->{$property}
379 408 2037 if (is_type('boolean', $schema->{'properties'}{$property})) { }
380 294 114 if $schema->{'properties'}{$property}
385 1438 596 if ($self->eval($data->{$property}, $schema->{'properties'}{$property}, {%$state, "data_path", jsonp($state->{'data_path'}, $property), "schema_path", jsonp($state->{'schema_path'}, "properties", $property), "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
394 309 401 if $state->{'short_circuit'}
398 683 3266 unless $valid
403 0 842 unless assert_keyword_type($state, $schema, "object")
407 2 1301 unless assert_pattern({%$state, "_schema_path_suffix", $property}, $property)
408 0 1303 unless $self->traverse_property_schema($schema, $state, $property)
414 197 635 unless is_type("object", $data)
421 326 247 if (is_type('boolean', $schema->{'patternProperties'}{$property_pattern})) { }
422 214 112 if $schema->{'patternProperties'}{$property_pattern}
427 156 91 if ($self->eval($data->{$property}, $schema->{'patternProperties'}{$property_pattern}, {%$state, "data_path", jsonp($state->{'data_path'}, $property), "schema_path", jsonp($state->{'schema_path'}, "patternProperties", $property_pattern), "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
436 91 112 if $state->{'short_circuit'}
441 185 450 unless $valid
448 274 747 unless is_type("object", $data)
453 146 101 if exists $schema->{'properties'} and exists $schema->{'properties'}{$property}
455 89 539 if exists $schema->{'patternProperties'} and &any(sub {
458 197 342 if (is_type('boolean', $schema->{'additionalProperties'})) { }
459 17 180 if $schema->{'additionalProperties'}
464 185 157 if ($self->eval($data->{$property}, $schema->{'additionalProperties'}, {%$state, "data_path", jsonp($state->{'data_path'}, $property), "schema_path", $state->{'schema_path'} . "/additionalProperties", "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
473 140 197 if $state->{'short_circuit'}
477 336 411 unless $valid
484 179 251 unless is_type("object", $data)
488 73 109 if ($self->eval($property, $schema->{'propertyNames'}, {%$state, "data_path", jsonp($state->{'data_path'}, $property), "schema_path", $state->{'schema_path'} . "/propertyNames", "collect_annotations", $state->{'collect_annotations'} & '18446744073709551614'}))
496 56 53 if $state->{'short_circuit'}
499 109 142 unless $valid