Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/Applicator.pm |
Statements | Executed 814653 statements in 1.71s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
32492 | 1 | 1 | 844ms | 99.4s | _eval_keyword_properties (recurses: max depth 11, inclusive time 379s) | JSON::Schema::Modern::Vocabulary::Applicator::
6002 | 1 | 1 | 479ms | 74.1s | _eval_keyword_allOf (recurses: max depth 13, inclusive time 206s) | JSON::Schema::Modern::Vocabulary::Applicator::
3369 | 1 | 1 | 138ms | 82.3s | _eval_keyword_patternProperties (recurses: max depth 2, inclusive time 38.2s) | JSON::Schema::Modern::Vocabulary::Applicator::
3013 | 1 | 1 | 92.0ms | 74.9s | _eval_keyword_if (recurses: max depth 1, inclusive time 4.49s) | JSON::Schema::Modern::Vocabulary::Applicator::
977 | 1 | 1 | 66.3ms | 70.6s | _eval_keyword_additionalProperties (recurses: max depth 4, inclusive time 44.7s) | JSON::Schema::Modern::Vocabulary::Applicator::
1182 | 1 | 1 | 57.5ms | 3.25s | _eval_keyword_anyOf | JSON::Schema::Modern::Vocabulary::Applicator::
37265 | 7 | 1 | 55.4ms | 55.4ms | CORE:sort (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
1758 | 1 | 1 | 50.6ms | 23.6s | _eval_keyword__items_schema (recurses: max depth 4, inclusive time 2.52s) | JSON::Schema::Modern::Vocabulary::Applicator::
8340 | 2 | 1 | 30.7ms | 30.7ms | CORE:regcomp (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
627 | 1 | 1 | 21.4ms | 449ms | _eval_keyword_propertyNames | JSON::Schema::Modern::Vocabulary::Applicator::
1758 | 1 | 1 | 14.7ms | 23.6s | _eval_keyword_items (recurses: max depth 4, inclusive time 2.52s) | JSON::Schema::Modern::Vocabulary::Applicator::
305 | 1 | 1 | 11.9ms | 315ms | _eval_keyword_oneOf | JSON::Schema::Modern::Vocabulary::Applicator::
305 | 1 | 1 | 9.89ms | 4.19s | _eval_keyword_dependentSchemas | JSON::Schema::Modern::Vocabulary::Applicator::
8340 | 2 | 1 | 4.32ms | 4.32ms | CORE:match (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
387 | 1 | 1 | 2.26ms | 343ms | _traverse_keyword_properties (recurses: max depth 3, inclusive time 40.9ms) | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 2.06ms | 2.43ms | BEGIN@19 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 1.88ms | 4.62ms | BEGIN@21 | JSON::Schema::Modern::Vocabulary::Applicator::
98 | 1 | 1 | 859µs | 105ms | _traverse_keyword_items (recurses: max depth 1, inclusive time 5.42ms) | JSON::Schema::Modern::Vocabulary::Applicator::
130 | 1 | 1 | 849µs | 33.4ms | _traverse_keyword_additionalProperties (recurses: max depth 1, inclusive time 7.05ms) | JSON::Schema::Modern::Vocabulary::Applicator::
65 | 1 | 1 | 320µs | 21.3ms | _traverse_keyword_then | JSON::Schema::Modern::Vocabulary::Applicator::
65 | 1 | 1 | 318µs | 13.3ms | _traverse_keyword_if | JSON::Schema::Modern::Vocabulary::Applicator::
32 | 1 | 1 | 182µs | 15.1ms | _traverse_keyword_anyOf (recurses: max depth 1, inclusive time 192µs) | JSON::Schema::Modern::Vocabulary::Applicator::
6 | 1 | 1 | 151µs | 1.96ms | _traverse_keyword_patternProperties | JSON::Schema::Modern::Vocabulary::Applicator::
23 | 1 | 1 | 112µs | 26.2ms | _traverse_keyword_allOf | JSON::Schema::Modern::Vocabulary::Applicator::
4 | 1 | 1 | 97µs | 2.98ms | _eval_keyword_not | JSON::Schema::Modern::Vocabulary::Applicator::
21 | 1 | 1 | 86µs | 18.6ms | _traverse_keyword_oneOf | JSON::Schema::Modern::Vocabulary::Applicator::
15 | 1 | 1 | 85µs | 1.54ms | _traverse_keyword_not | JSON::Schema::Modern::Vocabulary::Applicator::
15 | 1 | 1 | 83µs | 5.34ms | _traverse_keyword_else | JSON::Schema::Modern::Vocabulary::Applicator::
14 | 1 | 1 | 78µs | 5.18ms | _traverse_keyword_propertyNames | JSON::Schema::Modern::Vocabulary::Applicator::
2 | 2 | 1 | 49µs | 65µs | keywords | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 36µs | 39µs | BEGIN@1.306 | Module::Runtime::
1 | 1 | 1 | 32µs | 104µs | BEGIN@17 | JSON::Schema::Modern::Vocabulary::Applicator::
3 | 1 | 1 | 30µs | 4.78ms | _traverse_keyword_dependentSchemas | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 27µs | 50µs | BEGIN@16 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 25µs | 106µs | BEGIN@13 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 25µs | 129µs | BEGIN@15 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 25µs | 97µs | BEGIN@20 | JSON::Schema::Modern::Vocabulary::Applicator::
3 | 1 | 1 | 20µs | 7.47ms | _traverse_keyword_contains | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 15µs | 734µs | BEGIN@11 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 15µs | 57µs | BEGIN@14 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 14µs | 42µs | BEGIN@18 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 11µs | 211µs | BEGIN@12 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 10µs | 10µs | BEGIN@9 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 8µs | 208µs | BEGIN@10 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 8µs | 274µs | BEGIN@22 | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 7µs | 37µs | BEGIN@2.307 | Module::Runtime::
4 | 1 | 1 | 6µs | 6µs | CORE:qr (opcode) | JSON::Schema::Modern::Vocabulary::Applicator::
4 | 1 | 1 | 2µs | 2µs | evaluation_order | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 2µs | 2µs | vocabulary | JSON::Schema::Modern::Vocabulary::Applicator::
1 | 1 | 1 | 1µs | 1µs | __ANON__ (xsub) | JSON::Schema::Modern::Vocabulary::Applicator::
0 | 0 | 0 | 0s | 0s | __ANON__[:448] | 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 | 34µs | 2 | 42µs | # spent 39µs (36+3) within Module::Runtime::BEGIN@1.306 which was called:
# once (36µs+3µs) by Module::Runtime::require_module at line 1 # spent 39µs making 1 call to Module::Runtime::BEGIN@1.306
# spent 3µs making 1 call to strict::import |
2 | 2 | 39µs | 2 | 67µs | # spent 37µs (7+30) within Module::Runtime::BEGIN@2.307 which was called:
# once (7µs+30µs) by Module::Runtime::require_module at line 2 # spent 37µs making 1 call to Module::Runtime::BEGIN@2.307
# spent 30µ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.556'; | ||
8 | |||||
9 | 2 | 27µs | 1 | 10µs | # spent 10µs within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@9 which was called:
# once (10µs+0s) by Module::Runtime::require_module at line 9 # spent 10µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@9 |
10 | 2 | 22µs | 2 | 408µs | # spent 208µs (8+200) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10 which was called:
# once (8µs+200µs) by Module::Runtime::require_module at line 10 # spent 208µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10
# spent 200µs making 1 call to Moo::import |
11 | 3 | 95µs | 3 | 1.45ms | # spent 734µs (15+719) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11 which was called:
# once (15µs+719µs) by Module::Runtime::require_module at line 11 # spent 734µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11
# spent 702µs making 1 call to strictures::import
# spent 17µs making 1 call to strictures::VERSION |
12 | 2 | 69µs | 2 | 411µs | # spent 211µs (11+200) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12 which was called:
# once (11µs+200µs) by Module::Runtime::require_module at line 12 # spent 211µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12
# spent 200µs making 1 call to experimental::import |
13 | 2 | 56µs | 2 | 111µs | # spent 106µs (25+81) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@13 which was called:
# once (25µs+81µs) by Module::Runtime::require_module at line 13 # spent 106µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@13
# spent 5µs making 1 call to if::import |
14 | 2 | 41µs | 2 | 61µs | # spent 57µs (15+42) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@14 which was called:
# once (15µs+42µs) by Module::Runtime::require_module at line 14 # spent 57µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@14
# spent 4µs making 1 call to if::unimport |
15 | 2 | 77µs | 2 | 131µs | # spent 129µs (25+104) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@15 which was called:
# once (25µs+104µs) by Module::Runtime::require_module at line 15 # spent 129µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@15
# spent 2µs making 1 call to if::unimport |
16 | 2 | 52µs | 2 | 52µs | # spent 50µs (27+23) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@16 which was called:
# once (27µs+23µs) by Module::Runtime::require_module at line 16 # spent 50µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@16
# spent 2µs making 1 call to if::unimport |
17 | 3 | 76µs | 3 | 130µs | # spent 104µs (32+72) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@17 which was called:
# once (32µs+72µs) by Module::Runtime::require_module at line 17 # spent 104µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@17
# spent 15µs making 1 call to List::Util::import
# spent 11µs making 1 call to UNIVERSAL::VERSION |
18 | 3 | 52µs | 3 | 70µs | # spent 42µs (14+28) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@18 which was called:
# once (14µs+28µs) by Module::Runtime::require_module at line 18 # spent 42µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@18
# spent 21µs making 1 call to Exporter::import
# spent 7µs making 1 call to UNIVERSAL::VERSION |
19 | 2 | 731µs | 2 | 2.44ms | # spent 2.43ms (2.06+367µs) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@19 which was called:
# once (2.06ms+367µs) by Module::Runtime::require_module at line 19 # spent 2.43ms making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@19
# spent 4µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:270] |
20 | 2 | 29µs | 2 | 169µs | # spent 97µs (25+72) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@20 which was called:
# once (25µs+72µs) by Module::Runtime::require_module at line 20 # spent 97µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@20
# spent 72µs making 1 call to Exporter::import |
21 | 2 | 429µs | 2 | 4.62ms | # spent 4.62ms (1.88+2.74) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 which was called:
# once (1.88ms+2.74ms) by Module::Runtime::require_module at line 21 # spent 4.62ms making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::__ANON__ |
22 | 2 | 3.70ms | 2 | 540µs | # spent 274µs (8+266) within JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@22 which was called:
# once (8µs+266µs) by Module::Runtime::require_module at line 22 # spent 274µs making 1 call to JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@22
# spent 266µs making 1 call to namespace::clean::import |
23 | |||||
24 | 1 | 2µs | 1 | 421µs | with 'JSON::Schema::Modern::Vocabulary'; # spent 421µs making 1 call to Moo::with |
25 | |||||
26 | # spent 2µs within JSON::Schema::Modern::Vocabulary::Applicator::vocabulary which was called:
# once (2µs+0s) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:696] at line 692 of JSON/Schema/Modern.pm | ||||
27 | 1 | 3µ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 | 7µs | # spent 2µs within JSON::Schema::Modern::Vocabulary::Applicator::evaluation_order which was called 4 times, avg 500ns/call:
# 4 times (2µs+0s) by JSON::Schema::Modern::Vocabulary::Core::CORE:sort at line 331 of JSON/Schema/Modern/Vocabulary/Core.pm, avg 500ns/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 | 6 | 1µs | # spent 65µs (49+16) within JSON::Schema::Modern::Vocabulary::Applicator::keywords which was called 2 times, avg 32µs/call:
# once (27µs+10µs) by JSON::Schema::Modern::_traverse_subschema at line 471 of JSON/Schema/Modern.pm
# once (22µs+6µs) by JSON::Schema::Modern::_eval_subschema at line 559 of JSON/Schema/Modern.pm | ||
43 | return ( | ||||
44 | 2 | 68µs | 12 | 16µs | qw(allOf anyOf oneOf not if then else), # spent 6µs making 4 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:qr, avg 2µs/call
# spent 6µs making 4 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp, avg 2µs/call
# spent 4µs making 4 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:match, avg 1µs/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 | 2µs | foreach my $type (qw(Items Properties)) { | ||
57 | 4 | 3µ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 | 11µs | 4 | 109µs | }), # spent 109µs making 4 calls to Sub::Install::__ANON__[Sub/Install.pm:118], avg 27µs/call |
65 | } | ||||
66 | } | ||||
67 | |||||
68 | 23 | 131µs | 23 | 25.1ms | # spent 26.2ms (112µs+26.1) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_allOf which was called 23 times, avg 1.14ms/call:
# 23 times (112µs+26.1ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 1.14ms/call # spent 26.1ms making 23 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 1.14ms/call, recursion: max depth 1, sum of overlapping time 1.05ms |
69 | |||||
70 | 30010 | 7.06ms | # spent 74.1s (479ms+73.7) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_allOf which was called 6002 times, avg 12.4ms/call:
# 6002 times (479ms+73.7s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 12.4ms/call | ||
71 | 6002 | 1.21ms | my @invalid; | ||
72 | 6002 | 12.6ms | foreach my $idx (0 .. $schema->{allOf}->$#*) { | ||
73 | 25750 | 402ms | 25750 | 0s | if ($self->eval($data, $schema->{allOf}[$idx], +{ %$state, # spent 280s making 25750 calls to JSON::Schema::Modern::Vocabulary::eval, avg 10.9ms/call, recursion: max depth 32, sum of overlapping time 280s |
74 | schema_path => $state->{schema_path}.'/allOf/'.$idx })) { | ||||
75 | } | ||||
76 | else { | ||||
77 | push @invalid, $idx; | ||||
78 | last if $state->{short_circuit}; | ||||
79 | } | ||||
80 | } | ||||
81 | |||||
82 | 6002 | 20.8ms | return 1 if @invalid == 0; | ||
83 | |||||
84 | my $pl = @invalid > 1; | ||||
85 | return E($state, 'subschema%s %s %s not valid', $pl?'s':'', join(', ', @invalid), $pl?'are':'is'); | ||||
86 | } | ||||
87 | |||||
88 | 32 | 170µs | 32 | 13.7ms | # spent 15.1ms (182µs+15.0) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_anyOf which was called 32 times, avg 473µs/call:
# 32 times (182µs+15.0ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 473µs/call # spent 15.1ms making 32 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 473µs/call, recursion: max depth 2, sum of overlapping time 1.47ms |
89 | |||||
90 | 5910 | 10.8ms | # spent 3.25s (57.5ms+3.19) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_anyOf which was called 1182 times, avg 2.75ms/call:
# 1182 times (57.5ms+3.19s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 2.75ms/call | ||
91 | 1182 | 392µs | my $valid = 0; | ||
92 | 1182 | 295µs | my @errors; | ||
93 | 1182 | 3.33ms | foreach my $idx (0 .. $schema->{anyOf}->$#*) { | ||
94 | next if not $self->eval($data, $schema->{anyOf}[$idx], | ||||
95 | 2365 | 32.7ms | 2365 | 4.60ms | +{ %$state, errors => \@errors, schema_path => $state->{schema_path}.'/anyOf/'.$idx }); # spent 3.19s making 2365 calls to JSON::Schema::Modern::Vocabulary::eval, avg 1.35ms/call, recursion: max depth 34, sum of overlapping time 3.19s |
96 | 1183 | 530µs | ++$valid; | ||
97 | 1183 | 1.27ms | last if $state->{short_circuit}; | ||
98 | } | ||||
99 | |||||
100 | 1182 | 7.28ms | return 1 if $valid; | ||
101 | push $state->{errors}->@*, @errors; | ||||
102 | return E($state, 'no subschemas are valid'); | ||||
103 | } | ||||
104 | |||||
105 | 21 | 77µs | 21 | 18.6ms | # spent 18.6ms (86µs+18.6) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_oneOf which was called 21 times, avg 887µs/call:
# 21 times (86µs+18.6ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 887µs/call # spent 18.6ms making 21 calls to JSON::Schema::Modern::Vocabulary::traverse_array_schemas, avg 883µs/call |
106 | |||||
107 | 1525 | 331µs | # spent 315ms (11.9+303) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_oneOf which was called 305 times, avg 1.03ms/call:
# 305 times (11.9ms+303ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 1.03ms/call | ||
108 | 305 | 85µs | my (@valid, @errors); | ||
109 | 305 | 956µs | foreach my $idx (0 .. $schema->{oneOf}->$#*) { | ||
110 | next if not $self->eval($data, $schema->{oneOf}[$idx], | ||||
111 | 610 | 7.80ms | 610 | 0s | +{ %$state, errors => \@errors, schema_path => $state->{schema_path}.'/oneOf/'.$idx }); # spent 303ms making 610 calls to JSON::Schema::Modern::Vocabulary::eval, avg 497µs/call, recursion: max depth 9, sum of overlapping time 303ms |
112 | 305 | 243µs | push @valid, $idx; | ||
113 | 305 | 271µs | last if @valid > 1 and $state->{short_circuit}; | ||
114 | } | ||||
115 | |||||
116 | 305 | 1.95ms | return 1 if @valid == 1; | ||
117 | |||||
118 | if (not @valid) { | ||||
119 | push $state->{errors}->@*, @errors; | ||||
120 | return E($state, 'no subschemas are valid'); | ||||
121 | } | ||||
122 | else { | ||||
123 | return E($state, 'multiple subschemas are valid: '.join(', ', @valid)); | ||||
124 | } | ||||
125 | } | ||||
126 | |||||
127 | 15 | 69µs | 15 | 1.07ms | # spent 1.54ms (85µs+1.45) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_not which was called 15 times, avg 102µs/call:
# 15 times (85µs+1.45ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 102µs/call # spent 1.45ms making 15 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 97µs/call, recursion: max depth 1, sum of overlapping time 377µs |
128 | |||||
129 | 20 | 4µs | # spent 2.98ms (97µs+2.89) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_not which was called 4 times, avg 746µs/call:
# 4 times (97µs+2.89ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 746µs/call | ||
130 | return 1 if not $self->eval($data, $schema->{not}, | ||||
131 | +{ %$state, schema_path => $state->{schema_path}.'/not', | ||||
132 | short_circuit => $state->{short_circuit} || !$state->{collect_annotations}, | ||||
133 | 4 | 70µs | 4 | 0s | errors => [] }); # spent 2.89ms making 4 calls to JSON::Schema::Modern::Vocabulary::eval, avg 722µs/call, recursion: max depth 12, sum of overlapping time 2.89ms |
134 | |||||
135 | return E($state, 'subschema is valid'); | ||||
136 | } | ||||
137 | |||||
138 | 65 | 320µs | 65 | 11.2ms | # spent 13.3ms (318µs+13.0) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_if which was called 65 times, avg 205µs/call:
# 65 times (318µs+13.0ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 205µs/call # spent 13.0ms making 65 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 200µs/call, recursion: max depth 2, sum of overlapping time 1.81ms |
139 | 65 | 253µs | 65 | 18.2ms | # spent 21.3ms (320µs+20.9) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_then which was called 65 times, avg 327µs/call:
# 65 times (320µs+20.9ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 327µs/call # spent 20.9ms making 65 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 322µs/call, recursion: max depth 2, sum of overlapping time 2.74ms |
140 | 15 | 81µs | 15 | 5.26ms | # spent 5.34ms (83µs+5.26) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_else which was called 15 times, avg 356µs/call:
# 15 times (83µs+5.26ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 356µs/call # spent 5.26ms making 15 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 351µs/call |
141 | |||||
142 | 15065 | 3.30ms | # spent 74.9s (92.0ms+74.8) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_if which was called 3013 times, avg 24.8ms/call:
# 3013 times (92.0ms+74.8s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 24.8ms/call | ||
143 | return 1 if not exists $schema->{then} and not exists $schema->{else} | ||||
144 | 3013 | 1.49ms | and not $state->{collect_annotations}; | ||
145 | my $keyword = $self->eval($data, $schema->{if}, | ||||
146 | +{ %$state, schema_path => $state->{schema_path}.'/if', | ||||
147 | short_circuit => $state->{short_circuit} || !$state->{collect_annotations}, | ||||
148 | 3013 | 49.6ms | 3013 | 0s | errors => [], # spent 2.62s making 3013 calls to JSON::Schema::Modern::Vocabulary::eval, avg 871µs/call, recursion: max depth 11, sum of overlapping time 2.62s |
149 | }) | ||||
150 | ? 'then' : 'else'; | ||||
151 | |||||
152 | 3013 | 3.97ms | return 1 if not exists $schema->{$keyword}; | ||
153 | return 1 if $self->eval($data, $schema->{$keyword}, | ||||
154 | 2214 | 28.8ms | 2214 | 0s | +{ %$state, schema_path => $state->{schema_path}.'/'.$keyword }); # spent 76.6s making 2214 calls to JSON::Schema::Modern::Vocabulary::eval, avg 34.6ms/call, recursion: max depth 11, sum of overlapping time 76.6s |
155 | return E({ %$state, keyword => $keyword }, 'subschema is not valid'); | ||||
156 | } | ||||
157 | |||||
158 | 3 | 15µs | 3 | 0s | # spent 4.78ms (30µs+4.75) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_dependentSchemas which was called 3 times, avg 1.59ms/call:
# 3 times (30µs+4.75ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 1.59ms/call # spent 4.75ms making 3 calls to JSON::Schema::Modern::Vocabulary::traverse_object_schemas, avg 1.58ms/call, recursion: max depth 1, sum of overlapping time 4.75ms |
159 | |||||
160 | 1525 | 292µs | # spent 4.19s (9.89ms+4.18) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_dependentSchemas which was called 305 times, avg 13.7ms/call:
# 305 times (9.89ms+4.18s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 13.7ms/call | ||
161 | 305 | 471µs | 305 | 562µs | return 1 if not is_type('object', $data); # spent 562µs making 305 calls to JSON::Schema::Modern::Utilities::is_type, avg 2µs/call |
162 | |||||
163 | 305 | 170µs | my $valid = 1; | ||
164 | 305 | 1.42ms | 305 | 167µs | foreach my $property (sort keys $schema->{dependentSchemas}->%*) { # spent 167µs making 305 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 548ns/call |
165 | 305 | 106µs | next if not exists $data->{$property}; | ||
166 | |||||
167 | 290 | 3.02ms | 580 | 2.54ms | if ($self->eval($data, $schema->{dependentSchemas}{$property}, # spent 2.54ms making 290 calls to JSON::Schema::Modern::Utilities::jsonp, avg 9µs/call
# spent 4.18s making 290 calls to JSON::Schema::Modern::Vocabulary::eval, avg 14.4ms/call, recursion: max depth 9, sum of overlapping time 4.18s |
168 | +{ %$state, schema_path => jsonp($state->{schema_path}, 'dependentSchemas', $property) })) { | ||||
169 | 290 | 2.67ms | next; | ||
170 | } | ||||
171 | |||||
172 | $valid = 0; | ||||
173 | last if $state->{short_circuit}; | ||||
174 | } | ||||
175 | |||||
176 | 305 | 133µs | return E($state, 'not all dependencies are satisfied') if not $valid; | ||
177 | 305 | 868µs | return 1; | ||
178 | } | ||||
179 | |||||
180 | sub _traverse_keyword_dependencies ($self, $schema, $state) { | ||||
181 | return if not assert_keyword_type($state, $schema, 'object'); | ||||
182 | |||||
183 | my $valid = 1; | ||||
184 | foreach my $property (sort keys $schema->{dependencies}->%*) { | ||||
185 | if (is_type('array', $schema->{dependencies}{$property})) { | ||||
186 | # as in dependentRequired | ||||
187 | |||||
188 | foreach my $index (0..$schema->{dependencies}{$property}->$#*) { | ||||
189 | $valid = E({ %$state, _schema_path_suffix => [ $property, $index ] }, 'element #%d is not a string', $index) | ||||
190 | if not is_type('string', $schema->{dependencies}{$property}[$index]); | ||||
191 | } | ||||
192 | |||||
193 | $valid = E({ %$state, _schema_path_suffix => $property }, 'elements are not unique') | ||||
194 | if not is_elements_unique($schema->{dependencies}{$property}); | ||||
195 | } | ||||
196 | else { | ||||
197 | # as in dependentSchemas | ||||
198 | $valid = 0 if not $self->traverse_property_schema($schema, $state, $property); | ||||
199 | } | ||||
200 | } | ||||
201 | return $valid; | ||||
202 | } | ||||
203 | |||||
204 | sub _eval_keyword_dependencies ($self, $data, $schema, $state) { | ||||
205 | return 1 if not is_type('object', $data); | ||||
206 | |||||
207 | my $valid = 1; | ||||
208 | foreach my $property (sort keys $schema->{dependencies}->%*) { | ||||
209 | next if not exists $data->{$property}; | ||||
210 | |||||
211 | if (is_type('array', $schema->{dependencies}{$property})) { | ||||
212 | # as in dependentRequired | ||||
213 | if (my @missing = grep !exists($data->{$_}), $schema->{dependencies}{$property}->@*) { | ||||
214 | $valid = E({ %$state, _schema_path_suffix => $property }, | ||||
215 | 'missing propert%s: %s', @missing > 1 ? 'ies' : 'y', join(', ', @missing)); | ||||
216 | } | ||||
217 | } | ||||
218 | else { | ||||
219 | # as in dependentSchemas | ||||
220 | if ($self->eval($data, $schema->{dependencies}{$property}, | ||||
221 | +{ %$state, schema_path => jsonp($state->{schema_path}, 'dependencies', $property) })) { | ||||
222 | next; | ||||
223 | } | ||||
224 | |||||
225 | $valid = 0; | ||||
226 | last if $state->{short_circuit}; | ||||
227 | } | ||||
228 | } | ||||
229 | |||||
230 | return E($state, 'not all dependencies are satisfied') if not $valid; | ||||
231 | return 1; | ||||
232 | } | ||||
233 | |||||
234 | sub _traverse_keyword_prefixItems { shift->traverse_array_schemas(@_) } | ||||
235 | |||||
236 | sub _eval_keyword_prefixItems { shift->_eval_keyword__items_array_schemas(@_) } | ||||
237 | |||||
238 | 392 | 82µs | # spent 105ms (859µs+104) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_items which was called 98 times, avg 1.07ms/call:
# 98 times (859µs+104ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 1.07ms/call | ||
239 | 98 | 85µs | if (is_plain_arrayref($schema->{items})) { | ||
240 | return E($state, 'array form of "items" not supported in %s', $state->{spec_version}) | ||||
241 | if $state->{spec_version} !~ /^draft(?:7|2019-09)$/; | ||||
242 | |||||
243 | return $self->traverse_array_schemas($schema, $state); | ||||
244 | } | ||||
245 | |||||
246 | 98 | 639µs | 98 | 101ms | $self->traverse_subschema($schema, $state); # spent 109ms making 98 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 1.12ms/call, recursion: max depth 1, sum of overlapping time 7.98ms |
247 | } | ||||
248 | |||||
249 | 8790 | 2.70ms | # spent 23.6s (14.7ms+23.6) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_items which was called 1758 times, avg 13.4ms/call:
# 1758 times (14.7ms+23.6s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 13.4ms/call | ||
250 | return $self->_eval_keyword__items_array_schemas($data, $schema, $state) | ||||
251 | 1758 | 1.26ms | if is_plain_arrayref($schema->{items}); | ||
252 | |||||
253 | 1758 | 8.78ms | 1758 | 23.6s | return $self->_eval_keyword__items_schema($data, $schema, $state); # spent 26.1s making 1758 calls to JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword__items_schema, avg 14.8ms/call, recursion: max depth 4, sum of overlapping time 2.52s |
254 | } | ||||
255 | |||||
256 | sub _traverse_keyword_additionalItems { shift->traverse_subschema(@_) } | ||||
257 | |||||
258 | sub _eval_keyword_additionalItems ($self, $data, $schema, $state) { | ||||
259 | return 1 if not exists $state->{_last_items_index}; | ||||
260 | return $self->_eval_keyword__items_schema($data, $schema, $state); | ||||
261 | } | ||||
262 | |||||
263 | # prefixItems (draft 2020-12), array-based items (all drafts) | ||||
264 | sub _eval_keyword__items_array_schemas ($self, $data, $schema, $state) { | ||||
265 | return 1 if not is_type('array', $data); | ||||
266 | return 1 if ($state->{_last_items_index}//-1) == $data->$#*; | ||||
267 | |||||
268 | my $valid = 1; | ||||
269 | |||||
270 | foreach my $idx (0 .. $data->$#*) { | ||||
271 | last if $idx > $schema->{$state->{keyword}}->$#*; | ||||
272 | $state->{_last_items_index} = $idx; | ||||
273 | |||||
274 | if (is_type('boolean', $schema->{$state->{keyword}}[$idx])) { | ||||
275 | next if $schema->{$state->{keyword}}[$idx]; | ||||
276 | $valid = E({ %$state, data_path => $state->{data_path}.'/'.$idx, | ||||
277 | _schema_path_suffix => $idx }, 'item not permitted'); | ||||
278 | } | ||||
279 | elsif ($self->eval($data->[$idx], $schema->{$state->{keyword}}[$idx], | ||||
280 | +{ %$state, data_path => $state->{data_path}.'/'.$idx, | ||||
281 | schema_path => $state->{schema_path}.'/'.$state->{keyword}.'/'.$idx })) { | ||||
282 | next; | ||||
283 | } | ||||
284 | |||||
285 | $valid = 0; | ||||
286 | last if $state->{short_circuit} and not exists $schema->{ | ||||
287 | $state->{keyword} eq 'prefixItems' ? 'items' | ||||
288 | : $state->{keyword} eq 'items' ? 'additionalItems' : die | ||||
289 | }; | ||||
290 | } | ||||
291 | |||||
292 | A($state, $state->{_last_items_index} == $data->$#* ? true : $state->{_last_items_index}); | ||||
293 | return E($state, 'not all items are valid') if not $valid; | ||||
294 | return 1; | ||||
295 | } | ||||
296 | |||||
297 | # schema-based items (all drafts), and additionalItems (up to and including draft2019-09) | ||||
298 | 8790 | 2.20ms | # spent 23.6s (50.6ms+23.5) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword__items_schema which was called 1758 times, avg 13.4ms/call:
# 1758 times (50.6ms+23.5s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_items at line 253, avg 13.4ms/call | ||
299 | 1758 | 6.79ms | 1758 | 7.00ms | return 1 if not is_type('array', $data); # spent 7.00ms making 1758 calls to JSON::Schema::Modern::Utilities::is_type, avg 4µs/call |
300 | 643 | 800µs | return 1 if ($state->{_last_items_index}//-1) == $data->$#*; | ||
301 | |||||
302 | 643 | 170µs | my $valid = 1; | ||
303 | |||||
304 | 643 | 2.51ms | foreach my $idx (($state->{_last_items_index}//-1)+1 .. $data->$#*) { | ||
305 | 1632 | 3.13ms | 1632 | 12.9ms | if (is_type('boolean', $schema->{$state->{keyword}})) { # spent 12.9ms making 1632 calls to JSON::Schema::Modern::Utilities::is_type, avg 8µs/call |
306 | 189 | 381µs | 189 | 184µs | next if $schema->{$state->{keyword}}; # spent 184µs making 189 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 974ns/call |
307 | $valid = E({ %$state, data_path => $state->{data_path}.'/'.$idx }, | ||||
308 | '%sitem not permitted', | ||||
309 | exists $schema->{prefixItems} || $state->{keyword} eq 'additionalItems' ? 'additional ' : ''); | ||||
310 | } | ||||
311 | else { | ||||
312 | 1443 | 19.0ms | 1443 | 0s | if ($self->eval($data->[$idx], $schema->{$state->{keyword}}, # spent 25.9s making 1443 calls to JSON::Schema::Modern::Vocabulary::eval, avg 17.9ms/call, recursion: max depth 33, sum of overlapping time 25.9s |
313 | +{ %$state, data_path => $state->{data_path}.'/'.$idx, | ||||
314 | schema_path => $state->{schema_path}.'/'.$state->{keyword} })) { | ||||
315 | 1443 | 6.91ms | next; | ||
316 | } | ||||
317 | |||||
318 | $valid = 0; | ||||
319 | } | ||||
320 | last if $state->{short_circuit}; | ||||
321 | } | ||||
322 | |||||
323 | 643 | 899µs | $state->{_last_items_index} = $data->$#*; | ||
324 | |||||
325 | 643 | 1.13ms | 643 | 176ms | A($state, true); # spent 176ms making 643 calls to JSON::Schema::Modern::Utilities::A, avg 274µs/call |
326 | return E($state, 'subschema is not valid against all %sitems', | ||||
327 | 643 | 231µs | $state->{keyword} eq 'additionalItems' ? 'additional ' : '') if not $valid; | ||
328 | 643 | 2.49ms | return 1; | ||
329 | } | ||||
330 | |||||
331 | 3 | 17µs | 3 | 199µs | # spent 7.47ms (20µs+7.45) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_contains which was called 3 times, avg 2.49ms/call:
# 3 times (20µs+7.45ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 2.49ms/call # spent 7.45ms making 3 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 2.48ms/call, recursion: max depth 1, sum of overlapping time 7.25ms |
332 | |||||
333 | sub _eval_keyword_contains ($self, $data, $schema, $state) { | ||||
334 | return 1 if not is_type('array', $data); | ||||
335 | |||||
336 | $state->{_num_contains} = 0; | ||||
337 | my (@errors, @valid); | ||||
338 | foreach my $idx (0 .. $data->$#*) { | ||||
339 | if ($self->eval($data->[$idx], $schema->{contains}, | ||||
340 | +{ %$state, errors => \@errors, | ||||
341 | data_path => $state->{data_path}.'/'.$idx, | ||||
342 | schema_path => $state->{schema_path}.'/contains' })) { | ||||
343 | ++$state->{_num_contains}; | ||||
344 | push @valid, $idx; | ||||
345 | |||||
346 | last if $state->{short_circuit} | ||||
347 | and (not exists $schema->{maxContains} or $state->{_num_contains} > $schema->{maxContains}) | ||||
348 | and ($state->{_num_contains} >= ($schema->{minContains}//1)); | ||||
349 | } | ||||
350 | } | ||||
351 | |||||
352 | # note: no items contained is only valid when minContains is explicitly 0 | ||||
353 | if (not $state->{_num_contains} | ||||
354 | and (($schema->{minContains}//1) > 0 or $state->{spec_version} eq 'draft7')) { | ||||
355 | push $state->{errors}->@*, @errors; | ||||
356 | return E($state, 'subschema is not valid against any item'); | ||||
357 | } | ||||
358 | |||||
359 | return $state->{spec_version} =~ /^draft(?:7|2019-09)$/ ? 1 | ||||
360 | : A($state, @valid == @$data ? true : \@valid); | ||||
361 | } | ||||
362 | |||||
363 | 387 | 1.86ms | 387 | 299ms | # spent 343ms (2.26+341) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_properties which was called 387 times, avg 887µs/call:
# 387 times (2.26ms+341ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 887µs/call # spent 382ms making 387 calls to JSON::Schema::Modern::Vocabulary::traverse_object_schemas, avg 987µs/call, recursion: max depth 3, sum of overlapping time 83.2ms |
364 | |||||
365 | 162460 | 35.6ms | # spent 99.4s (844ms+98.5) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_properties which was called 32492 times, avg 3.06ms/call:
# 32492 times (844ms+98.5s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 3.06ms/call | ||
366 | 32492 | 97.6ms | 32492 | 124ms | return 1 if not is_type('object', $data); # spent 124ms making 32492 calls to JSON::Schema::Modern::Utilities::is_type, avg 4µs/call |
367 | |||||
368 | 28612 | 8.85ms | my $valid = 1; | ||
369 | 28612 | 5.12ms | my @properties; | ||
370 | 28612 | 231ms | 28612 | 51.7ms | foreach my $property (sort keys $schema->{properties}->%*) { # spent 51.7ms making 28612 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 2µs/call |
371 | 166967 | 45.7ms | next if not exists $data->{$property}; | ||
372 | 11057 | 6.43ms | push @properties, $property; | ||
373 | |||||
374 | 11057 | 17.3ms | 11057 | 93.9ms | if (is_type('boolean', $schema->{properties}{$property})) { # spent 93.9ms making 11057 calls to JSON::Schema::Modern::Utilities::is_type, avg 8µs/call |
375 | 145 | 459µs | 145 | 266µs | next if $schema->{properties}{$property}; # spent 266µs making 145 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 2µs/call |
376 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
377 | _schema_path_suffix => $property }, 'property not permitted'); | ||||
378 | } | ||||
379 | else { | ||||
380 | 10912 | 149ms | 32736 | 99.6s | if ($self->eval($data->{$property}, $schema->{properties}{$property}, # spent 469s making 10912 calls to JSON::Schema::Modern::Vocabulary::eval, avg 43.0ms/call, recursion: max depth 33, sum of overlapping time 370s
# spent 173ms making 21824 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call |
381 | +{ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
382 | schema_path => jsonp($state->{schema_path}, 'properties', $property) })) { | ||||
383 | 10113 | 51.9ms | next; | ||
384 | } | ||||
385 | |||||
386 | 799 | 482µs | $valid = 0; | ||
387 | } | ||||
388 | 799 | 596µs | last if $state->{short_circuit}; | ||
389 | } | ||||
390 | |||||
391 | 28612 | 51.4ms | 28612 | 8.03s | A($state, \@properties); # spent 8.03s making 28612 calls to JSON::Schema::Modern::Utilities::A, avg 281µs/call |
392 | 28612 | 12.3ms | 799 | 207ms | return E($state, 'not all properties are valid') if not $valid; # spent 207ms making 799 calls to JSON::Schema::Modern::Utilities::E, avg 259µs/call |
393 | 27813 | 71.0ms | return 1; | ||
394 | } | ||||
395 | |||||
396 | 24 | 13µs | # spent 1.96ms (151µs+1.81) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_patternProperties which was called 6 times, avg 327µs/call:
# 6 times (151µs+1.81ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 327µs/call | ||
397 | 6 | 13µs | 6 | 38µs | return if not assert_keyword_type($state, $schema, 'object'); # spent 38µs making 6 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 6µs/call |
398 | |||||
399 | 6 | 1µs | my $valid = 1; | ||
400 | 6 | 24µs | 6 | 2µs | foreach my $property (sort keys $schema->{patternProperties}->%*) { # spent 2µs making 6 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 333ns/call |
401 | 6 | 41µs | 6 | 285µs | $valid = 0 if not assert_pattern({ %$state, _schema_path_suffix => $property }, $property); # spent 285µs making 6 calls to JSON::Schema::Modern::Utilities::assert_pattern, avg 47µs/call |
402 | 6 | 26µs | 6 | 1.49ms | $valid = 0 if not $self->traverse_property_schema($schema, $state, $property); # spent 1.49ms making 6 calls to JSON::Schema::Modern::Vocabulary::traverse_property_schema, avg 248µs/call |
403 | } | ||||
404 | 6 | 29µs | return $valid; | ||
405 | } | ||||
406 | |||||
407 | 16845 | 4.79ms | # spent 82.3s (138ms+82.1) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties which was called 3369 times, avg 24.4ms/call:
# 3369 times (138ms+82.1s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 24.4ms/call | ||
408 | 3369 | 7.02ms | 3369 | 12.8ms | return 1 if not is_type('object', $data); # spent 12.8ms making 3369 calls to JSON::Schema::Modern::Utilities::is_type, avg 4µs/call |
409 | |||||
410 | 3369 | 1.11ms | my $valid = 1; | ||
411 | 3369 | 698µs | my @properties; | ||
412 | 3369 | 14.7ms | 3369 | 1.52ms | foreach my $property_pattern (sort keys $schema->{patternProperties}->%*) { # spent 1.52ms making 3369 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 450ns/call |
413 | 3369 | 86.4ms | 20041 | 36.1ms | foreach my $property (sort grep m/$property_pattern/, keys %$data) { # spent 30.7ms making 8336 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp, avg 4µs/call
# spent 4.31ms making 8336 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:match, avg 517ns/call
# spent 1.08ms making 3369 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 321ns/call |
414 | 1799 | 1.13ms | push @properties, $property; | ||
415 | 1799 | 2.65ms | 1799 | 19.0ms | if (is_type('boolean', $schema->{patternProperties}{$property_pattern})) { # spent 19.0ms making 1799 calls to JSON::Schema::Modern::Utilities::is_type, avg 11µs/call |
416 | 1061 | 2.08ms | 1061 | 1.27ms | next if $schema->{patternProperties}{$property_pattern}; # spent 1.27ms making 1061 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 1µs/call |
417 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
418 | _schema_path_suffix => $property_pattern }, 'property not permitted'); | ||||
419 | } | ||||
420 | else { | ||||
421 | 738 | 12.4ms | 2214 | 11.6ms | if ($self->eval($data->{$property}, $schema->{patternProperties}{$property_pattern}, # spent 11.6ms making 1476 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call
# spent 119s making 738 calls to JSON::Schema::Modern::Vocabulary::eval, avg 162ms/call, recursion: max depth 4, sum of overlapping time 119s |
422 | +{ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
423 | schema_path => jsonp($state->{schema_path}, 'patternProperties', $property_pattern) })) { | ||||
424 | 738 | 5.99ms | next; | ||
425 | } | ||||
426 | |||||
427 | $valid = 0; | ||||
428 | } | ||||
429 | last if $state->{short_circuit}; | ||||
430 | } | ||||
431 | } | ||||
432 | |||||
433 | 3369 | 20.1ms | 6738 | 970ms | A($state, [ uniqstr @properties ]); # spent 963ms making 3369 calls to JSON::Schema::Modern::Utilities::A, avg 286µs/call
# spent 7.19ms making 3369 calls to List::Util::uniqstr, avg 2µs/call |
434 | 3369 | 1.23ms | return E($state, 'not all properties are valid') if not $valid; | ||
435 | 3369 | 9.89ms | return 1; | ||
436 | } | ||||
437 | |||||
438 | 130 | 772µs | 130 | 31.6ms | # spent 33.4ms (849µs+32.6) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_additionalProperties which was called 130 times, avg 257µs/call:
# 130 times (849µs+32.6ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 257µs/call # spent 39.6ms making 130 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 305µs/call, recursion: max depth 2, sum of overlapping time 7.98ms |
439 | |||||
440 | 4885 | 1.59ms | # spent 70.6s (66.3ms+70.6) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_additionalProperties which was called 977 times, avg 72.3ms/call:
# 977 times (66.3ms+70.6s) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 72.3ms/call | ||
441 | 977 | 1.79ms | 977 | 3.12ms | return 1 if not is_type('object', $data); # spent 3.12ms making 977 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
442 | |||||
443 | 977 | 255µs | my $valid = 1; | ||
444 | 977 | 218µs | my @properties; | ||
445 | 977 | 7.25ms | 977 | 646µs | foreach my $property (sort keys %$data) { # spent 646µs making 977 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 661ns/call |
446 | 1835 | 1.42ms | next if exists $schema->{properties} and exists $schema->{properties}{$property}; | ||
447 | next if exists $schema->{patternProperties} | ||||
448 | 1835 | 709µs | and any { $property =~ /$_/ } keys $schema->{patternProperties}->%*; | ||
449 | |||||
450 | 1835 | 1.60ms | push @properties, $property; | ||
451 | 1835 | 3.09ms | 1835 | 16.5ms | if (is_type('boolean', $schema->{additionalProperties})) { # spent 16.5ms making 1835 calls to JSON::Schema::Modern::Utilities::is_type, avg 9µs/call |
452 | next if $schema->{additionalProperties}; | ||||
453 | $valid = E({ %$state, data_path => jsonp($state->{data_path}, $property) }, | ||||
454 | 'additional property not permitted'); | ||||
455 | } | ||||
456 | else { | ||||
457 | 1835 | 27.1ms | 3670 | 15.4ms | if ($self->eval($data->{$property}, $schema->{additionalProperties}, # spent 15.4ms making 1835 calls to JSON::Schema::Modern::Utilities::jsonp, avg 8µs/call
# spent 115s making 1835 calls to JSON::Schema::Modern::Vocabulary::eval, avg 62.6ms/call, recursion: max depth 30, sum of overlapping time 115s |
458 | +{ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
459 | schema_path => $state->{schema_path}.'/additionalProperties' })) { | ||||
460 | 1835 | 9.80ms | next; | ||
461 | } | ||||
462 | |||||
463 | $valid = 0; | ||||
464 | } | ||||
465 | last if $state->{short_circuit}; | ||||
466 | } | ||||
467 | |||||
468 | 977 | 1.84ms | 977 | 253ms | A($state, \@properties); # spent 253ms making 977 calls to JSON::Schema::Modern::Utilities::A, avg 259µs/call |
469 | 977 | 361µs | return E($state, 'not all additional properties are valid') if not $valid; | ||
470 | 977 | 3.48ms | return 1; | ||
471 | } | ||||
472 | |||||
473 | 14 | 90µs | 14 | 5.01ms | # spent 5.18ms (78µs+5.10) within JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_propertyNames which was called 14 times, avg 370µs/call:
# 14 times (78µs+5.10ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 370µs/call # spent 5.10ms making 14 calls to JSON::Schema::Modern::Vocabulary::traverse_subschema, avg 364µs/call, recursion: max depth 1, sum of overlapping time 90µs |
474 | |||||
475 | 3135 | 972µs | # spent 449ms (21.4+427) within JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_propertyNames which was called 627 times, avg 716µs/call:
# 627 times (21.4ms+427ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 716µs/call | ||
476 | 627 | 1.03ms | 627 | 1.84ms | return 1 if not is_type('object', $data); # spent 1.84ms making 627 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
477 | |||||
478 | 627 | 227µs | my $valid = 1; | ||
479 | 627 | 3.30ms | 627 | 235µs | foreach my $property (sort keys %$data) { # spent 235µs making 627 calls to JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort, avg 375ns/call |
480 | 713 | 9.18ms | 1426 | 6.39ms | if ($self->eval($property, $schema->{propertyNames}, # spent 6.39ms making 713 calls to JSON::Schema::Modern::Utilities::jsonp, avg 9µs/call
# spent 419ms making 713 calls to JSON::Schema::Modern::Vocabulary::eval, avg 587µs/call, recursion: max depth 7, sum of overlapping time 419ms |
481 | +{ %$state, data_path => jsonp($state->{data_path}, $property), | ||||
482 | schema_path => $state->{schema_path}.'/propertyNames' })) { | ||||
483 | 713 | 2.65ms | next; | ||
484 | } | ||||
485 | |||||
486 | $valid = 0; | ||||
487 | last if $state->{short_circuit}; | ||||
488 | } | ||||
489 | |||||
490 | 627 | 222µs | return E($state, 'not all property names are valid') if not $valid; | ||
491 | 627 | 2.23ms | return 1; | ||
492 | } | ||||
493 | |||||
494 | 1 | 8µs | 1; | ||
495 | |||||
496 | 1 | 40µs | 1 | 383µs | __END__ # spent 383µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 4.32ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:match which was called 8340 times, avg 518ns/call:
# 8336 times (4.31ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 413, avg 517ns/call
# 4 times (4µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 1µs/call | |||||
# spent 6µs within JSON::Schema::Modern::Vocabulary::Applicator::CORE:qr which was called 4 times, avg 2µs/call:
# 4 times (6µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 2µs/call | |||||
# spent 30.7ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:regcomp which was called 8340 times, avg 4µs/call:
# 8336 times (30.7ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 413, avg 4µs/call
# 4 times (6µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::keywords at line 44, avg 2µs/call | |||||
# spent 55.4ms within JSON::Schema::Modern::Vocabulary::Applicator::CORE:sort which was called 37265 times, avg 1µs/call:
# 28612 times (51.7ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_properties at line 370, avg 2µs/call
# 3369 times (1.52ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 412, avg 450ns/call
# 3369 times (1.08ms+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_patternProperties at line 413, avg 321ns/call
# 977 times (646µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_additionalProperties at line 445, avg 661ns/call
# 627 times (235µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_propertyNames at line 479, avg 375ns/call
# 305 times (167µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_eval_keyword_dependentSchemas at line 164, avg 548ns/call
# 6 times (2µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::_traverse_keyword_patternProperties at line 400, avg 333ns/call | |||||
# spent 1µs within JSON::Schema::Modern::Vocabulary::Applicator::__ANON__ which was called:
# once (1µs+0s) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 at line 21 |