| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/Validation.pm |
| Statements | Executed 427780 statements in 569ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 35648 | 1 | 1 | 401ms | 974ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_type |
| 4795 | 1 | 1 | 52.8ms | 468ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_required |
| 1538 | 1 | 1 | 18.1ms | 248ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_enum |
| 1382 | 1 | 1 | 16.9ms | 47.7ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_type |
| 1208 | 1 | 1 | 14.2ms | 278ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_const |
| 1403 | 1 | 1 | 8.93ms | 86.1ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_uniqueItems |
| 1244 | 1 | 1 | 7.28ms | 11.1ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minItems |
| 485 | 1 | 1 | 3.61ms | 4.87ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minProperties |
| 275 | 1 | 1 | 3.36ms | 96.3ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_required |
| 262 | 1 | 1 | 2.70ms | 7.01ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern |
| 262 | 1 | 1 | 826µs | 826µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:match (opcode) |
| 69 | 1 | 1 | 522µs | 4.96ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_pattern |
| 87 | 8 | 1 | 504µs | 1.75ms | JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer |
| 79 | 1 | 1 | 496µs | 1.42ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minimum |
| 262 | 1 | 1 | 470µs | 470µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:regcomp (opcode) |
| 60 | 1 | 1 | 283µs | 601µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_enum |
| 50 | 1 | 1 | 268µs | 1.41ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties |
| 95 | 1 | 1 | 147µs | 147µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_const |
| 21 | 1 | 1 | 133µs | 528µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum |
| 30 | 3 | 1 | 129µs | 543µs | JSON::Schema::Modern::Vocabulary::Validation::_assert_number |
| 15 | 1 | 1 | 116µs | 164µs | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxProperties |
| 1 | 1 | 1 | 55µs | 76µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_dependentRequired |
| 14 | 1 | 1 | 55µs | 256µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems |
| 1 | 1 | 1 | 39µs | 132µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20 |
| 1 | 1 | 1 | 37µs | 73µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17 |
| 8 | 1 | 1 | 37µs | 183µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength |
| 8 | 1 | 1 | 35µs | 172µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength |
| 1 | 1 | 1 | 33µs | 41µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains |
| 1 | 1 | 1 | 33µs | 36µs | Module::Runtime::BEGIN@1.310 |
| 8 | 1 | 1 | 31µs | 166µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum |
| 1 | 1 | 1 | 29µs | 37µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15 |
| 1 | 1 | 1 | 26µs | 65µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13 |
| 1 | 1 | 1 | 19µs | 944µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 |
| 3 | 1 | 1 | 18µs | 73µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties |
| 1 | 1 | 1 | 16µs | 257µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 |
| 1 | 1 | 1 | 16µs | 6.75ms | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19 |
| 2 | 2 | 1 | 16µs | 16µs | JSON::Schema::Modern::Vocabulary::Validation::keywords |
| 2 | 1 | 1 | 15µs | 62µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains |
| 1 | 1 | 1 | 12µs | 467µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21 |
| 3 | 1 | 1 | 12µs | 61µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_uniqueItems |
| 1 | 1 | 1 | 10µs | 31µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14 |
| 1 | 1 | 1 | 10µs | 10µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@9 |
| 1 | 1 | 1 | 8µs | 31µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18 |
| 1 | 1 | 1 | 6µs | 178µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 |
| 1 | 1 | 1 | 6µs | 17µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@16 |
| 1 | 1 | 1 | 6µs | 19µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum |
| 1 | 1 | 1 | 5µs | 36µs | Module::Runtime::BEGIN@2.311 |
| 1 | 1 | 1 | 4µs | 14µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems |
| 5 | 1 | 1 | 3µs | 3µs | JSON::Schema::Modern::Vocabulary::Validation::evaluation_order |
| 1 | 1 | 1 | 1µs | 1µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:sort (opcode) |
| 1 | 1 | 1 | 1µs | 1µs | JSON::Schema::Modern::Vocabulary::Validation::vocabulary |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::__ANON__[:263] |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::__ANON__[:49] |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::__ANON__[:56] |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::__ANON__[:67] |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::__ANON__[:85] |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_dependentRequired |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_exclusiveMaximum |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_exclusiveMinimum |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxContains |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxItems |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxLength |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maximum |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minContains |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minLength |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_multipleOf |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMaximum |
| 0 | 0 | 0 | 0s | 0s | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_multipleOf |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 2 | 28µs | 2 | 39µs | # spent 36µs (33+3) within Module::Runtime::BEGIN@1.310 which was called:
# once (33µs+3µs) by Module::Runtime::require_module at line 1 # spent 36µs making 1 call to Module::Runtime::BEGIN@1.310
# spent 3µs making 1 call to strict::import |
| 2 | 2 | 45µs | 2 | 67µs | # spent 36µs (5+31) within Module::Runtime::BEGIN@2.311 which was called:
# once (5µs+31µs) by Module::Runtime::require_module at line 2 # spent 36µs making 1 call to Module::Runtime::BEGIN@2.311
# spent 31µs making 1 call to warnings::import |
| 3 | package JSON::Schema::Modern::Vocabulary::Validation; | ||||
| 4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||
| 5 | # ABSTRACT: Implementation of the JSON Schema Validation vocabulary | ||||
| 6 | |||||
| 7 | 1 | 2µs | our $VERSION = '0.556'; | ||
| 8 | |||||
| 9 | 2 | 28µs | 1 | 10µs | # spent 10µs within JSON::Schema::Modern::Vocabulary::Validation::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::Validation::BEGIN@9 |
| 10 | 2 | 25µs | 2 | 350µs | # spent 178µs (6+172) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 which was called:
# once (6µs+172µs) by Module::Runtime::require_module at line 10 # spent 178µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10
# spent 172µs making 1 call to Moo::import |
| 11 | 3 | 79µs | 3 | 1.87ms | # spent 944µs (19+925) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 which was called:
# once (19µs+925µs) by Module::Runtime::require_module at line 11 # spent 944µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11
# spent 913µs making 1 call to strictures::import
# spent 12µs making 1 call to strictures::VERSION |
| 12 | 2 | 80µs | 2 | 498µs | # spent 257µs (16+241) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 which was called:
# once (16µs+241µs) by Module::Runtime::require_module at line 12 # spent 257µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12
# spent 241µs making 1 call to experimental::import |
| 13 | 2 | 37µs | 2 | 70µs | # spent 65µs (26+39) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13 which was called:
# once (26µs+39µs) by Module::Runtime::require_module at line 13 # spent 65µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13
# spent 5µs making 1 call to if::import |
| 14 | 2 | 45µs | 2 | 34µs | # spent 31µs (10+21) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14 which was called:
# once (10µs+21µs) by Module::Runtime::require_module at line 14 # spent 31µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14
# spent 3µs making 1 call to if::unimport |
| 15 | 2 | 18µs | 2 | 38µs | # spent 37µs (29+8) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15 which was called:
# once (29µs+8µs) by Module::Runtime::require_module at line 15 # spent 37µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15
# spent 1µs making 1 call to if::unimport |
| 16 | 2 | 43µs | 2 | 18µs | # spent 17µs (6+11) within JSON::Schema::Modern::Vocabulary::Validation::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::Validation::BEGIN@16
# spent 1µs making 1 call to if::unimport |
| 17 | 2 | 19µs | 2 | 85µs | # spent 73µs (37+36) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17 which was called:
# once (37µs+36µs) by Module::Runtime::require_module at line 17 # spent 73µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17
# spent 12µs making 1 call to List::Util::import |
| 18 | 3 | 34µs | 3 | 54µs | # spent 31µs (8+23) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18 which was called:
# once (8µs+23µs) by Module::Runtime::require_module at line 18 # spent 31µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18
# spent 13µs making 1 call to Exporter::import
# spent 10µs making 1 call to UNIVERSAL::VERSION |
| 19 | 2 | 206µs | 2 | 6.76ms | # spent 6.75ms (16µs+6.74) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19 which was called:
# once (16µs+6.74ms) by Module::Runtime::require_module at line 19 # spent 6.75ms making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19
# spent 2µs making 1 call to if::import |
| 20 | 2 | 53µs | 2 | 225µs | # spent 132µs (39+93) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20 which was called:
# once (39µs+93µs) by Module::Runtime::require_module at line 20 # spent 132µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20
# spent 93µs making 1 call to Exporter::import |
| 21 | 2 | 3.66ms | 2 | 922µs | # spent 467µs (12+455) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21 which was called:
# once (12µs+455µs) by Module::Runtime::require_module at line 21 # spent 467µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21
# spent 455µs making 1 call to namespace::clean::import |
| 22 | |||||
| 23 | 1 | 4µs | 1 | 934µs | with 'JSON::Schema::Modern::Vocabulary'; # spent 934µs making 1 call to Moo::with |
| 24 | |||||
| 25 | # spent 1µs within JSON::Schema::Modern::Vocabulary::Validation::vocabulary which was called:
# once (1µ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 | ||||
| 26 | 1 | 2µs | 'https://json-schema.org/draft/2019-09/vocab/validation' => 'draft2019-09', | ||
| 27 | 'https://json-schema.org/draft/2020-12/vocab/validation' => 'draft2020-12'; | ||||
| 28 | } | ||||
| 29 | |||||
| 30 | 5 | 7µs | # spent 3µs within JSON::Schema::Modern::Vocabulary::Validation::evaluation_order which was called 5 times, avg 600ns/call:
# 5 times (3µs+0s) by JSON::Schema::Modern::Vocabulary::Core::CORE:sort at line 331 of JSON/Schema/Modern/Vocabulary/Core.pm, avg 600ns/call | ||
| 31 | |||||
| 32 | 6 | 4µs | # spent 16µs within JSON::Schema::Modern::Vocabulary::Validation::keywords which was called 2 times, avg 8µs/call:
# once (8µs+0s) by JSON::Schema::Modern::_eval_subschema at line 559 of JSON/Schema/Modern.pm
# once (8µs+0s) by JSON::Schema::Modern::_traverse_subschema at line 471 of JSON/Schema/Modern.pm | ||
| 33 | return ( | ||||
| 34 | 2 | 21µs | qw(type enum const | ||
| 35 | multipleOf maximum exclusiveMaximum minimum exclusiveMinimum | ||||
| 36 | maxLength minLength pattern | ||||
| 37 | maxItems minItems uniqueItems), | ||||
| 38 | $spec_version ne 'draft7' ? qw(maxContains minContains) : (), | ||||
| 39 | qw(maxProperties minProperties required), | ||||
| 40 | $spec_version ne 'draft7' ? 'dependentRequired' : (), | ||||
| 41 | ); | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | 5528 | 1.12ms | # spent 47.7ms (16.9+30.8) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_type which was called 1382 times, avg 35µs/call:
# 1382 times (16.9ms+30.8ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 35µs/call | ||
| 45 | 1382 | 3.32ms | if (is_plain_arrayref($schema->{type})) { | ||
| 46 | 76 | 58µs | return E($state, 'type array is empty') if not $schema->{type}->@*; | ||
| 47 | 76 | 83µs | foreach my $type ($schema->{type}->@*) { | ||
| 48 | return E($state, 'unrecognized type "%s"', $type//'<null>') | ||||
| 49 | 692 | 880µs | 158 | 331µs | if not any { ($type//'') eq $_ } qw(null boolean object array string number integer); # spent 331µs making 158 calls to List::Util::any, avg 2µs/call |
| 50 | } | ||||
| 51 | 76 | 173µs | 76 | 3.58ms | return E($state, '"type" values are not unique') if not is_elements_unique($schema->{type}); # spent 3.58ms making 76 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 47µs/call |
| 52 | } | ||||
| 53 | else { | ||||
| 54 | 1306 | 1.87ms | 1306 | 22.3ms | return if not assert_keyword_type($state, $schema, 'string'); # spent 22.3ms making 1306 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 17µs/call |
| 55 | return E($state, 'unrecognized type "%s"', $schema->{type}//'<null>') | ||||
| 56 | 6440 | 10.2ms | 1306 | 4.60ms | if not any { ($schema->{type}//'') eq $_ } qw(null boolean object array string number integer); # spent 4.60ms making 1306 calls to List::Util::any, avg 4µs/call |
| 57 | } | ||||
| 58 | 1382 | 3.69ms | return 1; | ||
| 59 | } | ||||
| 60 | |||||
| 61 | 178240 | 44.4ms | # spent 974ms (401+573) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_type which was called 35648 times, avg 27µs/call:
# 35648 times (401ms+573ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 27µs/call | ||
| 62 | 35648 | 52.3ms | 35648 | 185ms | my $type = get_type($data); # spent 185ms making 35648 calls to JSON::Schema::Modern::Utilities::get_type, avg 5µs/call |
| 63 | 35648 | 22.8ms | if (is_plain_arrayref($schema->{type})) { | ||
| 64 | return 1 if any { | ||||
| 65 | $type eq $_ or ($_ eq 'number' and $type eq 'integer') | ||||
| 66 | 26766 | 169ms | or ($_ eq 'boolean' and $state->{scalarref_booleans} and $type eq 'reference to SCALAR') | ||
| 67 | 23274 | 101ms | 23274 | 63.1ms | } $schema->{type}->@*; # spent 63.1ms making 23274 calls to List::Util::any, avg 3µs/call |
| 68 | return E($state, 'got %s, not one of %s', $type, join(', ', $schema->{type}->@*)); | ||||
| 69 | } | ||||
| 70 | else { | ||||
| 71 | return 1 if $type eq $schema->{type} or ($schema->{type} eq 'number' and $type eq 'integer') | ||||
| 72 | 12374 | 29.4ms | or ($schema->{type} eq 'boolean' and $state->{scalarref_booleans} and $type eq 'reference to SCALAR'); | ||
| 73 | 1115 | 5.32ms | 1115 | 325ms | return E($state, 'got %s, not %s', $type, $schema->{type}); # spent 325ms making 1115 calls to JSON::Schema::Modern::Utilities::E, avg 291µs/call |
| 74 | } | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | 240 | 45µs | # spent 601µs (283+318) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_enum which was called 60 times, avg 10µs/call:
# 60 times (283µs+318µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 10µs/call | ||
| 78 | 60 | 69µs | 60 | 318µs | return if not assert_keyword_type($state, $schema, 'array'); # spent 318µs making 60 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 5µs/call |
| 79 | 60 | 117µs | return 1; | ||
| 80 | } | ||||
| 81 | |||||
| 82 | 7690 | 2.55ms | # spent 248ms (18.1+230) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_enum which was called 1538 times, avg 161µs/call:
# 1538 times (18.1ms+230ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 161µs/call | ||
| 83 | 3076 | 938µs | my @s; my $idx = 0; | ||
| 84 | 1538 | 2.50ms | my %s = ( scalarref_booleans => $state->{scalarref_booleans} ); | ||
| 85 | 9032 | 30.0ms | 9032 | 397ms | return 1 if any { is_equal($data, $_, $s[$idx++] = {%s}) } $schema->{enum}->@*; # spent 210ms making 1538 calls to List::Util::any, avg 137µs/call
# spent 187ms making 7494 calls to JSON::Schema::Modern::Utilities::is_equal, avg 25µs/call |
| 86 | return E($state, 'value does not match' | ||||
| 87 | .(!(grep $_->{path}, @s) ? '' | ||||
| 88 | 66 | 535µs | 66 | 19.6ms | : ' (differences start '.join(', ', map 'from item #'.$_.' at "'.$s[$_]->{path}.'"', 0..$#s).')')); # spent 19.6ms making 66 calls to JSON::Schema::Modern::Utilities::E, avg 297µs/call |
| 89 | } | ||||
| 90 | |||||
| 91 | 95 | 231µs | # spent 147µs within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_const which was called 95 times, avg 2µs/call:
# 95 times (147µs+0s) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 2µs/call | ||
| 92 | |||||
| 93 | 6040 | 1.72ms | # spent 278ms (14.2+264) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_const which was called 1208 times, avg 230µs/call:
# 1208 times (14.2ms+264ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 230µs/call | ||
| 94 | 1208 | 1.76ms | my %s = ( scalarref_booleans => $state->{scalarref_booleans} ); | ||
| 95 | 1208 | 4.63ms | 1208 | 44.3ms | return 1 if is_equal($data, $schema->{const}, my $s = { scalarref_booleans => $state->{scalarref_booleans} }); # spent 44.3ms making 1208 calls to JSON::Schema::Modern::Utilities::is_equal, avg 37µs/call |
| 96 | return E($state, 'value does not match' | ||||
| 97 | 799 | 4.61ms | 799 | 220ms | .($s->{path} ? ' (differences start at "'.$s->{path}.'")' : '')); # spent 220ms making 799 calls to JSON::Schema::Modern::Utilities::E, avg 275µs/call |
| 98 | } | ||||
| 99 | |||||
| 100 | sub _traverse_keyword_multipleOf ($self, $schema, $state) { | ||||
| 101 | return if not assert_keyword_type($state, $schema, 'number'); | ||||
| 102 | return E($state, 'multipleOf value is not a positive number') if $schema->{multipleOf} <= 0; | ||||
| 103 | return 1; | ||||
| 104 | } | ||||
| 105 | |||||
| 106 | sub _eval_keyword_multipleOf ($self, $data, $schema, $state) { | ||||
| 107 | return 1 if not is_type('number', $data); | ||||
| 108 | |||||
| 109 | # if either value is a float, use the bignum library for the calculation for an accurate remainder | ||||
| 110 | if (ref($data) =~ /^Math::Big(?:Int|Float)$/ or ref($schema->{multipleOf}) =~ /^Math::Big(?:Int|Float)$/) { | ||||
| 111 | $data = ref($data) =~ /^Math::Big(?:Int|Float)$/ ? $data->copy : Math::BigFloat->new($data); | ||||
| 112 | my $divisor = ref($schema->{multipleOf}) =~ /^Math::Big(?:Int|Float)$/ ? $schema->{multipleOf} : Math::BigFloat->new($schema->{multipleOf}); | ||||
| 113 | my ($quotient, $remainder) = $data->bdiv($divisor); | ||||
| 114 | return E($state, 'overflow while calculating quotient') if $quotient->is_inf; | ||||
| 115 | return 1 if $remainder == 0; | ||||
| 116 | } | ||||
| 117 | else { | ||||
| 118 | my $quotient = $data / $schema->{multipleOf}; | ||||
| 119 | return E($state, 'overflow while calculating quotient') | ||||
| 120 | if "$]" >= 5.022 ? isinf($quotient) : $quotient =~ /^-?Inf$/i; | ||||
| 121 | return 1 if int($quotient) == $quotient; | ||||
| 122 | } | ||||
| 123 | |||||
| 124 | return E($state, 'value is not a multiple of %s', sprintf_num($schema->{multipleOf})); | ||||
| 125 | } | ||||
| 126 | |||||
| 127 | 8 | 37µs | 8 | 135µs | # spent 166µs (31+135) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum which was called 8 times, avg 21µs/call:
# 8 times (31µs+135µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 21µs/call # spent 135µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_number, avg 17µs/call |
| 128 | |||||
| 129 | sub _eval_keyword_maximum ($self, $data, $schema, $state) { | ||||
| 130 | return 1 if not is_type('number', $data); | ||||
| 131 | return 1 if $data <= $schema->{maximum}; | ||||
| 132 | return E($state, 'value is larger than %s', sprintf_num($schema->{maximum})); | ||||
| 133 | } | ||||
| 134 | |||||
| 135 | sub _traverse_keyword_exclusiveMaximum { shift->_assert_number(@_) } | ||||
| 136 | |||||
| 137 | sub _eval_keyword_exclusiveMaximum ($self, $data, $schema, $state) { | ||||
| 138 | return 1 if not is_type('number', $data); | ||||
| 139 | return 1 if $data < $schema->{exclusiveMaximum}; | ||||
| 140 | return E($state, 'value is equal to or larger than %s', sprintf_num($schema->{exclusiveMaximum})); | ||||
| 141 | } | ||||
| 142 | |||||
| 143 | 21 | 92µs | 21 | 395µs | # spent 528µs (133+395) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum which was called 21 times, avg 25µs/call:
# 21 times (133µs+395µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 25µs/call # spent 395µs making 21 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_number, avg 19µs/call |
| 144 | |||||
| 145 | 395 | 111µs | # spent 1.42ms (496µs+921µs) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minimum which was called 79 times, avg 18µs/call:
# 79 times (496µs+921µs) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 18µs/call | ||
| 146 | 79 | 124µs | 79 | 921µs | return 1 if not is_type('number', $data); # spent 921µs making 79 calls to JSON::Schema::Modern::Utilities::is_type, avg 12µs/call |
| 147 | 79 | 182µs | return 1 if $data >= $schema->{minimum}; | ||
| 148 | return E($state, 'value is smaller than %s', sprintf_num($schema->{minimum})); | ||||
| 149 | } | ||||
| 150 | |||||
| 151 | 1 | 5µs | 1 | 13µs | # spent 19µs (6+13) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum which was called:
# once (6µs+13µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm # spent 13µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::_assert_number |
| 152 | |||||
| 153 | sub _eval_keyword_exclusiveMinimum ($self, $data, $schema, $state) { | ||||
| 154 | return 1 if not is_type('number', $data); | ||||
| 155 | return 1 if $data > $schema->{exclusiveMinimum}; | ||||
| 156 | return E($state, 'value is equal to or smaller than %s', sprintf_num($schema->{exclusiveMinimum})); | ||||
| 157 | } | ||||
| 158 | |||||
| 159 | 8 | 33µs | 8 | 137µs | # spent 172µs (35+137) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength which was called 8 times, avg 22µs/call:
# 8 times (35µs+137µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 22µs/call # spent 137µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 17µs/call |
| 160 | |||||
| 161 | sub _eval_keyword_maxLength ($self, $data, $schema, $state) { | ||||
| 162 | return 1 if not is_type('string', $data); | ||||
| 163 | return 1 if length($data) <= $schema->{maxLength}; | ||||
| 164 | return E($state, 'length is greater than %d', $schema->{maxLength}); | ||||
| 165 | } | ||||
| 166 | |||||
| 167 | 8 | 32µs | 8 | 146µs | # spent 183µs (37+146) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength which was called 8 times, avg 23µs/call:
# 8 times (37µs+146µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 23µs/call # spent 146µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 18µs/call |
| 168 | |||||
| 169 | sub _eval_keyword_minLength ($self, $data, $schema, $state) { | ||||
| 170 | |||||
| 171 | return 1 if not is_type('string', $data); | ||||
| 172 | return 1 if length($data) >= $schema->{minLength}; | ||||
| 173 | return E($state, 'length is less than %d', $schema->{minLength}); | ||||
| 174 | } | ||||
| 175 | |||||
| 176 | 276 | 53µs | # spent 4.96ms (522µs+4.44) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_pattern which was called 69 times, avg 72µs/call:
# 69 times (522µs+4.44ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 72µs/call | ||
| 177 | return if not assert_keyword_type($state, $schema, 'string') | ||||
| 178 | 69 | 218µs | 138 | 4.44ms | or not assert_pattern($state, $schema->{pattern}); # spent 3.35ms making 69 calls to JSON::Schema::Modern::Utilities::assert_pattern, avg 49µs/call
# spent 1.08ms making 69 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 16µs/call |
| 179 | 69 | 154µs | return 1; | ||
| 180 | } | ||||
| 181 | |||||
| 182 | 1310 | 403µs | # spent 7.01ms (2.70+4.31) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern which was called 262 times, avg 27µs/call:
# 262 times (2.70ms+4.31ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 27µs/call | ||
| 183 | 262 | 360µs | 262 | 3.01ms | return 1 if not is_type('string', $data); # spent 3.01ms making 262 calls to JSON::Schema::Modern::Utilities::is_type, avg 12µs/call |
| 184 | |||||
| 185 | 262 | 2.88ms | 524 | 1.30ms | return 1 if $data =~ m/$schema->{pattern}/; # spent 826µs making 262 calls to JSON::Schema::Modern::Vocabulary::Validation::CORE:match, avg 3µs/call
# spent 470µs making 262 calls to JSON::Schema::Modern::Vocabulary::Validation::CORE:regcomp, avg 2µs/call |
| 186 | return E($state, 'pattern does not match'); | ||||
| 187 | } | ||||
| 188 | |||||
| 189 | 1 | 2µs | 1 | 10µs | # spent 14µs (4+10) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems which was called:
# once (4µs+10µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm # spent 10µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer |
| 190 | |||||
| 191 | sub _eval_keyword_maxItems ($self, $data, $schema, $state) { | ||||
| 192 | return 1 if not is_type('array', $data); | ||||
| 193 | return 1 if @$data <= $schema->{maxItems}; | ||||
| 194 | return E($state, 'more than %d item%s', $schema->{maxItems}, $schema->{maxItems} > 1 ? 's' : ''); | ||||
| 195 | } | ||||
| 196 | |||||
| 197 | 14 | 58µs | 14 | 201µs | # spent 256µs (55+201) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems which was called 14 times, avg 18µs/call:
# 14 times (55µs+201µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 18µs/call # spent 201µs making 14 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 14µs/call |
| 198 | |||||
| 199 | 6220 | 1.93ms | # spent 11.1ms (7.28+3.80) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minItems which was called 1244 times, avg 9µs/call:
# 1244 times (7.28ms+3.80ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 9µs/call | ||
| 200 | 1244 | 4.17ms | 1244 | 3.80ms | return 1 if not is_type('array', $data); # spent 3.80ms making 1244 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 201 | 129 | 393µs | return 1 if @$data >= $schema->{minItems}; | ||
| 202 | return E($state, 'fewer than %d item%s', $schema->{minItems}, $schema->{minItems} > 1 ? 's' : ''); | ||||
| 203 | } | ||||
| 204 | |||||
| 205 | 12 | 1µs | # spent 61µs (12+49) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_uniqueItems which was called 3 times, avg 20µs/call:
# 3 times (12µs+49µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 20µs/call | ||
| 206 | 3 | 3µs | 3 | 49µs | return if not assert_keyword_type($state, $schema, 'boolean'); # spent 49µs making 3 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 16µs/call |
| 207 | 3 | 6µs | return 1; | ||
| 208 | } | ||||
| 209 | |||||
| 210 | 7015 | 1.74ms | # spent 86.1ms (8.93+77.2) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_uniqueItems which was called 1403 times, avg 61µs/call:
# 1403 times (8.93ms+77.2ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 61µs/call | ||
| 211 | 1403 | 3.38ms | 1403 | 2.41ms | return 1 if not is_type('array', $data); # spent 2.41ms making 1403 calls to JSON::Schema::Modern::Utilities::is_type, avg 2µs/call |
| 212 | 288 | 1.03ms | 288 | 670µs | return 1 if not $schema->{uniqueItems}; # spent 670µs making 288 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 2µs/call |
| 213 | 288 | 1.16ms | 288 | 74.1ms | return 1 if is_elements_unique($data, my $equal_indices = []); # spent 74.1ms making 288 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 257µs/call |
| 214 | return E($state, 'items at indices %d and %d are not unique', @$equal_indices); | ||||
| 215 | } | ||||
| 216 | |||||
| 217 | # Note: no effort is made to check if the 'contains' keyword has been disabled via its vocabulary. | ||||
| 218 | 2 | 11µs | 2 | 47µs | # spent 62µs (15+47) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains which was called 2 times, avg 31µs/call:
# 2 times (15µs+47µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 31µs/call # spent 47µs making 2 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 24µs/call |
| 219 | |||||
| 220 | sub _eval_keyword_maxContains ($self, $data, $schema, $state) { | ||||
| 221 | return 1 if not exists $state->{_num_contains}; | ||||
| 222 | return 1 if not is_type('array', $data); | ||||
| 223 | |||||
| 224 | return E($state, 'contains too many matching items') | ||||
| 225 | if $state->{_num_contains} > $schema->{maxContains}; | ||||
| 226 | |||||
| 227 | return 1; | ||||
| 228 | } | ||||
| 229 | |||||
| 230 | 1 | 3µs | 1 | 8µs | # spent 41µs (33+8) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains which was called:
# once (33µs+8µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm # spent 8µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer |
| 231 | |||||
| 232 | sub _eval_keyword_minContains ($self, $data, $schema, $state) { | ||||
| 233 | return 1 if not exists $state->{_num_contains}; | ||||
| 234 | return 1 if not is_type('array', $data); | ||||
| 235 | |||||
| 236 | return E($state, 'contains too few matching items') | ||||
| 237 | if $state->{_num_contains} < $schema->{minContains}; | ||||
| 238 | |||||
| 239 | return 1; | ||||
| 240 | } | ||||
| 241 | |||||
| 242 | 3 | 17µs | 3 | 55µs | # spent 73µs (18+55) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties which was called 3 times, avg 24µs/call:
# 3 times (18µs+55µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 24µs/call # spent 55µs making 3 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 18µs/call |
| 243 | |||||
| 244 | 75 | 15µs | # spent 164µs (116+48) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxProperties which was called 15 times, avg 11µs/call:
# 15 times (116µs+48µs) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 11µs/call | ||
| 245 | 15 | 27µs | 15 | 48µs | return 1 if not is_type('object', $data); # spent 48µs making 15 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 246 | 15 | 74µs | return 1 if keys %$data <= $schema->{maxProperties}; | ||
| 247 | return E($state, 'more than %d propert%s', $schema->{maxProperties}, | ||||
| 248 | $schema->{maxProperties} > 1 ? 'ies' : 'y'); | ||||
| 249 | } | ||||
| 250 | |||||
| 251 | 50 | 241µs | 50 | 1.15ms | # spent 1.41ms (268µs+1.15) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties which was called 50 times, avg 28µs/call:
# 50 times (268µs+1.15ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 28µs/call # spent 1.15ms making 50 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 23µs/call |
| 252 | |||||
| 253 | 2425 | 594µs | # spent 4.87ms (3.61+1.26) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minProperties which was called 485 times, avg 10µs/call:
# 485 times (3.61ms+1.26ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 10µs/call | ||
| 254 | 485 | 826µs | 485 | 1.26ms | return 1 if not is_type('object', $data); # spent 1.26ms making 485 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 255 | 485 | 1.74ms | return 1 if keys %$data >= $schema->{minProperties}; | ||
| 256 | return E($state, 'fewer than %d propert%s', $schema->{minProperties}, | ||||
| 257 | $schema->{minProperties} > 1 ? 'ies' : 'y'); | ||||
| 258 | } | ||||
| 259 | |||||
| 260 | 1100 | 256µs | # spent 96.3ms (3.36+93.0) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_required which was called 275 times, avg 350µs/call:
# 275 times (3.36ms+93.0ms) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm, avg 350µs/call | ||
| 261 | 275 | 303µs | 275 | 1.70ms | return if not assert_keyword_type($state, $schema, 'array'); # spent 1.70ms making 275 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 6µs/call |
| 262 | return E($state, '"required" element is not a string') | ||||
| 263 | 1049 | 2.49ms | 1049 | 10.2ms | if any { !is_type('string', $_) } $schema->{required}->@*; # spent 6.04ms making 275 calls to List::Util::any, avg 22µs/call
# spent 4.20ms making 774 calls to JSON::Schema::Modern::Utilities::is_type, avg 5µs/call |
| 264 | 275 | 569µs | 275 | 85.2ms | return E($state, '"required" values are not unique') if not is_elements_unique($schema->{required}); # spent 85.2ms making 275 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 310µs/call |
| 265 | 275 | 814µs | return 1; | ||
| 266 | } | ||||
| 267 | |||||
| 268 | 23975 | 4.87ms | # spent 468ms (52.8+415) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_required which was called 4795 times, avg 98µs/call:
# 4795 times (52.8ms+415ms) by JSON::Schema::Modern::_eval_subschema at line 574 of JSON/Schema/Modern.pm, avg 98µs/call | ||
| 269 | 4795 | 8.05ms | 4795 | 16.1ms | return 1 if not is_type('object', $data); # spent 16.1ms making 4795 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 270 | |||||
| 271 | 4795 | 13.1ms | my @missing = grep !exists $data->{$_}, $schema->{required}->@*; | ||
| 272 | 4795 | 7.85ms | return 1 if not @missing; | ||
| 273 | 1438 | 8.64ms | 1438 | 399ms | return E($state, 'missing propert%s: %s', @missing > 1 ? 'ies' : 'y', join(', ', @missing)); # spent 399ms making 1438 calls to JSON::Schema::Modern::Utilities::E, avg 277µs/call |
| 274 | } | ||||
| 275 | |||||
| 276 | 4 | 16µs | # spent 76µs (55+21) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_dependentRequired which was called:
# once (55µs+21µs) by JSON::Schema::Modern::_traverse_subschema at line 483 of JSON/Schema/Modern.pm | ||
| 277 | 1 | 2µs | 1 | 6µs | return if not assert_keyword_type($state, $schema, 'object'); # spent 6µs making 1 call to JSON::Schema::Modern::Utilities::assert_keyword_type |
| 278 | |||||
| 279 | 1 | 3µs | my $valid = 1; | ||
| 280 | 1 | 15µs | 1 | 1µs | foreach my $property (sort keys $schema->{dependentRequired}->%*) { # spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::CORE:sort |
| 281 | $valid = E({ %$state, _schema_path_suffix => $property }, 'value is not an array'), next | ||||
| 282 | 1 | 3µs | 1 | 3µs | if not is_type('array', $schema->{dependentRequired}{$property}); # spent 3µs making 1 call to JSON::Schema::Modern::Utilities::is_type |
| 283 | |||||
| 284 | 1 | 1µs | foreach my $index (0..$schema->{dependentRequired}{$property}->$#*) { | ||
| 285 | $valid = E({ %$state, _schema_path_suffix => [ $property, $index ] }, 'element #%d is not a string', $index) | ||||
| 286 | 1 | 2µs | 1 | 8µs | if not is_type('string', $schema->{dependentRequired}{$property}[$index]); # spent 8µs making 1 call to JSON::Schema::Modern::Utilities::is_type |
| 287 | } | ||||
| 288 | |||||
| 289 | $valid = E({ %$state, _schema_path_suffix => $property }, 'elements are not unique') | ||||
| 290 | 1 | 3µs | 1 | 3µs | if not is_elements_unique($schema->{dependentRequired}{$property}); # spent 3µs making 1 call to JSON::Schema::Modern::Utilities::is_elements_unique |
| 291 | } | ||||
| 292 | 1 | 9µs | return $valid; | ||
| 293 | } | ||||
| 294 | |||||
| 295 | sub _eval_keyword_dependentRequired ($self, $data, $schema, $state) { | ||||
| 296 | return 1 if not is_type('object', $data); | ||||
| 297 | |||||
| 298 | my $valid = 1; | ||||
| 299 | foreach my $property (sort keys $schema->{dependentRequired}->%*) { | ||||
| 300 | next if not exists $data->{$property}; | ||||
| 301 | |||||
| 302 | if (my @missing = grep !exists($data->{$_}), $schema->{dependentRequired}{$property}->@*) { | ||||
| 303 | $valid = E({ %$state, _schema_path_suffix => $property }, | ||||
| 304 | 'missing propert%s: %s', @missing > 1 ? 'ies' : 'y', join(', ', @missing)); | ||||
| 305 | } | ||||
| 306 | } | ||||
| 307 | |||||
| 308 | return 1 if $valid; | ||||
| 309 | return E($state, 'not all dependencies are satisfied'); | ||||
| 310 | } | ||||
| 311 | |||||
| 312 | 120 | 16µs | # spent 543µs (129+414) within JSON::Schema::Modern::Vocabulary::Validation::_assert_number which was called 30 times, avg 18µs/call:
# 21 times (96µs+299µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum at line 143, avg 19µs/call
# 8 times (29µs+106µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum at line 127, avg 17µs/call
# once (4µs+9µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum at line 151 | ||
| 313 | 30 | 30µs | 30 | 414µs | return if not assert_keyword_type($state, $schema, 'number'); # spent 414µs making 30 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 14µs/call |
| 314 | 30 | 81µs | return 1; | ||
| 315 | } | ||||
| 316 | |||||
| 317 | 348 | 92µs | # spent 1.75ms (504µs+1.25) within JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer which was called 87 times, avg 20µs/call:
# 50 times (330µs+816µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties at line 251, avg 23µs/call
# 14 times (62µs+139µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems at line 197, avg 14µs/call
# 8 times (36µs+110µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength at line 167, avg 18µs/call
# 8 times (42µs+95µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength at line 159, avg 17µs/call
# 3 times (18µs+37µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties at line 242, avg 18µs/call
# 2 times (13µs+34µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains at line 218, avg 24µs/call
# once (2µs+8µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems at line 189
# once (1µs+7µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains at line 230 | ||
| 318 | 87 | 98µs | 87 | 1.25ms | return if not assert_keyword_type($state, $schema, 'integer'); # spent 1.25ms making 87 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 14µs/call |
| 319 | return E($state, '%s value is not a non-negative integer', $state->{keyword}) | ||||
| 320 | 87 | 88µs | if $schema->{$state->{keyword}} < 0; | ||
| 321 | 87 | 201µs | return 1; | ||
| 322 | } | ||||
| 323 | |||||
| 324 | 1 | 11µs | 1; | ||
| 325 | |||||
| 326 | 1 | 89µs | 1 | 668µs | __END__ # spent 668µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 826µs within JSON::Schema::Modern::Vocabulary::Validation::CORE:match which was called 262 times, avg 3µs/call:
# 262 times (826µs+0s) by JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern at line 185, avg 3µs/call | |||||
# spent 470µs within JSON::Schema::Modern::Vocabulary::Validation::CORE:regcomp which was called 262 times, avg 2µs/call:
# 262 times (470µs+0s) by JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern at line 185, avg 2µs/call | |||||
# spent 1µs within JSON::Schema::Modern::Vocabulary::Validation::CORE:sort which was called:
# once (1µs+0s) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_dependentRequired at line 280 |