Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/Applicator.pm |
Statements | Executed 1339973 statements in 3.52s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
94075 | 2 | 1 | 1.08s | 1.56s | keywords | JSON::Schema::Modern::Vocabulary::Applicator::
32492 | 1 | 1 | 857ms | 97.0s | _eval_keyword_properties (recurses: max depth 10, inclusive time 294s) | JSON::Schema::Modern::Vocabulary::Applicator::
6002 | 1 | 1 | 535ms | 71.3s | _eval_keyword_allOf (recurses: max depth 13, inclusive time 190s) | JSON::Schema::Modern::Vocabulary::Applicator::
197150 | 2 | 1 | 233ms | 233ms | CORE:regcomp (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
3616 | 1 | 1 | 220ms | 80.3s | _eval_keyword_patternProperties (recurses: max depth 3, inclusive time 105s) | JSON::Schema::Modern::Vocabulary::Applicator::
188150 | 1 | 1 | 162ms | 162ms | CORE:qr (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
197150 | 2 | 1 | 129ms | 129ms | CORE:match (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
3013 | 1 | 1 | 89.3ms | 72.7s | _eval_keyword_if (recurses: max depth 1, inclusive time 4.31s) | JSON::Schema::Modern::Vocabulary::Applicator::
977 | 1 | 1 | 82.9ms | 67.2s | _eval_keyword_additionalProperties (recurses: max depth 4, inclusive time 40.8s) | JSON::Schema::Modern::Vocabulary::Applicator::
37760 | 7 | 1 | 55.2ms | 55.2ms | CORE:sort (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
1758 | 1 | 1 | 52.5ms | 23.8s | _eval_keyword__items_schema (recurses: max depth 4, inclusive time 2.65s) | JSON::Schema::Modern::Vocabulary::Applicator::
1182 | 1 | 1 | 44.3ms | 3.16s | _eval_keyword_anyOf | JSON::Schema::Modern::Vocabulary::Applicator::
627 | 1 | 1 | 24.1ms | 496ms | _eval_keyword_propertyNames | JSON::Schema::Modern::Vocabulary::Applicator::
1758 | 1 | 1 | 12.5ms | 23.8s | _eval_keyword_items (recurses: max depth 4, inclusive time 2.66s) | JSON::Schema::Modern::Vocabulary::Applicator::
305 | 1 | 1 | 12.1ms | 324ms | _eval_keyword_oneOf | JSON::Schema::Modern::Vocabulary::Applicator::
305 | 1 | 1 | 8.75ms | 4.33s | _eval_keyword_dependentSchemas | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 2.06ms | 4.48ms | BEGIN@21 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 1.93ms | 2.12ms | BEGIN@19 | JSON::Schema::Modern::Vocabulary::Applicator::
387 | 1 | 1 | 1.40ms | 325ms | _traverse_keyword_properties (recurses: max depth 3, inclusive time 34.2ms) | JSON::Schema::Modern::Vocabulary::Applicator::
98 | 1 | 1 | 711µs | 97.2ms | _traverse_keyword_items (recurses: max depth 1, inclusive time 3.98ms) | JSON::Schema::Modern::Vocabulary::Applicator::
130 | 1 | 1 | 642µs | 32.1ms | _traverse_keyword_additionalProperties (recurses: max depth 1, inclusive time 7.30ms) | JSON::Schema::Modern::Vocabulary::Applicator::
65 | 1 | 1 | 280µs | 15.0ms | _traverse_keyword_if | JSON::Schema::Modern::Vocabulary::Applicator::
65 | 1 | 1 | 241µs | 19.5ms | _traverse_keyword_then | JSON::Schema::Modern::Vocabulary::Applicator::
32 | 1 | 1 | 143µs | 18.7ms | _traverse_keyword_anyOf (recurses: max depth 1, inclusive time 186µs) | JSON::Schema::Modern::Vocabulary::Applicator::
7 | 1 | 1 | 136µs | 1.82ms | _traverse_keyword_patternProperties | JSON::Schema::Modern::Vocabulary::Applicator::
23 | 1 | 1 | 124µs | 25.4ms | _traverse_keyword_allOf | JSON::Schema::Modern::Vocabulary::Applicator::
22 | 1 | 1 | 107µs | 15.9ms | _traverse_keyword_oneOf | JSON::Schema::Modern::Vocabulary::Applicator::
14 | 1 | 1 | 66µs | 3.63ms | _traverse_keyword_propertyNames | JSON::Schema::Modern::Vocabulary::Applicator::
14 | 1 | 1 | 58µs | 1.72ms | _traverse_keyword_not | JSON::Schema::Modern::Vocabulary::Applicator::
15 | 1 | 1 | 57µs | 3.69ms | _traverse_keyword_else | JSON::Schema::Modern::Vocabulary::Applicator::
4 | 1 | 1 | 56µs | 2.63ms | _eval_keyword_not | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 32µs | 36µs | BEGIN@1.306 | Module::Runtime::
1 | 1 | 1 | 22µs | 811µs | BEGIN@11 | JSON::Schema::Modern::Vocabulary::Applicator::
3 | 1 | 1 | 17µs | 6.74ms | _traverse_keyword_contains | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 16µs | 57µs | BEGIN@17 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 14µs | 37µs | BEGIN@13 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 14µs | 14µs | BEGIN@9 | JSON::Schema::Modern::Vocabulary::Applicator::
2 | 1 | 1 | 11µs | 6.00ms | _traverse_keyword_dependentSchemas | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 10µs | 23µs | BEGIN@14 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 9µs | 25µs | BEGIN@18 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 9µs | 62µs | BEGIN@20 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 8µs | 303µs | BEGIN@10 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 8µs | 16µs | BEGIN@15 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 8µs | 46µs | BEGIN@2.307 | Module::Runtime::
1 | 1 | 1 | 7µs | 97µs | BEGIN@12 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 7µs | 251µs | BEGIN@22 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 6µs | 17µs | BEGIN@16 | JSON::Schema::Modern::Vocabulary::Applicator::
4 | 1 | 1 | 3µs | 3µs | evaluation_order | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 3µs | 3µs | vocabulary | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 0s | 0s | __ANON__ (xsub) | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | __ANON__[:498] | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | __ANON__[:63] | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _eval_keyword__items_array_schemas | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _eval_keyword_additionalItems | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _eval_keyword_contains | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _eval_keyword_dependencies | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _eval_keyword_prefixItems | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _traverse_keyword_additionalItems | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _traverse_keyword_dependencies | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | _traverse_keyword_prefixItems | JSON::Schema::Modern::Vocabulary::Applicator::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 40µs | 2 | 40µs | # spent 36µs (32+4) within Module::Runtime::BEGIN@1.306 which was called:
# once (32µs+4µs) by Module::Runtime::require_module at line 1 # spent 36µs making 1 call to Module::Runtime::BEGIN@1.306
# spent 4µs making 1 call to strict::import |
2 | 2 | 63µs | 2 | 84µs | # spent 46µs (8+38) within Module::Runtime::BEGIN@2.307 which was called:
# once (8µs+38µs) by Module::Runtime::require_module at line 2 # spent 46µs making 1 call to Module::Runtime::BEGIN@2.307
# spent 38µs making 1 call to warnings::import |
3 | package JSON::Schema::Modern::Vocabulary::Applicator; | ||||
4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||
5 | # ABSTRACT: Implementation of the JSON Schema Applicator vocabulary | ||||
6 | |||||
7 | 1 | 0s | our $VERSION = '0.552'; | ||
8 | |||||
9 | 2 | 41µs | 1 | 14µs | # spent 14µs within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@9 which was called:
# once (14µs+0s) by Module::Runtime::require_module at line 9 # spent 14µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@9 |
10 | 2 | 33µs | 2 | 598µs | # spent 303µs (8+295) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10 which was called:
# once (8µs+295µs) by Module::Runtime::require_module at line 10 # spent 303µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10
# spent 295µs making 1 call to Moo::import |
11 | 3 | 44µs | 3 | 1.60ms | # spent 811µs (22+789) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11 which was called:
# once (22µs+789µs) by Module::Runtime::require_module at line 11 # spent 811µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11
# spent 770µs making 1 call to strictures::import
# spent 19µs making 1 call to strictures::VERSION |
12 | 2 | 36µs | 2 | 187µs | # spent 97µs (7+90) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12 which was called:
# once (7µs+90µs) by Module::Runtime::require_module at line 12 # spent 97µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12
# spent 90µs making 1 call to experimental::import |
13 | 2 | 23µs | 2 | 38µs | # spent 37µs (14+23) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@13 which was called:
# once (14µs+23µs) by Module::Runtime::require_module at line 13 # spent 37µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@13
# spent 1µs making 1 call to if::import |
14 | 2 | 19µs | 2 | 26µs | # spent 23µs (10+13) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@14 which was called:
# once (10µs+13µs) by Module::Runtime::require_module at line 14 # spent 23µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@14
# spent 3µs making 1 call to if::unimport |
15 | 2 | 16µs | 2 | 17µs | # spent 16µs (8+8) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@15 which was called:
# once (8µs+8µs) by Module::Runtime::require_module at line 15 # spent 16µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@15
# spent 1µs making 1 call to if::unimport |
16 | 2 | 27µs | 2 | 18µs | # spent 17µs (6+11) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@16 which was called:
# once (6µs+11µs) by Module::Runtime::require_module at line 16 # spent 17µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@16
# spent 1µs making 1 call to if::unimport |
17 | 3 | 32µs | 3 | 74µs | # spent 57µs (16+41) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@17 which was called:
# once (16µs+41µs) by Module::Runtime::require_module at line 17 # spent 57µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@17
# spent 10µs making 1 call to List::Util::import
# spent 7µs making 1 call to UNIVERSAL::VERSION |
18 | 3 | 21µs | 3 | 41µs | # spent 25µs (9+16) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@18 which was called:
# once (9µs+16µs) by Module::Runtime::require_module at line 18 # spent 25µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@18
# spent 13µs making 1 call to Exporter::import
# spent 3µs making 1 call to UNIVERSAL::VERSION |
19 | 2 | 655µs | 2 | 2.13ms | # spent 2.12ms (1.93+200µs) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@19 which was called:
# once (1.93ms+200µs) by Module::Runtime::require_module at line 19 # spent 2.12ms making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@19
# spent 7µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:270] |
20 | 2 | 20µs | 2 | 115µs | # spent 62µs (9+53) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@20 which was called:
# once (9µs+53µs) by Module::Runtime::require_module at line 20 # spent 62µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@20
# spent 53µs making 1 call to Exporter::import |
21 | 2 | 496µs | 2 | 4.48ms | # spent 4.48ms (2.06+2.42) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 which was called:
# once (2.06ms+2.42ms) by Module::Runtime::require_module at line 21 # spent 4.48ms making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21
# spent 0s making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::__ANON__ |
22 | 2 | 3.26ms | 2 | 495µs | # spent 251µs (7+244) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@22 which was called:
# once (7µs+244µs) by Module::Runtime::require_module at line 22 # spent 251µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@22
# spent 244µs making 1 call to namespace::clean::import |
23 | |||||
24 | 1 | 1µs | 1 | 352µs | with 'JSON::Schema::Modern::Vocabulary'; # spent 352µs making 1 call to Moo::with |
25 | |||||
26 | # spent 3µs within JSON::Schema::Modern::Vocabulary::Applicator::vocabulary which was called:
# once (3µs+0s) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:670] at line 666 of JSON/Schema/Modern.pm | ||||
27 | 1 | 4µs | 'https://json-schema.org/draft/2019-09/vocab/applicator' => 'draft2019-09', | ||
28 | 'https://json-schema.org/draft/2020-12/vocab/applicator' => 'draft2020-12'; | ||||
29 | } | ||||
30 | |||||
31 | 4 | 8µs | # spent 3µs within JSON::Schema::Modern::Vocabulary::Applicator::evaluation_order which was called 4 times, avg 750ns/call:
# 4 times (3µs+0s) by JSON::Schema::Modern::Vocabulary::Core::CORE:sort at line 322 of JSON/Schema/Modern/Vocabulary/Core.pm, avg 750ns/call | ||
32 | |||||
33 | # the keyword order is arbitrary, except: | ||||
34 | # - if must be evaluated before then, else | ||||
35 | # - items must be evaluated before additionalItems | ||||
36 | # - in-place applicators (allOf, anyOf, oneOf, not, if/then/else, dependentSchemas) and items, | ||||
37 | # additionalItems must be evaluated before unevaluatedItems (in the Unevaluated vocabulary) | ||||
38 | # - properties and patternProperties must be evaluated before additionalProperties | ||||
39 | # - in-place applicators and properties, patternProperties, additionalProperties must be evaluated | ||||
40 | # before unevaluatedProperties (in the Unevaluated vocabulary) | ||||
41 | # - contains must be evaluated before maxContains, minContains (in the Validator vocabulary) | ||||
42 | 282225 | 52.3ms | # spent 1.56s (1.08+474ms) within JSON::Schema::Modern::Vocabulary::Applicator::keywords which was called 94075 times, avg 17µs/call:
# 91595 times (1.06s+463ms) by JSON::Schema::Modern::_eval_subschema at line 535 of JSON/Schema/Modern.pm, avg 17µs/call
# 2480 times (25.6ms+11.8ms) by JSON::Schema::Modern::_traverse_subschema at line 447 of JSON/Schema/Modern.pm, avg 15µs/call | ||
43 | return ( | ||||
44 | 94075 | 1.57s | 564450 | 474ms | qw(allOf anyOf oneOf not if then else), # spent 187ms making 188150 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp, avg 996ns/call
# spent 162ms making 188150 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:qr, avg 862ns/call
# spent 125ms making 188150 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:match, avg 662ns/call |
45 | $spec_version eq 'draft7' ? 'dependencies' : 'dependentSchemas', | ||||
46 | $spec_version !~ qr/^draft(7|2019-09)$/ ? 'prefixItems' : (), | ||||
47 | 'items', | ||||
48 | $spec_version =~ qr/^draft(7|2019-09)$/ ? 'additionalItems' : (), | ||||
49 | qw(contains properties patternProperties additionalProperties propertyNames), | ||||
50 | $spec_version eq 'draft2019-09' ? qw(unevaluatedItems unevaluatedProperties) : (), | ||||
51 | ); | ||||
52 | } | ||||
53 | |||||
54 | # in draft2019-09, the unevaluated keywords were part of the Applicator vocabulary | ||||
55 | 1 | 0s | foreach my $phase (qw(traverse eval)) { | ||
56 | 2 | 0s | foreach my $type (qw(Items Properties)) { | ||
57 | 4 | 2µs | my $method = '_'.$phase.'_keyword_unevaluated'.$type; | ||
58 | Sub::Install::install_sub({ | ||||
59 | as => $method, | ||||
60 | code => sub { | ||||
61 | shift; | ||||
62 | JSON::Schema::Modern::Vocabulary::Unevaluated->$method(@_); | ||||
63 | } | ||||
64 | 4 | 9µs | 4 | 85µs | }), # spent 85µs making 4 calls to Sub::Install::__ANON__[Sub/Install.pm:118], avg 21µs/call |
65 | } | ||||
66 | } | ||||
67 | |||||
68 | 23 | 91µs | 23 | 24.3ms | # spent 25.4ms (124µs+25.3) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_allOf which was called 23 times, avg 1.10ms/call:
# 23 times (124µs+25.3ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 1.10ms/call # spent 25.3ms making 23 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 1.10ms/call, recursion: max depth 1, sum of overlapping time 1.01ms |
69 | |||||
70 | 30010 | 6.04ms | # spent 71.3s (535ms+70.7) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_allOf which was called 6002 times, avg 11.9ms/call:
# 6002 times (535ms+70.7s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 11.9ms/call | ||
71 | 6002 | 1.50ms | my @invalid; | ||
72 | 6002 | 4.50ms | my @orig_annotations = $state->{annotations}->@*; | ||
73 | 6002 | 613µs | my @new_annotations; | ||
74 | 6002 | 11.6ms | foreach my $idx (0 .. $schema->{allOf}->$#*) { | ||
75 | 25750 | 11.9ms | my @annotations = @orig_annotations; | ||
76 | 25750 | 406ms | 25750 | 0s | if ($self->eval($data, $schema->{allOf}[$idx], +{ %$state, # spent 261s making 25750 calls to JSON::Schema::Modern::Vocabulary::eval, avg 10.1ms/call, recursion: max depth 32, sum of overlapping time 261s |
77 | schema_path => $state->{schema_path}.'/allOf/'.$idx, annotations => \@annotations })) { | ||||
78 | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||||
79 | } | ||||
80 | else { | ||||
81 | push @invalid, $idx; | ||||
82 | last if $state->{short_circuit}; | ||||
83 | } | ||||
84 | } | ||||
85 | |||||
86 | 6002 | 26.9ms | push $state->{annotations}->@*, @new_annotations; | ||
87 | 6002 | 24.7ms | return 1 if @invalid == 0; | ||
88 | |||||
89 | my $pl = @invalid > 1; | ||||
90 | return E($state, 'subschema%s %s %s not valid', $pl?'s':'', join(', ', @invalid), $pl?'are':'is'); | ||||
91 | } | ||||
92 | |||||
93 | 32 | 166µs | 32 | 17.4ms | # spent 18.7ms (143µs+18.6) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_anyOf which was called 32 times, avg 585µs/call:
# 32 times (143µs+18.6ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 585µs/call # spent 18.7ms making 32 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 586µs/call, recursion: max depth 2, sum of overlapping time 1.36ms |
94 | |||||
95 | 5910 | 1.89ms | # spent 3.16s (44.3ms+3.12) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_anyOf which was called 1182 times, avg 2.68ms/call:
# 1182 times (44.3ms+3.12s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 2.68ms/call | ||
96 | 1182 | 205µs | my $valid = 0; | ||
97 | 1182 | 250µs | my @errors; | ||
98 | 1182 | 3.39ms | foreach my $idx (0 .. $schema->{anyOf}->$#*) { | ||
99 | next if not $self->eval($data, $schema->{anyOf}[$idx], | ||||
100 | 2365 | 29.4ms | 2365 | 4.08ms | +{ %$state, errors => \@errors, schema_path => $state->{schema_path}.'/anyOf/'.$idx }); # spent 3.12s making 2365 calls to JSON::Schema::Modern::Vocabulary::eval, avg 1.32ms/call, recursion: max depth 34, sum of overlapping time 3.11s |
101 | 1183 | 625µs | ++$valid; | ||
102 | 1183 | 1.39ms | last if $state->{short_circuit}; | ||
103 | } | ||||
104 | |||||
105 | 1182 | 6.03ms | return 1 if $valid; | ||
106 | push $state->{errors}->@*, @errors; | ||||
107 | return E($state, 'no subschemas are valid'); | ||||
108 | } | ||||
109 | |||||
110 | 22 | 126µs | 22 | 15.8ms | # spent 15.9ms (107µs+15.8) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_oneOf which was called 22 times, avg 723µs/call:
# 22 times (107µs+15.8ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 723µs/call # spent 15.8ms making 22 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 718µs/call |
111 | |||||
112 | 1525 | 373µs | # spent 324ms (12.1+311) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_oneOf which was called 305 times, avg 1.06ms/call:
# 305 times (12.1ms+311ms) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 1.06ms/call | ||
113 | 305 | 88µs | my (@valid, @errors); | ||
114 | 305 | 270µs | my @orig_annotations = $state->{annotations}->@*; | ||
115 | 305 | 53µs | my @new_annotations; | ||
116 | 305 | 773µs | foreach my $idx (0 .. $schema->{oneOf}->$#*) { | ||
117 | 610 | 270µs | my @annotations = @orig_annotations; | ||
118 | next if not $self->eval($data, $schema->{oneOf}[$idx], | ||||
119 | +{ %$state, errors => \@errors, annotations => \@annotations, | ||||
120 | 610 | 7.28ms | 610 | 0s | schema_path => $state->{schema_path}.'/oneOf/'.$idx }); # spent 311ms making 610 calls to JSON::Schema::Modern::Vocabulary::eval, avg 511µs/call, recursion: max depth 9, sum of overlapping time 311ms |
121 | 305 | 274µs | push @valid, $idx; | ||
122 | 305 | 192µs | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
123 | 305 | 397µs | last if @valid > 1 and $state->{short_circuit}; | ||
124 | } | ||||
125 | |||||
126 | 305 | 228µs | push $state->{annotations}->@*, @new_annotations; | ||
127 | 305 | 1.75ms | return 1 if @valid == 1; | ||
128 | |||||
129 | if (not @valid) { | ||||
130 | push $state->{errors}->@*, @errors; | ||||
131 | return E($state, 'no subschemas are valid'); | ||||
132 | } | ||||
133 | else { | ||||
134 | return E($state, 'multiple subschemas are valid: '.join(', ', @valid)); | ||||
135 | } | ||||
136 | } | ||||
137 | |||||
138 | 14 | 59µs | 14 | 1.11ms | # spent 1.72ms (58µs+1.66) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_not which was called 14 times, avg 123µs/call:
# 14 times (58µs+1.66ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 123µs/call # spent 1.66ms making 14 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 118µs/call, recursion: max depth 1, sum of overlapping time 547µs |
139 | |||||
140 | 20 | 2µs | # spent 2.63ms (56µs+2.57) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_not which was called 4 times, avg 657µs/call:
# 4 times (56µs+2.57ms) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 657µs/call | ||
141 | return 1 if not $self->eval($data, $schema->{not}, | ||||
142 | +{ %$state, schema_path => $state->{schema_path}.'/not', | ||||
143 | short_circuit => $state->{short_circuit} || !$state->{collect_annotations}, | ||||
144 | 4 | 53µs | 4 | 0s | errors => [] }); # spent 2.57ms making 4 calls to JSON::Schema::Modern::Vocabulary::eval, avg 643µs/call, recursion: max depth 12, sum of overlapping time 2.57ms |
145 | |||||
146 | return E($state, 'subschema is valid'); | ||||
147 | } | ||||
148 | |||||
149 | 65 | 264µs | 65 | 12.2ms | # spent 15.0ms (280µs+14.7) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_if which was called 65 times, avg 230µs/call:
# 65 times (280µs+14.7ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 230µs/call # spent 14.7ms making 65 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 226µs/call, recursion: max depth 2, sum of overlapping time 2.47ms |
150 | 65 | 229µs | 65 | 16.1ms | # spent 19.5ms (241µs+19.3) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_then which was called 65 times, avg 300µs/call:
# 65 times (241µs+19.3ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 300µs/call # spent 19.3ms making 65 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 296µs/call, recursion: max depth 2, sum of overlapping time 3.18ms |
151 | 15 | 53µs | 15 | 3.63ms | # spent 3.69ms (57µs+3.63) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_else which was called 15 times, avg 246µs/call:
# 15 times (57µs+3.63ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 246µs/call # spent 3.63ms making 15 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 242µs/call |
152 | |||||
153 | 15065 | 3.93ms | # spent 72.7s (89.3ms+72.6) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_if which was called 3013 times, avg 24.1ms/call:
# 3013 times (89.3ms+72.6s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 24.1ms/call | ||
154 | return 1 if not exists $schema->{then} and not exists $schema->{else} | ||||
155 | 3013 | 1.33ms | and not $state->{collect_annotations}; | ||
156 | my $keyword = $self->eval($data, $schema->{if}, | ||||
157 | +{ %$state, schema_path => $state->{schema_path}.'/if', | ||||
158 | short_circuit => $state->{short_circuit} || !$state->{collect_annotations}, | ||||
159 | 3013 | 48.7ms | 3013 | 0s | errors => [], # spent 2.72s making 3013 calls to JSON::Schema::Modern::Vocabulary::eval, avg 904µs/call, recursion: max depth 11, sum of overlapping time 2.72s |
160 | }) | ||||
161 | ? 'then' : 'else'; | ||||
162 | |||||
163 | 3013 | 4.22ms | return 1 if not exists $schema->{$keyword}; | ||
164 | return 1 if $self->eval($data, $schema->{$keyword}, | ||||
165 | 2214 | 27.5ms | 2214 | 0s | +{ %$state, schema_path => $state->{schema_path}.'/'.$keyword }); # spent 74.2s making 2214 calls to JSON::Schema::Modern::Vocabulary::eval, avg 33.5ms/call, recursion: max depth 11, sum of overlapping time 74.2s |
166 | return E({ %$state, keyword => $keyword }, 'subschema is not valid'); | ||||
167 | } | ||||
168 | |||||
169 | 2 | 9µs | 2 | 0s | # spent 6.00ms (11µs+5.98) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_dependentSchemas which was called 2 times, avg 3.00ms/call:
# 2 times (11µs+5.98ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 3.00ms/call # spent 5.98ms making 2 calls to JSON::Schema::Modern::Vocabulary::traverse_object_schemas, avg 2.99ms/call, recursion: max depth 1, sum of overlapping time 5.98ms |
170 | |||||
171 | 1525 | 451µs | # spent 4.33s (8.75ms+4.32) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_dependentSchemas which was called 305 times, avg 14.2ms/call:
# 305 times (8.75ms+4.32s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 14.2ms/call | ||
172 | 305 | 373µs | 305 | 580µs | return 1 if not is_type('object', $data); # spent 580µs making 305 calls to JSON::Schema::Modern::Utilities::is_type, avg 2µs/call |
173 | |||||
174 | 305 | 76µs | my $valid = 1; | ||
175 | 305 | 172µs | my @orig_annotations = $state->{annotations}->@*; | ||
176 | 305 | 64µs | my @new_annotations; | ||
177 | 305 | 1.21ms | 305 | 156µs | foreach my $property (sort keys $schema->{dependentSchemas}->%*) { # spent 156µs making 305 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 511ns/call |
178 | 305 | 130µs | next if not exists $data->{$property}; | ||
179 | |||||
180 | 290 | 125µs | my @annotations = @orig_annotations; | ||
181 | 290 | 2.49ms | 580 | 2.37ms | if ($self->eval($data, $schema->{dependentSchemas}{$property}, # spent 2.37ms making 290 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call
# spent 4.32s making 290 calls to JSON::Schema::Modern::Vocabulary::eval, avg 14.9ms/call, recursion: max depth 9, sum of overlapping time 4.32s |
182 | +{ %$state, annotations => \@annotations, | ||||
183 | schema_path => jsonp($state->{schema_path}, 'dependentSchemas', $property) })) { | ||||
184 | 290 | 298µs | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
185 | 290 | 1.43ms | next; | ||
186 | } | ||||
187 | |||||
188 | $valid = 0; | ||||
189 | last if $state->{short_circuit}; | ||||
190 | } | ||||
191 | |||||
192 | 305 | 525µs | push $state->{annotations}->@*, @new_annotations; | ||
193 | 305 | 59µs | return E($state, 'not all dependencies are satisfied') if not $valid; | ||
194 | 305 | 1.09ms | return 1; | ||
195 | } | ||||
196 | |||||
197 | sub _traverse_keyword_dependencies ($self, $schema, $state) { | ||||
198 | return if not assert_keyword_type($state, $schema, 'object'); | ||||
199 | |||||
200 | my $valid = 1; | ||||
201 | foreach my $property (sort keys $schema->{dependencies}->%*) { | ||||
202 | if (is_type('array', $schema->{dependencies}{$property})) { | ||||
203 | # as in dependentRequired | ||||
204 | |||||
205 | foreach my $index (0..$schema->{dependencies}{$property}->$#*) { | ||||
206 | $valid = E({ %$state, _schema_path_suffix => [ $property, $index ] }, 'element #%d is not a string', $index) | ||||
207 | if not is_type('string', $schema->{dependencies}{$property}[$index]); | ||||
208 | } | ||||
209 | |||||
210 | $valid = E({ %$state, _schema_path_suffix => $property }, 'elements are not unique') | ||||
211 | if not is_elements_unique($schema->{dependencies}{$property}); | ||||
212 | } | ||||
213 | else { | ||||
214 | # as in dependentSchemas | ||||
215 | $valid = 0 if not $self->traverse_property_schema($schema, $state, $property); | ||||
216 | } | ||||
217 | } | ||||
218 | return $valid; | ||||
219 | } | ||||
220 | |||||
221 | sub _eval_keyword_dependencies ($self, $data, $schema, $state) { | ||||
222 | return 1 if not is_type('object', $data); | ||||
223 | |||||
224 | my $valid = 1; | ||||
225 | my @orig_annotations = $state->{annotations}->@*; | ||||
226 | my @new_annotations; | ||||
227 | foreach my $property (sort keys $schema->{dependencies}->%*) { | ||||
228 | next if not exists $data->{$property}; | ||||
229 | |||||
230 | if (is_type('array', $schema->{dependencies}{$property})) { | ||||
231 | # as in dependentRequired | ||||
232 | if (my @missing = grep !exists($data->{$_}), $schema->{dependencies}{$property}->@*) { | ||||
233 | $valid = E({ %$state, _schema_path_suffix => $property }, | ||||
234 | 'missing propert%s: %s', @missing > 1 ? 'ies' : 'y', join(', ', @missing)); | ||||
235 | } | ||||
236 | } | ||||
237 | else { | ||||
238 | # as in dependentSchemas | ||||
239 | my @annotations = @orig_annotations; | ||||
240 | if ($self->eval($data, $schema->{dependencies}{$property}, | ||||
241 | +{ %$state, annotations => \@annotations, | ||||
242 | schema_path => jsonp($state->{schema_path}, 'dependencies', $property) })) { | ||||
243 | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||||
244 | next; | ||||
245 | } | ||||
246 | |||||
247 | $valid = 0; | ||||
248 | last if $state->{short_circuit}; | ||||
249 | } | ||||
250 | } | ||||
251 | |||||
252 | push $state->{annotations}->@*, @new_annotations; | ||||
253 | return E($state, 'not all dependencies are satisfied') if not $valid; | ||||
254 | return 1; | ||||
255 | } | ||||
256 | |||||
257 | sub _traverse_keyword_prefixItems { shift->traverse_array_schemas(@_) } | ||||
258 | |||||
259 | sub _eval_keyword_prefixItems { shift->_eval_keyword__items_array_schemas(@_) } | ||||
260 | |||||
261 | 392 | 83µs | # spent 97.2ms (711µs+96.5) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_items which was called 98 times, avg 992µs/call:
# 98 times (711µs+96.5ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 992µs/call | ||
262 | 98 | 94µs | if (is_plain_arrayref($schema->{items})) { | ||
263 | return E($state, 'array form of "items" not supported in %s', $state->{spec_version}) | ||||
264 | if $state->{spec_version} !~ /^draft(?:7|2019-09)$/; | ||||
265 | |||||
266 | return $self->traverse_array_schemas($schema, $state); | ||||
267 | } | ||||
268 | |||||
269 | 98 | 583µs | 98 | 94.3ms | $self->traverse_subschema($schema, $state); # spent 100ms making 98 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 1.03ms/call, recursion: max depth 1, sum of overlapping time 6.19ms |
270 | } | ||||
271 | |||||
272 | 8790 | 2.73ms | # spent 23.8s (12.5ms+23.8) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_items which was called 1758 times, avg 13.6ms/call:
# 1758 times (12.5ms+23.8s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 13.6ms/call | ||
273 | return $self->_eval_keyword__items_array_schemas($data, $schema, $state) | ||||
274 | 1758 | 927µs | if is_plain_arrayref($schema->{items}); | ||
275 | |||||
276 | 1758 | 7.60ms | 1758 | 23.8s | return $self->_eval_keyword__items_schema($data, $schema, $state); # spent 26.5s making 1758 calls to JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword__items_schema, avg 15.1ms/call, recursion: max depth 4, sum of overlapping time 2.65s |
277 | } | ||||
278 | |||||
279 | sub _traverse_keyword_additionalItems { shift->traverse_subschema(@_) } | ||||
280 | |||||
281 | sub _eval_keyword_additionalItems ($self, $data, $schema, $state) { | ||||
282 | return 1 if not exists $state->{_last_items_index}; | ||||
283 | return $self->_eval_keyword__items_schema($data, $schema, $state); | ||||
284 | } | ||||
285 | |||||
286 | # prefixItems (draft 2020-12), array-based items (all drafts) | ||||
287 | sub _eval_keyword__items_array_schemas ($self, $data, $schema, $state) { | ||||
288 | return 1 if not is_type('array', $data); | ||||
289 | return 1 if ($state->{_last_items_index}//-1) == $data->$#*; | ||||
290 | |||||
291 | my @orig_annotations = $state->{annotations}->@*; | ||||
292 | my @new_annotations; | ||||
293 | my $valid = 1; | ||||
294 | |||||
295 | foreach my $idx (0 .. $data->$#*) { | ||||
296 | last if $idx > $schema->{$state->{keyword}}->$#*; | ||||
297 | $state->{_last_items_index} = $idx; | ||||
298 | |||||
299 | my @annotations = @orig_annotations; | ||||
300 | if (is_type('boolean', $schema->{$state->{keyword}}[$idx])) { | ||||
301 | next if $schema->{$state->{keyword}}[$idx]; | ||||
302 | $valid = E({ %$state, data_path => $state->{data_path}.'/'.$idx, | ||||
303 | _schema_path_suffix => $idx }, 'item not permitted'); | ||||
304 | } | ||||
305 | elsif ($self->eval($data->[$idx], $schema->{$state->{keyword}}[$idx], | ||||
306 | +{ %$state, annotations => \@annotations, | ||||
307 | data_path => $state->{data_path}.'/'.$idx, | ||||
308 | schema_path => $state->{schema_path}.'/'.$state->{keyword}.'/'.$idx })) { | ||||
309 | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||||
310 | next; | ||||
311 | } | ||||
312 | |||||
313 | $valid = 0; | ||||
314 | last if $state->{short_circuit} and not exists $schema->{ | ||||
315 | $state->{keyword} eq 'prefixItems' ? 'items' | ||||
316 | : $state->{keyword} eq 'items' ? 'additionalItems' : die | ||||
317 | }; | ||||
318 | } | ||||
319 | |||||
320 | push $state->{annotations}->@*, @new_annotations; | ||||
321 | A($state, $state->{_last_items_index} == $data->$#* ? true : $state->{_last_items_index}); | ||||
322 | return E($state, 'not all items are valid') if not $valid; | ||||
323 | return 1; | ||||
324 | } | ||||
325 | |||||
326 | # schema-based items (all drafts), and additionalItems (up to and including draft2019-09) | ||||
327 | 8790 | 2.41ms | # spent 23.8s (52.5ms+23.8) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword__items_schema which was called 1758 times, avg 13.6ms/call:
# 1758 times (52.5ms+23.8s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_items at line 276, avg 13.6ms/call | ||
328 | 1758 | 5.57ms | 1758 | 5.85ms | return 1 if not is_type('array', $data); # spent 5.85ms making 1758 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
329 | 643 | 848µs | return 1 if ($state->{_last_items_index}//-1) == $data->$#*; | ||
330 | |||||
331 | 643 | 467µs | my @orig_annotations = $state->{annotations}->@*; | ||
332 | 643 | 118µs | my @new_annotations; | ||
333 | 643 | 187µs | my $valid = 1; | ||
334 | |||||
335 | 643 | 2.18ms | foreach my $idx (($state->{_last_items_index}//-1)+1 .. $data->$#*) { | ||
336 | 1632 | 2.46ms | 1632 | 12.7ms | if (is_type('boolean', $schema->{$state->{keyword}})) { # spent 12.7ms making 1632 calls to JSON::Schema::Modern::Utilities::is_type, avg 8µs/call |
337 | 189 | 306µs | 189 | 159µs | next if $schema->{$state->{keyword}}; # spent 159µs making 189 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 841ns/call |
338 | $valid = E({ %$state, data_path => $state->{data_path}.'/'.$idx }, | ||||
339 | '%sitem not permitted', | ||||
340 | exists $schema->{prefixItems} || $state->{keyword} eq 'additionalItems' ? 'additional ' : ''); | ||||
341 | } | ||||
342 | else { | ||||
343 | 1443 | 744µs | my @annotations = @orig_annotations; | ||
344 | 1443 | 17.2ms | 1443 | 0s | if ($self->eval($data->[$idx], $schema->{$state->{keyword}}, # spent 26.3s making 1443 calls to JSON::Schema::Modern::Vocabulary::eval, avg 18.2ms/call, recursion: max depth 33, sum of overlapping time 26.3s |
345 | +{ %$state, annotations => \@annotations, | ||||
346 | data_path => $state->{data_path}.'/'.$idx, | ||||
347 | schema_path => $state->{schema_path}.'/'.$state->{keyword} })) { | ||||
348 | 1443 | 1.90ms | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
349 | 1443 | 6.96ms | next; | ||
350 | } | ||||
351 | |||||
352 | $valid = 0; | ||||
353 | } | ||||
354 | last if $state->{short_circuit}; | ||||
355 | } | ||||
356 | |||||
357 | 643 | 923µs | $state->{_last_items_index} = $data->$#*; | ||
358 | |||||
359 | 643 | 1.82ms | push $state->{annotations}->@*, @new_annotations; | ||
360 | 643 | 948µs | 643 | 164ms | A($state, true); # spent 164ms making 643 calls to JSON::Schema::Modern::Utilities::A, avg 255µs/call |
361 | return E($state, 'subschema is not valid against all %sitems', | ||||
362 | 643 | 327µs | $state->{keyword} eq 'additionalItems' ? 'additional ' : '') if not $valid; | ||
363 | 643 | 2.72ms | return 1; | ||
364 | } | ||||
365 | |||||
366 | 3 | 17µs | 3 | 275µs | # spent 6.74ms (17µs+6.72) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_contains which was called 3 times, avg 2.25ms/call:
# 3 times (17µs+6.72ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 2.25ms/call # spent 6.72ms making 3 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 2.24ms/call, recursion: max depth 1, sum of overlapping time 6.45ms |
367 | |||||
368 | sub _eval_keyword_contains ($self, $data, $schema, $state) { | ||||
369 | return 1 if not is_type('array', $data); | ||||
370 | |||||
371 | $state->{_num_contains} = 0; | ||||
372 | my @orig_annotations = $state->{annotations}->@*; | ||||
373 | my (@errors, @new_annotations, @valid); | ||||
374 | foreach my $idx (0 .. $data->$#*) { | ||||
375 | my @annotations = @orig_annotations; | ||||
376 | if ($self->eval($data->[$idx], $schema->{contains}, | ||||
377 | +{ %$state, errors => \@errors, annotations => \@annotations, | ||||
378 | data_path => $state->{data_path}.'/'.$idx, | ||||
379 | schema_path => $state->{schema_path}.'/contains' })) { | ||||
380 | ++$state->{_num_contains}; | ||||
381 | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||||
382 | push @valid, $idx; | ||||
383 | |||||
384 | last if $state->{short_circuit} | ||||
385 | and (not exists $schema->{maxContains} or $state->{_num_contains} > $schema->{maxContains}) | ||||
386 | and ($state->{_num_contains} >= ($schema->{minContains}//1)); | ||||
387 | } | ||||
388 | } | ||||
389 | |||||
390 | # note: no items contained is only valid when minContains is explicitly 0 | ||||
391 | if (not $state->{_num_contains} | ||||
392 | and (($schema->{minContains}//1) > 0 or $state->{spec_version} eq 'draft7')) { | ||||
393 | push $state->{errors}->@*, @errors; | ||||
394 | return E($state, 'subschema is not valid against any item'); | ||||
395 | } | ||||
396 | |||||
397 | push $state->{annotations}->@*, @new_annotations; | ||||
398 | return $state->{spec_version} =~ /^draft(?:7|2019-09)$/ ? 1 | ||||
399 | : A($state, @valid == @$data ? true : \@valid); | ||||
400 | } | ||||
401 | |||||
402 | 387 | 1.36ms | 387 | 286ms | # spent 325ms (1.40+324) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_properties which was called 387 times, avg 841µs/call:
# 387 times (1.40ms+324ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 841µs/call # spent 358ms making 387 calls to JSON::Schema::Modern::Vocabulary::traverse_object_schemas, avg 926µs/call, recursion: max depth 3, sum of overlapping time 72.3ms |
403 | |||||
404 | 162460 | 35.9ms | # spent 97.0s (857ms+96.2) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_properties which was called 32492 times, avg 2.99ms/call:
# 32492 times (857ms+96.2s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 2.99ms/call | ||
405 | 32492 | 61.8ms | 32492 | 100ms | return 1 if not is_type('object', $data); # spent 100ms making 32492 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
406 | |||||
407 | 28612 | 6.55ms | my $valid = 1; | ||
408 | 28612 | 29.0ms | my @orig_annotations = $state->{annotations}->@*; | ||
409 | 28612 | 7.42ms | my (@properties, @new_annotations); | ||
410 | 28612 | 198ms | 28612 | 50.7ms | foreach my $property (sort keys $schema->{properties}->%*) { # spent 50.7ms making 28612 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 2µs/call |
411 | 164991 | 40.2ms | next if not exists $data->{$property}; | ||
412 | 10587 | 8.07ms | push @properties, $property; | ||
413 | |||||
414 | 10587 | 16.1ms | 10587 | 90.5ms | if (is_type('boolean', $schema->{properties}{$property})) { # spent 90.5ms making 10587 calls to JSON::Schema::Modern::Utilities::is_type, avg 9µs/call |
415 | 145 | 513µs | 145 | 347µs | next if $schema->{properties}{$property}; # spent 347µs making 145 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 2µs/call |
416 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
417 | _schema_path_suffix => $property }, 'property not permitted'); | ||||
418 | } | ||||
419 | else { | ||||
420 | 10442 | 6.02ms | my @annotations = @orig_annotations; | ||
421 | 10442 | 142ms | 31326 | 97.1s | if ($self->eval($data->{$property}, $schema->{properties}{$property}, # spent 382s making 10442 calls to JSON::Schema::Modern::Vocabulary::eval, avg 36.6ms/call, recursion: max depth 33, sum of overlapping time 285s
# spent 139ms making 20884 calls to JSON::Schema::Modern::Utilities::jsonp, avg 7µs/call |
422 | +{ %$state, annotations => \@annotations, | ||||
423 | data_path => jsonp($state->{data_path}, $property), | ||||
424 | schema_path => jsonp($state->{schema_path}, 'properties', $property) })) { | ||||
425 | 9643 | 29.3ms | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
426 | 9643 | 53.6ms | next; | ||
427 | } | ||||
428 | |||||
429 | 799 | 532µs | $valid = 0; | ||
430 | } | ||||
431 | 799 | 496µs | last if $state->{short_circuit}; | ||
432 | } | ||||
433 | |||||
434 | 28612 | 35.6ms | push $state->{annotations}->@*, @new_annotations; | ||
435 | 28612 | 45.9ms | 28612 | 7.20s | A($state, \@properties); # spent 7.20s making 28612 calls to JSON::Schema::Modern::Utilities::A, avg 252µs/call |
436 | 28612 | 13.3ms | 799 | 211ms | return E($state, 'not all properties are valid') if not $valid; # spent 211ms making 799 calls to JSON::Schema::Modern::Utilities::E, avg 264µs/call |
437 | 27813 | 89.4ms | return 1; | ||
438 | } | ||||
439 | |||||
440 | 28 | 5µs | # spent 1.82ms (136µs+1.68) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_patternProperties which was called 7 times, avg 260µs/call:
# 7 times (136µs+1.68ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 260µs/call | ||
441 | 7 | 13µs | 7 | 40µs | return if not assert_keyword_type($state, $schema, 'object'); # spent 40µs making 7 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 6µs/call |
442 | |||||
443 | 7 | 0s | my $valid = 1; | ||
444 | 7 | 25µs | 7 | 2µs | foreach my $property (sort keys $schema->{patternProperties}->%*) { # spent 2µs making 7 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 286ns/call |
445 | 7 | 48µs | 7 | 312µs | $valid = 0 if not assert_pattern({ %$state, _schema_path_suffix => $property }, $property); # spent 312µs making 7 calls to JSON::Schema::Modern::Utilities::assert_pattern, avg 45µs/call |
446 | 7 | 20µs | 7 | 1.33ms | $valid = 0 if not $self->traverse_property_schema($schema, $state, $property); # spent 1.33ms making 7 calls to JSON::Schema::Modern::Vocabulary::traverse_property_schema, avg 190µs/call |
447 | } | ||||
448 | 7 | 14µs | return $valid; | ||
449 | } | ||||
450 | |||||
451 | 18080 | 5.00ms | # spent 80.3s (220ms+80.1) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties which was called 3616 times, avg 22.2ms/call:
# 3616 times (220ms+80.1s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 22.2ms/call | ||
452 | 3616 | 6.48ms | 3616 | 11.1ms | return 1 if not is_type('object', $data); # spent 11.1ms making 3616 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
453 | |||||
454 | 3616 | 1.64ms | my $valid = 1; | ||
455 | 3616 | 3.67ms | my @orig_annotations = $state->{annotations}->@*; | ||
456 | 3616 | 1.08ms | my (@properties, @new_annotations); | ||
457 | 3616 | 15.3ms | 3616 | 1.99ms | foreach my $property_pattern (sort keys $schema->{patternProperties}->%*) { # spent 1.99ms making 3616 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 550ns/call |
458 | 3616 | 112ms | 21616 | 51.2ms | foreach my $property (sort grep m/$property_pattern/, keys %$data) { # spent 45.1ms making 9000 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp, avg 5µs/call
# spent 4.87ms making 9000 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:match, avg 541ns/call
# spent 1.30ms making 3616 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 360ns/call |
459 | 2269 | 1.23ms | push @properties, $property; | ||
460 | 2269 | 3.83ms | 2269 | 21.9ms | if (is_type('boolean', $schema->{patternProperties}{$property_pattern})) { # spent 21.9ms making 2269 calls to JSON::Schema::Modern::Utilities::is_type, avg 10µs/call |
461 | 1061 | 2.20ms | 1061 | 1.30ms | next if $schema->{patternProperties}{$property_pattern}; # spent 1.30ms making 1061 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 1µs/call |
462 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
463 | _schema_path_suffix => $property_pattern }, 'property not permitted'); | ||||
464 | } | ||||
465 | else { | ||||
466 | 1208 | 4.93ms | my @annotations = @orig_annotations; | ||
467 | 1208 | 20.9ms | 3624 | 18.1ms | if ($self->eval($data->{$property}, $schema->{patternProperties}{$property_pattern}, # spent 18.1ms making 2416 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call
# spent 184s making 1208 calls to JSON::Schema::Modern::Vocabulary::eval, avg 152ms/call, recursion: max depth 4, sum of overlapping time 184s |
468 | +{ %$state, annotations => \@annotations, | ||||
469 | data_path => jsonp($state->{data_path}, $property), | ||||
470 | schema_path => jsonp($state->{schema_path}, 'patternProperties', $property_pattern) })) { | ||||
471 | 1208 | 7.27ms | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
472 | 1208 | 13.6ms | next; | ||
473 | } | ||||
474 | |||||
475 | $valid = 0; | ||||
476 | } | ||||
477 | last if $state->{short_circuit}; | ||||
478 | } | ||||
479 | } | ||||
480 | |||||
481 | 3616 | 30.5ms | push $state->{annotations}->@*, @new_annotations; | ||
482 | 3616 | 21.3ms | 7232 | 998ms | A($state, [ uniqstr @properties ]); # spent 991ms making 3616 calls to JSON::Schema::Modern::Utilities::A, avg 274µs/call
# spent 6.75ms making 3616 calls to List::Util::uniqstr, avg 2µs/call |
483 | 3616 | 954µs | return E($state, 'not all properties are valid') if not $valid; | ||
484 | 3616 | 17.9ms | return 1; | ||
485 | } | ||||
486 | |||||
487 | 130 | 696µs | 130 | 30.9ms | # spent 32.1ms (642µs+31.5) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_additionalProperties which was called 130 times, avg 247µs/call:
# 130 times (642µs+31.5ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 247µs/call # spent 38.8ms making 130 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 298µs/call, recursion: max depth 2, sum of overlapping time 7.88ms |
488 | |||||
489 | 4885 | 1.19ms | # spent 67.2s (82.9ms+67.1) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_additionalProperties which was called 977 times, avg 68.8ms/call:
# 977 times (82.9ms+67.1s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 68.8ms/call | ||
490 | 977 | 1.45ms | 977 | 2.43ms | return 1 if not is_type('object', $data); # spent 2.43ms making 977 calls to JSON::Schema::Modern::Utilities::is_type, avg 2µs/call |
491 | |||||
492 | 977 | 363µs | my $valid = 1; | ||
493 | 977 | 774µs | my @orig_annotations = $state->{annotations}->@*; | ||
494 | 977 | 329µs | my (@properties, @new_annotations); | ||
495 | 977 | 6.78ms | 977 | 718µs | foreach my $property (sort keys %$data) { # spent 718µs making 977 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 735ns/call |
496 | 1835 | 1.16ms | next if exists $schema->{properties} and exists $schema->{properties}{$property}; | ||
497 | next if exists $schema->{patternProperties} | ||||
498 | 1835 | 790µs | and any { $property =~ /$_/ } keys $schema->{patternProperties}->%*; | ||
499 | |||||
500 | 1835 | 1.55ms | push @properties, $property; | ||
501 | 1835 | 2.45ms | 1835 | 15.6ms | if (is_type('boolean', $schema->{additionalProperties})) { # spent 15.6ms making 1835 calls to JSON::Schema::Modern::Utilities::is_type, avg 9µs/call |
502 | next if $schema->{additionalProperties}; | ||||
503 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property) }, | ||||
504 | 'additional property not permitted'); | ||||
505 | } | ||||
506 | else { | ||||
507 | 1835 | 808µs | my @annotations = @orig_annotations; | ||
508 | 1835 | 29.1ms | 3670 | 14.2ms | if ($self->eval($data->{$property}, $schema->{additionalProperties}, # spent 14.2ms making 1835 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call
# spent 108s making 1835 calls to JSON::Schema::Modern::Vocabulary::eval, avg 58.6ms/call, recursion: max depth 30, sum of overlapping time 108s |
509 | +{ %$state, annotations => \@annotations, | ||||
510 | data_path => jsonp($state->{data_path}, $property), | ||||
511 | schema_path => $state->{schema_path}.'/additionalProperties' })) { | ||||
512 | 1835 | 6.02ms | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
513 | 1835 | 10.4ms | next; | ||
514 | } | ||||
515 | |||||
516 | $valid = 0; | ||||
517 | } | ||||
518 | last if $state->{short_circuit}; | ||||
519 | } | ||||
520 | |||||
521 | 977 | 6.84ms | push $state->{annotations}->@*, @new_annotations; | ||
522 | 977 | 1.46ms | 977 | 231ms | A($state, \@properties); # spent 231ms making 977 calls to JSON::Schema::Modern::Utilities::A, avg 237µs/call |
523 | 977 | 513µs | return E($state, 'not all additional properties are valid') if not $valid; | ||
524 | 977 | 5.37ms | return 1; | ||
525 | } | ||||
526 | |||||
527 | 14 | 57µs | 14 | 3.49ms | # spent 3.63ms (66µs+3.56) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_propertyNames which was called 14 times, avg 259µs/call:
# 14 times (66µs+3.56ms) by JSON::Schema::Modern::_traverse_subschema at line 457 of JSON/Schema/Modern.pm, avg 259µs/call # spent 3.56ms making 14 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 254µs/call, recursion: max depth 1, sum of overlapping time 66µs |
528 | |||||
529 | 3135 | 981µs | # spent 496ms (24.1+472) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_propertyNames which was called 627 times, avg 791µs/call:
# 627 times (24.1ms+472ms) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 791µs/call | ||
530 | 627 | 956µs | 627 | 1.74ms | return 1 if not is_type('object', $data); # spent 1.74ms making 627 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
531 | |||||
532 | 627 | 243µs | my $valid = 1; | ||
533 | 627 | 992µs | my @orig_annotations = $state->{annotations}->@*; | ||
534 | 627 | 156µs | my @new_annotations; | ||
535 | 627 | 3.26ms | 627 | 311µs | foreach my $property (sort keys %$data) { # spent 311µs making 627 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 496ns/call |
536 | 713 | 1.02ms | my @annotations = @orig_annotations; | ||
537 | 713 | 8.73ms | 1426 | 17.1ms | if ($self->eval($property, $schema->{propertyNames}, # spent 17.1ms making 713 calls to JSON::Schema::Modern::Utilities::jsonp, avg 24µs/call
# spent 453ms making 713 calls to JSON::Schema::Modern::Vocabulary::eval, avg 635µs/call, recursion: max depth 7, sum of overlapping time 453ms |
538 | +{ %$state, annotations => \@annotations, | ||||
539 | data_path => jsonp($state->{data_path}, $property), | ||||
540 | schema_path => $state->{schema_path}.'/propertyNames' })) { | ||||
541 | 713 | 514µs | push @new_annotations, @annotations[$#orig_annotations+1 .. $#annotations]; | ||
542 | 713 | 3.15ms | next; | ||
543 | } | ||||
544 | |||||
545 | $valid = 0; | ||||
546 | last if $state->{short_circuit}; | ||||
547 | } | ||||
548 | |||||
549 | 627 | 629µs | push $state->{annotations}->@*, @new_annotations; | ||
550 | 627 | 141µs | return E($state, 'not all property names are valid') if not $valid; | ||
551 | 627 | 2.60ms | return 1; | ||
552 | } | ||||
553 | |||||
554 | 1 | 7µs | 1; | ||
555 | |||||
556 | 1 | 31µs | 1 | 334µs | __END__ # spent 334µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 129ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:match which was called 197150 times, avg 657ns/call:
# 188150 times (125ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 662ns/call
# 9000 times (4.87ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 458, avg 541ns/call | |||||
# spent 162ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:qr which was called 188150 times, avg 862ns/call:
# 188150 times (162ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 862ns/call | |||||
# spent 233ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp which was called 197150 times, avg 1µs/call:
# 188150 times (187ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 996ns/call
# 9000 times (45.1ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 458, avg 5µs/call | |||||
# spent 55.2ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort which was called 37760 times, avg 1µs/call:
# 28612 times (50.7ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_properties at line 410, avg 2µs/call
# 3616 times (1.99ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 457, avg 550ns/call
# 3616 times (1.30ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 458, avg 360ns/call
# 977 times (718µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_additionalProperties at line 495, avg 735ns/call
# 627 times (311µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_propertyNames at line 535, avg 496ns/call
# 305 times (156µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_dependentSchemas at line 177, avg 511ns/call
# 7 times (2µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_patternProperties at line 444, avg 286ns/call | |||||
# spent 0s within JSON::Schema::Modern::Vocabulary::Applicator::__ANON__ which was called:
# once (0s+0s) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 at line 21 |