Branch Coverage

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


line true false branch
45 17 73 $spec_version eq 'draft7' ? :
45 45 !($spec_version =~ qr/^draft(7|2019-09)$/u) ? :
45 45 $spec_version =~ qr/^draft(7|2019-09)$/u ? :
28 62 $spec_version eq 'draft2019-09' ? :
74 1727 431 if ($self->eval($data, $schema->{'allOf'}[$idx], {%$state, 'schema_path', $state->{'schema_path'} . '/allOf/' . $idx})) { }
79 153 278 if $state->{'short_circuit'}
83 490 380 if @invalid == 0
86 40 340 $pl ? :
40 340 $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 4 unless exists $schema->{'then'} or exists $schema->{'else'} or $state->{'collect_annotations'}
150 153 151 $self->eval($data, $schema->{'if'}, {%$state, 'schema_path', $state->{'schema_path'} . '/if', 'short_circuit_suggested', !$state->{'collect_annotations'}, 'errors', []}) ? :
154 50 254 unless exists $schema->{$keyword}
156 158 96 if $self->eval($data, $schema->{$keyword}, {%$state, "schema_path", $state->{'schema_path'} . "/" . $keyword})
163 128 181 unless is_type("object", $data)
167 94 113 unless exists $data->{$property}
169 18 95 if ($self->eval($data, $schema->{'dependentSchemas'}{$property}, {%$state, "schema_path", jsonp($state->{'schema_path'}, "dependentSchemas", $property)}))
175 43 52 if $state->{'short_circuit'}
178 95 86 unless $valid
183 0 174 unless assert_keyword_type($state, $schema, "object")
187 61 163 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 163 unless $self->traverse_property_schema($schema, $state, $property)
207 61 113 unless is_type("object", $data)
211 82 77 unless exists $data->{$property}
213 23 54 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 45 if ($self->eval($data, $schema->{'dependencies'}{$property}, {%$state, "schema_path", jsonp($state->{'schema_path'}, "dependencies", $property)}))
228 20 25 if $state->{'short_circuit'}
232 57 56 unless $valid
241 654 633 if (XXX)
243 2 652 unless $state->{'spec_version'} =~ /^draft(?:7|2019-09)$/u
252 686 762 if XXX
259 33 181 unless exists $state->{'_last_items_index'}
265 217 892 unless is_type("array", $data)
266 123 769 if ($state->{'_last_items_index'} // -1) == $#$data
271 286 1291 if $idx > $#{$$schema{$state->{'keyword'}}}
274 302 989 if (is_type('boolean', $$schema{$state->{'keyword'}}[$idx])) { }
918 71 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 119 if $state->{'short_circuit'} and not exists $$schema{$state->{'keyword'} eq "prefixItems" ? "items" : ($state->{'keyword'} eq "items" ? "additionalItems" : die())}
294 479 290 $state->{'_last_items_index'} == $#$data ? :
295 179 590 unless $valid
301 156 787 unless is_type("array", $data)
302 242 545 if ($state->{'_last_items_index'} // -1) == $#$data
307 114 744 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 505 234 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 113 201 if $state->{'short_circuit'}
330 36 233 $state->{'keyword'} eq 'additionalItems' ? :
269 271 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 3906 unless is_type("object", $data)
376 11722 2417 unless exists $data->{$property}
379 408 2009 if (is_type('boolean', $schema->{'properties'}{$property})) { }
380 294 114 if $schema->{'properties'}{$property}
385 1418 588 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 303 399 if $state->{'short_circuit'}
398 675 3228 unless $valid
403 0 834 unless assert_keyword_type($state, $schema, "object")
407 2 1293 unless assert_pattern({%$state, "_schema_path_suffix", $property}, $property)
408 0 1295 unless $self->traverse_property_schema($schema, $state, $property)
414 197 627 unless is_type("object", $data)
421 326 243 if (is_type('boolean', $schema->{'patternProperties'}{$property_pattern})) { }
422 214 112 if $schema->{'patternProperties'}{$property_pattern}
427 152 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 442 unless $valid
448 278 739 unless is_type("object", $data)
453 140 89 if exists $schema->{'properties'} and exists $schema->{'properties'}{$property}
455 89 531 if exists $schema->{'patternProperties'} and &any(sub {
458 185 346 if (is_type('boolean', $schema->{'additionalProperties'})) { }
459 17 168 if $schema->{'additionalProperties'}
464 187 159 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 135 192 if $state->{'short_circuit'}
477 326 413 unless $valid
484 179 255 unless is_type("object", $data)
488 75 111 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 58 53 if $state->{'short_circuit'}
499 111 144 unless $valid