| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/Validation.pm |
| Statements | Executed 427780 statements in 605ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 35648 | 1 | 1 | 404ms | 1.03s | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_type |
| 4795 | 1 | 1 | 55.8ms | 500ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_required |
| 1538 | 1 | 1 | 20.3ms | 241ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_enum |
| 1208 | 1 | 1 | 14.5ms | 297ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_const |
| 1382 | 1 | 1 | 14.1ms | 40.8ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_type |
| 1403 | 1 | 1 | 9.44ms | 85.9ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_uniqueItems |
| 1244 | 1 | 1 | 8.58ms | 13.0ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minItems |
| 485 | 1 | 1 | 3.40ms | 4.55ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minProperties |
| 275 | 1 | 1 | 3.32ms | 81.0ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_required |
| 262 | 1 | 1 | 2.74ms | 7.51ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern |
| 262 | 1 | 1 | 874µs | 874µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:match (opcode) |
| 79 | 1 | 1 | 719µs | 1.83ms | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minimum |
| 69 | 1 | 1 | 512µs | 4.37ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_pattern |
| 262 | 1 | 1 | 487µs | 487µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:regcomp (opcode) |
| 87 | 8 | 1 | 464µs | 1.76ms | JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer |
| 50 | 1 | 1 | 308µs | 1.25ms | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties |
| 60 | 1 | 1 | 285µs | 620µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_enum |
| 95 | 1 | 1 | 168µs | 168µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_const |
| 15 | 1 | 1 | 157µs | 198µs | JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxProperties |
| 30 | 3 | 1 | 148µs | 459µs | JSON::Schema::Modern::Vocabulary::Validation::_assert_number |
| 21 | 1 | 1 | 86µs | 393µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum |
| 8 | 1 | 1 | 74µs | 229µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength |
| 1 | 1 | 1 | 55µs | 59µs | Module::Runtime::BEGIN@1.311 |
| 14 | 1 | 1 | 54µs | 250µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems |
| 1 | 1 | 1 | 41µs | 52µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_dependentRequired |
| 8 | 1 | 1 | 40µs | 317µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength |
| 2 | 1 | 1 | 33µs | 107µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains |
| 8 | 1 | 1 | 30µs | 171µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum |
| 3 | 1 | 1 | 26µs | 123µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties |
| 3 | 1 | 1 | 26µs | 77µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_uniqueItems |
| 1 | 1 | 1 | 21µs | 1.07ms | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 |
| 1 | 1 | 1 | 15µs | 7.67ms | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19 |
| 1 | 1 | 1 | 15µs | 15µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@9 |
| 2 | 2 | 1 | 15µs | 15µs | JSON::Schema::Modern::Vocabulary::Validation::keywords |
| 1 | 1 | 1 | 14µs | 54µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13 |
| 1 | 1 | 1 | 12µs | 314µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 |
| 1 | 1 | 1 | 12µs | 160µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 |
| 1 | 1 | 1 | 12µs | 33µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14 |
| 1 | 1 | 1 | 12µs | 31µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15 |
| 1 | 1 | 1 | 12µs | 27µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems |
| 1 | 1 | 1 | 10µs | 25µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@16 |
| 1 | 1 | 1 | 10µs | 52µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17 |
| 1 | 1 | 1 | 10µs | 38µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18 |
| 1 | 1 | 1 | 10µs | 75µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20 |
| 1 | 1 | 1 | 9µs | 53µs | Module::Runtime::BEGIN@2.312 |
| 1 | 1 | 1 | 7µs | 265µs | JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21 |
| 1 | 1 | 1 | 6µs | 17µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum |
| 1 | 1 | 1 | 4µs | 15µs | JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains |
| 5 | 1 | 1 | 3µs | 3µs | JSON::Schema::Modern::Vocabulary::Validation::evaluation_order |
| 1 | 1 | 1 | 2µs | 2µs | JSON::Schema::Modern::Vocabulary::Validation::vocabulary |
| 1 | 1 | 1 | 1µs | 1µs | JSON::Schema::Modern::Vocabulary::Validation::CORE:sort (opcode) |
| 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 | 40µs | 2 | 63µs | # spent 59µs (55+4) within Module::Runtime::BEGIN@1.311 which was called:
# once (55µs+4µs) by Module::Runtime::require_module at line 1 # spent 59µs making 1 call to Module::Runtime::BEGIN@1.311
# spent 4µs making 1 call to strict::import |
| 2 | 2 | 64µs | 2 | 97µs | # spent 53µs (9+44) within Module::Runtime::BEGIN@2.312 which was called:
# once (9µs+44µs) by Module::Runtime::require_module at line 2 # spent 53µs making 1 call to Module::Runtime::BEGIN@2.312
# spent 44µ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 | 1µs | our $VERSION = '0.558'; | ||
| 8 | |||||
| 9 | 2 | 41µs | 1 | 15µs | # spent 15µs within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@9 which was called:
# once (15µs+0s) by Module::Runtime::require_module at line 9 # spent 15µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@9 |
| 10 | 2 | 39µs | 2 | 616µs | # spent 314µs (12+302) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 which was called:
# once (12µs+302µs) by Module::Runtime::require_module at line 10 # spent 314µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10
# spent 302µs making 1 call to Moo::import |
| 11 | 3 | 102µs | 3 | 2.13ms | # spent 1.07ms (21µs+1.05) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 which was called:
# once (21µs+1.05ms) by Module::Runtime::require_module at line 11 # spent 1.07ms making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11
# spent 1.03ms making 1 call to strictures::import
# spent 25µs making 1 call to strictures::VERSION |
| 12 | 2 | 53µs | 2 | 308µs | # spent 160µs (12+148) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 which was called:
# once (12µs+148µs) by Module::Runtime::require_module at line 12 # spent 160µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12
# spent 148µs making 1 call to experimental::import |
| 13 | 2 | 37µs | 2 | 60µs | # spent 54µs (14+40) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13 which was called:
# once (14µs+40µs) by Module::Runtime::require_module at line 13 # spent 54µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13
# spent 6µs making 1 call to if::import |
| 14 | 2 | 35µs | 2 | 35µs | # spent 33µs (12+21) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14 which was called:
# once (12µs+21µs) by Module::Runtime::require_module at line 14 # spent 33µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@14
# spent 2µs making 1 call to if::unimport |
| 15 | 2 | 25µs | 2 | 33µs | # spent 31µs (12+19) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15 which was called:
# once (12µs+19µs) by Module::Runtime::require_module at line 15 # spent 31µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@15
# spent 2µs making 1 call to if::unimport |
| 16 | 2 | 35µs | 2 | 27µs | # spent 25µs (10+15) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@16 which was called:
# once (10µs+15µs) by Module::Runtime::require_module at line 16 # spent 25µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@16
# spent 2µs making 1 call to if::unimport |
| 17 | 2 | 27µs | 2 | 66µs | # spent 52µs (10+42) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17 which was called:
# once (10µs+42µs) by Module::Runtime::require_module at line 17 # spent 52µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@17
# spent 14µs making 1 call to List::Util::import |
| 18 | 3 | 45µs | 3 | 66µs | # spent 38µs (10+28) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18 which was called:
# once (10µs+28µs) by Module::Runtime::require_module at line 18 # spent 38µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@18
# spent 16µs making 1 call to Exporter::import
# spent 12µs making 1 call to UNIVERSAL::VERSION |
| 19 | 2 | 66µs | 2 | 7.67ms | # spent 7.67ms (15µs+7.66) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19 which was called:
# once (15µs+7.66ms) by Module::Runtime::require_module at line 19 # spent 7.67ms making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@19
# spent 1µs making 1 call to if::import |
| 20 | 2 | 29µs | 2 | 140µs | # spent 75µs (10+65) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20 which was called:
# once (10µs+65µs) by Module::Runtime::require_module at line 20 # spent 75µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@20
# spent 65µs making 1 call to Exporter::import |
| 21 | 2 | 2.59ms | 2 | 523µs | # spent 265µs (7+258) within JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21 which was called:
# once (7µs+258µs) by Module::Runtime::require_module at line 21 # spent 265µs making 1 call to JSON::Schema::Modern::Vocabulary::Validation::BEGIN@21
# spent 258µs making 1 call to namespace::clean::import |
| 22 | |||||
| 23 | 1 | 6µs | 1 | 640µs | with 'JSON::Schema::Modern::Vocabulary'; # spent 640µs making 1 call to Moo::with |
| 24 | |||||
| 25 | # spent 2µs within JSON::Schema::Modern::Vocabulary::Validation::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:700] at line 696 of JSON/Schema/Modern.pm | ||||
| 26 | 1 | 3µ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 15µs within JSON::Schema::Modern::Vocabulary::Validation::keywords which was called 2 times, avg 7µs/call:
# once (8µs+0s) by JSON::Schema::Modern::_traverse_subschema at line 475 of JSON/Schema/Modern.pm
# once (7µs+0s) by JSON::Schema::Modern::_eval_subschema at line 563 of JSON/Schema/Modern.pm | ||
| 33 | return ( | ||||
| 34 | 2 | 12µ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 | 866µs | # spent 40.8ms (14.1+26.7) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_type which was called 1382 times, avg 30µs/call:
# 1382 times (14.1ms+26.7ms) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 30µs/call | ||
| 45 | 1382 | 2.84ms | if (is_plain_arrayref($schema->{type})) { | ||
| 46 | 76 | 36µs | return E($state, 'type array is empty') if not $schema->{type}->@*; | ||
| 47 | 76 | 121µs | foreach my $type ($schema->{type}->@*) { | ||
| 48 | return E($state, 'unrecognized type "%s"', $type//'<null>') | ||||
| 49 | 692 | 802µs | 158 | 264µs | if not any { ($type//'') eq $_ } qw(null boolean object array string number integer); # spent 264µs making 158 calls to List::Util::any, avg 2µs/call |
| 50 | } | ||||
| 51 | 76 | 119µs | 76 | 3.57ms | return E($state, '"type" values are not unique') if not is_elements_unique($schema->{type}); # spent 3.57ms making 76 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 47µs/call |
| 52 | } | ||||
| 53 | else { | ||||
| 54 | 1306 | 1.51ms | 1306 | 18.9ms | return if not assert_keyword_type($state, $schema, 'string'); # spent 18.9ms making 1306 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 14µs/call |
| 55 | return E($state, 'unrecognized type "%s"', $schema->{type}//'<null>') | ||||
| 56 | 6440 | 8.95ms | 1306 | 4.02ms | if not any { ($schema->{type}//'') eq $_ } qw(null boolean object array string number integer); # spent 4.02ms making 1306 calls to List::Util::any, avg 3µs/call |
| 57 | } | ||||
| 58 | 1382 | 2.52ms | return 1; | ||
| 59 | } | ||||
| 60 | |||||
| 61 | 178240 | 39.1ms | # spent 1.03s (404ms+623ms) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_type which was called 35648 times, avg 29µs/call:
# 35648 times (404ms+623ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 29µs/call | ||
| 62 | 35648 | 57.5ms | 35648 | 202ms | my $type = get_type($data); # spent 202ms making 35648 calls to JSON::Schema::Modern::Utilities::get_type, avg 6µs/call |
| 63 | 35648 | 24.1ms | if (is_plain_arrayref($schema->{type})) { | ||
| 64 | return 1 if any { | ||||
| 65 | $type eq $_ or ($_ eq 'number' and $type eq 'integer') | ||||
| 66 | 26766 | 186ms | or ($_ eq 'boolean' and $state->{scalarref_booleans} and $type eq 'reference to SCALAR') | ||
| 67 | 23274 | 105ms | 23274 | 68.0ms | } $schema->{type}->@*; # spent 68.0ms 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 | 31.5ms | or ($schema->{type} eq 'boolean' and $state->{scalarref_booleans} and $type eq 'reference to SCALAR'); | ||
| 73 | 1115 | 5.66ms | 1115 | 353ms | return E($state, 'got %s, not %s', $type, $schema->{type}); # spent 353ms making 1115 calls to JSON::Schema::Modern::Utilities::E, avg 317µs/call |
| 74 | } | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | 240 | 58µs | # spent 620µs (285+335) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_enum which was called 60 times, avg 10µs/call:
# 60 times (285µs+335µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 10µs/call | ||
| 78 | 60 | 79µs | 60 | 335µs | return if not assert_keyword_type($state, $schema, 'array'); # spent 335µs making 60 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 6µs/call |
| 79 | 60 | 99µs | return 1; | ||
| 80 | } | ||||
| 81 | |||||
| 82 | 7690 | 2.49ms | # spent 241ms (20.3+220) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_enum which was called 1538 times, avg 156µs/call:
# 1538 times (20.3ms+220ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 156µs/call | ||
| 83 | 3076 | 1.03ms | my @s; my $idx = 0; | ||
| 84 | 1538 | 2.92ms | my %s = ( scalarref_booleans => $state->{scalarref_booleans} ); | ||
| 85 | 9032 | 35.3ms | 9032 | 373ms | return 1 if any { is_equal($data, $_, $s[$idx++] = {%s}) } $schema->{enum}->@*; # spent 200ms making 1538 calls to List::Util::any, avg 130µs/call
# spent 174ms making 7494 calls to JSON::Schema::Modern::Utilities::is_equal, avg 23µs/call |
| 86 | return E($state, 'value does not match' | ||||
| 87 | .(!(grep $_->{path}, @s) ? '' | ||||
| 88 | 66 | 673µs | 66 | 20.6ms | : ' (differences start '.join(', ', map 'from item #'.$_.' at "'.$s[$_]->{path}.'"', 0..$#s).')')); # spent 20.6ms making 66 calls to JSON::Schema::Modern::Utilities::E, avg 312µs/call |
| 89 | } | ||||
| 90 | |||||
| 91 | 95 | 213µs | # spent 168µs within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_const which was called 95 times, avg 2µs/call:
# 95 times (168µs+0s) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 2µs/call | ||
| 92 | |||||
| 93 | 6040 | 1.90ms | # spent 297ms (14.5+283) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_const which was called 1208 times, avg 246µs/call:
# 1208 times (14.5ms+283ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 246µs/call | ||
| 94 | 1208 | 1.94ms | my %s = ( scalarref_booleans => $state->{scalarref_booleans} ); | ||
| 95 | 1208 | 5.23ms | 1208 | 49.2ms | return 1 if is_equal($data, $schema->{const}, my $s = { scalarref_booleans => $state->{scalarref_booleans} }); # spent 49.2ms making 1208 calls to JSON::Schema::Modern::Utilities::is_equal, avg 41µs/call |
| 96 | return E($state, 'value does not match' | ||||
| 97 | 799 | 4.76ms | 799 | 234ms | .($s->{path} ? ' (differences start at "'.$s->{path}.'")' : '')); # spent 234ms making 799 calls to JSON::Schema::Modern::Utilities::E, avg 292µ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 | 68µs | 8 | 141µs | # spent 171µs (30+141) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum which was called 8 times, avg 21µs/call:
# 8 times (30µs+141µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 21µs/call # spent 141µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_number, avg 18µ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 | 96µs | 21 | 307µs | # spent 393µs (86+307) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum which was called 21 times, avg 19µs/call:
# 21 times (86µs+307µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 19µs/call # spent 307µs making 21 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_number, avg 15µs/call |
| 144 | |||||
| 145 | 395 | 84µs | # spent 1.83ms (719µs+1.11) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minimum which was called 79 times, avg 23µs/call:
# 79 times (719µs+1.11ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 23µs/call | ||
| 146 | 79 | 184µs | 79 | 1.11ms | return 1 if not is_type('number', $data); # spent 1.11ms making 79 calls to JSON::Schema::Modern::Utilities::is_type, avg 14µs/call |
| 147 | 79 | 254µ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 | 11µs | # spent 17µs (6+11) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum which was called:
# once (6µs+11µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm # spent 11µ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 | 277µs | # spent 317µs (40+277) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength which was called 8 times, avg 40µs/call:
# 8 times (40µs+277µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 40µs/call # spent 277µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 35µ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 | 53µs | 8 | 155µs | # spent 229µs (74+155) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength which was called 8 times, avg 29µs/call:
# 8 times (74µs+155µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 29µs/call # spent 155µs making 8 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 19µ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 | 42µs | # spent 4.37ms (512µs+3.86) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_pattern which was called 69 times, avg 63µs/call:
# 69 times (512µs+3.86ms) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 63µs/call | ||
| 177 | return if not assert_keyword_type($state, $schema, 'string') | ||||
| 178 | 69 | 250µs | 138 | 3.86ms | or not assert_pattern($state, $schema->{pattern}); # spent 3.01ms making 69 calls to JSON::Schema::Modern::Utilities::assert_pattern, avg 44µs/call
# spent 849µs making 69 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 12µs/call |
| 179 | 69 | 107µs | return 1; | ||
| 180 | } | ||||
| 181 | |||||
| 182 | 1310 | 353µs | # spent 7.51ms (2.74+4.77) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern which was called 262 times, avg 29µs/call:
# 262 times (2.74ms+4.77ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 29µs/call | ||
| 183 | 262 | 424µs | 262 | 3.41ms | return 1 if not is_type('string', $data); # spent 3.41ms making 262 calls to JSON::Schema::Modern::Utilities::is_type, avg 13µs/call |
| 184 | |||||
| 185 | 262 | 2.91ms | 524 | 1.36ms | return 1 if $data =~ m/$schema->{pattern}/; # spent 874µs making 262 calls to JSON::Schema::Modern::Vocabulary::Validation::CORE:match, avg 3µs/call
# spent 487µ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 | 4µs | 1 | 15µs | # spent 27µs (12+15) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems which was called:
# once (12µs+15µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm # spent 15µ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 | 53µs | 14 | 196µs | # spent 250µs (54+196) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems which was called 14 times, avg 18µs/call:
# 14 times (54µs+196µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 18µs/call # spent 196µs making 14 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 14µs/call |
| 198 | |||||
| 199 | 6220 | 2.08ms | # spent 13.0ms (8.58+4.39) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minItems which was called 1244 times, avg 10µs/call:
# 1244 times (8.58ms+4.39ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 10µs/call | ||
| 200 | 1244 | 4.72ms | 1244 | 4.39ms | return 1 if not is_type('array', $data); # spent 4.39ms making 1244 calls to JSON::Schema::Modern::Utilities::is_type, avg 4µs/call |
| 201 | 129 | 301µ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 | 2µs | # spent 77µs (26+51) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_uniqueItems which was called 3 times, avg 26µs/call:
# 3 times (26µs+51µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 26µs/call | ||
| 206 | 3 | 3µs | 3 | 51µs | return if not assert_keyword_type($state, $schema, 'boolean'); # spent 51µs making 3 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 17µs/call |
| 207 | 3 | 7µs | return 1; | ||
| 208 | } | ||||
| 209 | |||||
| 210 | 7015 | 1.90ms | # spent 85.9ms (9.44+76.4) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_uniqueItems which was called 1403 times, avg 61µs/call:
# 1403 times (9.44ms+76.4ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 61µs/call | ||
| 211 | 1403 | 4.03ms | 1403 | 2.05ms | return 1 if not is_type('array', $data); # spent 2.05ms making 1403 calls to JSON::Schema::Modern::Utilities::is_type, avg 1µs/call |
| 212 | 288 | 1.24ms | 288 | 904µs | return 1 if not $schema->{uniqueItems}; # spent 904µs making 288 calls to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:7], avg 3µs/call |
| 213 | 288 | 1.43ms | 288 | 73.5ms | return 1 if is_elements_unique($data, my $equal_indices = []); # spent 73.5ms making 288 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 255µ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 | 13µs | 2 | 74µs | # spent 107µs (33+74) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains which was called 2 times, avg 54µs/call:
# 2 times (33µs+74µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 54µs/call # spent 74µs making 2 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 37µ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 | 11µs | # spent 15µs (4+11) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains which was called:
# once (4µs+11µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm # spent 11µ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 | 12µs | 3 | 97µs | # spent 123µs (26+97) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties which was called 3 times, avg 41µs/call:
# 3 times (26µs+97µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 41µs/call # spent 97µs making 3 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 32µs/call |
| 243 | |||||
| 244 | 75 | 18µs | # spent 198µs (157+41) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_maxProperties which was called 15 times, avg 13µs/call:
# 15 times (157µs+41µs) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 13µs/call | ||
| 245 | 15 | 23µs | 15 | 41µs | return 1 if not is_type('object', $data); # spent 41µs making 15 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 246 | 15 | 71µ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 | 296µs | 50 | 938µs | # spent 1.25ms (308µs+938µs) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties which was called 50 times, avg 25µs/call:
# 50 times (308µs+938µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 25µs/call # spent 938µs making 50 calls to JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer, avg 19µs/call |
| 252 | |||||
| 253 | 2425 | 670µs | # spent 4.55ms (3.40+1.16) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_minProperties which was called 485 times, avg 9µs/call:
# 485 times (3.40ms+1.16ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 9µs/call | ||
| 254 | 485 | 687µs | 485 | 1.16ms | return 1 if not is_type('object', $data); # spent 1.16ms making 485 calls to JSON::Schema::Modern::Utilities::is_type, avg 2µs/call |
| 255 | 485 | 1.66ms | 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 | 199µs | # spent 81.0ms (3.32+77.7) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_required which was called 275 times, avg 295µs/call:
# 275 times (3.32ms+77.7ms) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm, avg 295µs/call | ||
| 261 | 275 | 358µs | 275 | 1.53ms | return if not assert_keyword_type($state, $schema, 'array'); # spent 1.53ms 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.40ms | 1049 | 9.78ms | if any { !is_type('string', $_) } $schema->{required}->@*; # spent 5.61ms making 275 calls to List::Util::any, avg 20µs/call
# spent 4.17ms making 774 calls to JSON::Schema::Modern::Utilities::is_type, avg 5µs/call |
| 264 | 275 | 470µs | 275 | 70.6ms | return E($state, '"required" values are not unique') if not is_elements_unique($schema->{required}); # spent 70.6ms making 275 calls to JSON::Schema::Modern::Utilities::is_elements_unique, avg 257µs/call |
| 265 | 275 | 551µs | return 1; | ||
| 266 | } | ||||
| 267 | |||||
| 268 | 23975 | 6.25ms | # spent 500ms (55.8+444) within JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_required which was called 4795 times, avg 104µs/call:
# 4795 times (55.8ms+444ms) by JSON::Schema::Modern::_eval_subschema at line 578 of JSON/Schema/Modern.pm, avg 104µs/call | ||
| 269 | 4795 | 9.68ms | 4795 | 16.6ms | return 1 if not is_type('object', $data); # spent 16.6ms making 4795 calls to JSON::Schema::Modern::Utilities::is_type, avg 3µs/call |
| 270 | |||||
| 271 | 4795 | 17.8ms | my @missing = grep !exists $data->{$_}, $schema->{required}->@*; | ||
| 272 | 4795 | 7.80ms | return 1 if not @missing; | ||
| 273 | 1438 | 9.03ms | 1438 | 427ms | return E($state, 'missing propert%s: %s', @missing > 1 ? 'ies' : 'y', join(', ', @missing)); # spent 427ms making 1438 calls to JSON::Schema::Modern::Utilities::E, avg 297µs/call |
| 274 | } | ||||
| 275 | |||||
| 276 | 4 | 1µs | # spent 52µs (41+11) within JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_dependentRequired which was called:
# once (41µs+11µs) by JSON::Schema::Modern::_traverse_subschema at line 487 of JSON/Schema/Modern.pm | ||
| 277 | 1 | 0s | 1 | 3µs | return if not assert_keyword_type($state, $schema, 'object'); # spent 3µs making 1 call to JSON::Schema::Modern::Utilities::assert_keyword_type |
| 278 | |||||
| 279 | 1 | 13µs | my $valid = 1; | ||
| 280 | 1 | 14µ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 | 1µs | 1 | 0s | if not is_type('array', $schema->{dependentRequired}{$property}); # spent 0s making 1 call to JSON::Schema::Modern::Utilities::is_type |
| 283 | |||||
| 284 | 1 | 2µ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 | 0s | 1 | 3µs | if not is_type('string', $schema->{dependentRequired}{$property}[$index]); # spent 3µ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 | 1µs | 1 | 4µs | if not is_elements_unique($schema->{dependentRequired}{$property}); # spent 4µs making 1 call to JSON::Schema::Modern::Utilities::is_elements_unique |
| 291 | } | ||||
| 292 | 1 | 4µ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 | 31µs | # spent 459µs (148+311) within JSON::Schema::Modern::Vocabulary::Validation::_assert_number which was called 30 times, avg 15µs/call:
# 21 times (87µs+220µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minimum at line 143, avg 15µs/call
# 8 times (58µs+83µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maximum at line 127, avg 18µs/call
# once (3µs+8µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_exclusiveMinimum at line 151 | ||
| 313 | 30 | 17µs | 30 | 311µs | return if not assert_keyword_type($state, $schema, 'number'); # spent 311µs making 30 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 10µs/call |
| 314 | 30 | 78µs | return 1; | ||
| 315 | } | ||||
| 316 | |||||
| 317 | 348 | 50µs | # spent 1.76ms (464µs+1.30) within JSON::Schema::Modern::Vocabulary::Validation::_assert_non_negative_integer which was called 87 times, avg 20µs/call:
# 50 times (237µs+701µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minProperties at line 251, avg 19µs/call
# 14 times (56µs+140µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minItems at line 197, avg 14µs/call
# 8 times (47µs+230µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxLength at line 159, avg 35µs/call
# 8 times (87µs+68µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minLength at line 167, avg 19µs/call
# 3 times (17µs+80µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxProperties at line 242, avg 32µs/call
# 2 times (13µs+61µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxContains at line 218, avg 37µs/call
# once (3µs+12µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_maxItems at line 189
# once (4µs+7µs) by JSON::Schema::Modern::Vocabulary::Validation::_traverse_keyword_minContains at line 230 | ||
| 318 | 87 | 114µs | 87 | 1.30ms | return if not assert_keyword_type($state, $schema, 'integer'); # spent 1.30ms making 87 calls to JSON::Schema::Modern::Utilities::assert_keyword_type, avg 15µs/call |
| 319 | return E($state, '%s value is not a non-negative integer', $state->{keyword}) | ||||
| 320 | 87 | 85µs | if $schema->{$state->{keyword}} < 0; | ||
| 321 | 87 | 209µs | return 1; | ||
| 322 | } | ||||
| 323 | |||||
| 324 | 1 | 6µs | 1; | ||
| 325 | |||||
| 326 | 1 | 41µs | 1 | 399µs | __END__ # spent 399µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 874µs within JSON::Schema::Modern::Vocabulary::Validation::CORE:match which was called 262 times, avg 3µs/call:
# 262 times (874µs+0s) by JSON::Schema::Modern::Vocabulary::Validation::_eval_keyword_pattern at line 185, avg 3µs/call | |||||
# spent 487µs within JSON::Schema::Modern::Vocabulary::Validation::CORE:regcomp which was called 262 times, avg 2µs/call:
# 262 times (487µ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 |