Branch Coverage

blib/lib/JSON/Schema/Modern/Vocabulary/Applicator.pm
Criterion Covered Total %
branch 214 220 97.2


line true false branch
48 138 33 !($spec_version =~ /^draft[46]\z/u) ? :
64 107 $spec_version =~ /^draft[467]\z/u ? :
107 64 !($spec_version =~ /^draft[467]\z/u) ? :
69 102 !($spec_version =~ /^draft(?:[467]|2019-09)\z/u) ? :
102 69 $spec_version =~ /^draft(?:[467]|2019-09)\z/u ? :
151 20 $spec_version ne 'draft4' ? :
151 20 $spec_version ne 'draft4' ? :
38 133 $spec_version eq 'draft2019-09' ? :
79 2031 514 if ($class->eval($data, $$schema{'allOf'}[$idx], {%$state, 'keyword_path', $$state{'keyword_path'} . '/allOf/' . $idx})) { }
84 203 311 if $$state{"short_circuit"}
88 623 456 if @invalid == 0
91 47 409 $pl ? :
47 409 $pl ? :
101 798 570 unless $class->eval($data, $$schema{"anyOf"}[$idx], {%$state, "errors", \@errors, "keyword_path", $$state{"keyword_path"} . '/anyOf/' . $idx})
103 177 393 if $$state{"short_circuit"} and not $$state{"collect_annotations"}
106 493 272 if $valid
117 801 611 unless $class->eval($data, $$schema{"oneOf"}[$idx], {%$state, "errors", \@errors, "keyword_path", $$state{"keyword_path"} . '/oneOf/' . $idx})
119 66 545 if @valid > 1 and $$state{"short_circuit"}
122 325 336 if @valid == 1
124 196 140 if (not @valid) { }
136 163 306 if is_type("boolean", $$schema{"not"})
139 76 230 unless $class->eval($data, $$schema{"not"}, {%$state, "keyword_path", $$state{"keyword_path"} . '/not', "short_circuit", 1, "collect_annotations", 0, "errors", []})
153 33 20 unless exists $$schema{"then"} or exists $$schema{"else"} or $$state{"collect_annotations"}
155 172 162 $class->eval($data, $$schema{'if'}, {%$state, 'keyword_path', $$state{'keyword_path'} . '/if', 'short_circuit', 1, 'errors', []}) ? :
158 78 256 unless exists $$schema{$keyword}
161 41 215 if is_type("boolean", $$schema{$keyword})
164 125 90 if $class->eval($data, $$schema{$keyword}, {%$state, "keyword_path", $$state{"keyword_path"} . '/' . $keyword})
171 106 222 unless is_type("object", $data)
175 134 138 unless exists $$data{$property}
177 34 104 if ($class->eval($data, $$schema{"dependentSchemas"}{$property}, {%$state, "keyword_path", jsonp($$state{"keyword_path"}, "dependentSchemas", $property)}))
183 49 55 if $$state{"short_circuit"}
186 104 118 unless $valid
191 0 315 unless assert_keyword_type($state, $schema, "object")
195 179 280 if (is_type('array', $$schema{'dependencies'}{$property})) { }
200 0 205 unless is_type("string", $$schema{"dependencies"}{$property}[$index])
204 0 179 unless is_elements_unique($$schema{"dependencies"}{$property})
207 0 179 if $$state{"specification_version"} eq "draft4" and not @{$$schema{"dependencies"}{$property}}
211 0 280 unless $class->traverse_property_schema($schema, $state, $property)
218 64 252 unless is_type("object", $data)
222 225 171 unless exists $$data{$property}
224 65 106 if (is_type('array', $$schema{'dependencies'}{$property})) { }
226 37 28 if (my(@missing) = grep((!exists($$data{$_})), @{$$schema{"dependencies"}{$property}}))
227 7 30 @missing > 1 ? :
233 24 82 if ($class->eval($data, $$schema{"dependencies"}{$property}, {%$state, "keyword_path", jsonp($$state{"keyword_path"}, "dependencies", $property)}))
239 38 44 if $$state{"short_circuit"}
243 118 134 unless $valid
253 938 789 if (ref $$schema{"items"} eq "ARRAY")
255 2 936 unless $$state{"specification_version"} =~ /^draft(?:[467]|2019-09)\z/u
264 985 970 if ref $$schema{"items"} eq "ARRAY"
272 45 353 unless exists $$state{"_last_items_index"}
278 185 1241 unless is_type("array", $data)
283 390 1877 if $idx > $$schema{$$state{"keyword"}}->$#*
286 339 1538 if (is_type('boolean', $$schema{$$state{'keyword'}}[$idx])) { }
1435 103 elsif ($class->eval($$data[$idx], $$schema{$$state{'keyword'}}[$idx], {%$state, 'data_path', $$state{'data_path'} . '/' . $idx, 'keyword_path', $$state{'keyword_path'} . '/' . $$state{'keyword'} . '/' . $idx, 'collect_annotations', $$state{'collect_annotations'} & 18446744073709551614})) { }
287 226 113 if $$schema{$$state{"keyword"}}[$idx]
302 73 0 $$state{'keyword'} eq 'items' ? :
36 73 $$state{'keyword'} eq 'prefixItems' ? :
89 127 if $$state{"short_circuit"} and not exists $$schema{$$state{"keyword"} eq "prefixItems" ? "items" : ($$state{"keyword"} eq "items" ? "additionalItems" : die())}
306 9 1232 if ($$state{"defaults"})
310 8 1 if $valid and ref $$schema{$$state{"keyword"}}[$idx] eq "HASH" and exists $$schema{$$state{"keyword"}}[$idx]{"default"}
315 684 407 $$state{'_last_items_index'} == $data->$#* ? :
1091 150 if exists $$state{"_last_items_index"}
316 211 1030 unless $valid
322 142 1181 unless is_type("array", $data)
323 369 812 if ($$state{"_last_items_index"} // -1) == $data->$#*
328 160 1176 if (is_type('boolean', $$schema{$$state{'keyword'}})) { }
329 40 120 if $$schema{$$state{"keyword"}}
332 67 53 exists $$schema{'prefixItems'} || $$state{'keyword'} eq 'additionalItems' ? :
335 813 358 if ($class->eval($$data[$idx], $$schema{$$state{"keyword"}}, {%$state, "data_path", $$state{"data_path"} . '/' . $idx, "keyword_path", $$state{"keyword_path"} . '/' . $$state{"keyword"}, "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
344 176 302 if $$state{"short_circuit"}
351 77 324 $$state{'keyword'} eq 'additionalItems' ? :
401 406 unless $valid
358 186 562 unless is_type("array", $data)
364 454 329 if ($class->eval($$data[$idx], $$schema{"contains"}, {%$state, "errors", \@errors, "data_path", $$state{"data_path"} . '/' . $idx, "keyword_path", $$state{"keyword_path"} . '/contains', "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
380 227 100 if $$state{"short_circuit"} and (exists $$schema{"maxContains"} and $$state{"_num_contains"} > $$schema{"maxContains"}) or not exists $$schema{"maxContains"} and !$$state{'collect_annotations'} || $$state{'specification_version'} ne 'draft2020-12' and $$state{"_num_contains"} >= ($$schema{"minContains"} // 1)
385 217 16 if (not $$state{"_num_contains"} and ($$schema{'minContains'} // 1) > 0 || $$state{'specification_version'} =~ /^draft[467]\z/u)
392 97 67 @valid == @$data ? :
164 181 unless $$state{"specification_version"} =~ /^draft(?:[467]|2019-09)\z/u
399 277 68 if (not $$state{"specification_version"} =~ /^draft[467]\z/u and grep(($_ eq "JSON::Schema::Modern::Vocabulary::Validation"), @{$$state{"vocabularies"}}))
402 12 24 $$schema{'maxContains'} != 1 ? :
36 241 if exists $$schema{"maxContains"} and $$state{"_num_contains"} > $$schema{"maxContains"}
404 28 249 if exists $$schema{"minContains"} and $$state{"_num_contains"} < $$schema{"minContains"}
413 280 3905 unless is_type("object", $data)
418 9 11101 if (not exists $$data{$property} and $$state{"defaults"})
422 7 1 if $valid and $$state{"defaults"} and ref $$schema{"properties"}{$property} eq "HASH" and exists $$schema{"properties"}{$property}{"default"}
427 8036 3065 unless exists $$data{$property}
430 431 2634 if (is_type('boolean', $$schema{'properties'}{$property})) { }
431 313 118 if $$schema{"properties"}{$property}
436 1886 742 if ($class->eval($$data{$property}, $$schema{"properties"}{$property}, {%$state, "data_path", jsonp($$state{"data_path"}, $property), "keyword_path", jsonp($$state{"keyword_path"}, "properties", $property), "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
445 399 461 if $$state{"short_circuit"}
449 818 3081 unless $valid
454 1 1076 unless $class->traverse_object_schemas($schema, $state)
461 188 815 unless is_type("object", $data)
468 360 401 if (is_type('boolean', $$schema{'patternProperties'}{$property_pattern})) { }
469 242 118 if $$schema{"patternProperties"}{$property_pattern}
474 260 141 if ($class->eval($$data{$property}, $$schema{"patternProperties"}{$property_pattern}, {%$state, "data_path", jsonp($$state{"data_path"}, $property), "keyword_path", jsonp($$state{"keyword_path"}, "patternProperties", $property_pattern), "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
483 120 139 if $$state{"short_circuit"}
488 235 580 unless $valid
495 250 897 unless is_type("object", $data)
500 211 762 if exists $$schema{"properties"} and exists $$schema{"properties"}{$property}
502 147 615 if exists $$schema{"patternProperties"} and CORE::any {$property =~ /(?:$_)/u;} keys %{$$schema{"patternProperties"}}
505 257 358 if (is_type('boolean', $$schema{'additionalProperties'})) { }
506 21 236 if $$schema{"additionalProperties"}
511 209 149 if ($class->eval($$data{$property}, $$schema{"additionalProperties"}, {%$state, "data_path", jsonp($$state{"data_path"}, $property), "keyword_path", $$state{"keyword_path"} . '/additionalProperties', "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
520 162 223 if $$state{"short_circuit"}
524 384 513 unless $valid
531 152 337 unless is_type("object", $data)
535 131 133 if ($class->eval($property, $$schema{"propertyNames"}, {%$state, "data_path", jsonp($$state{"data_path"}, $property), "keyword_path", $$state{"keyword_path"} . '/propertyNames', "collect_annotations", $$state{"collect_annotations"} & '18446744073709551614'}))
543 70 63 if $$state{"short_circuit"}
546 133 204 unless $valid