Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm |
Statements | Executed 680933 statements in 4.91s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
464832 | 1 | 1 | 3.32s | 3.32s | CORE:regcomp (opcode) | JSON::Schema::Modern::Document::OpenAPI::
38715 | 1 | 1 | 106ms | 106ms | __ANON__[:144] | JSON::Schema::Modern::Document::OpenAPI::
464839 | 3 | 1 | 61.4ms | 61.4ms | CORE:match (opcode) | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 31.0ms | 70.6s | traverse | JSON::Schema::Modern::Document::OpenAPI::
963 | 1 | 1 | 23.6ms | 1.01s | _traverse_schema | JSON::Schema::Modern::Document::OpenAPI::
2556 | 1 | 1 | 8.57ms | 8.57ms | __ANON__[:140] | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 476µs | 476µs | CORE:sort (opcode) | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 258µs | 239ms | _add_vocab_and_default_schemas | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 59µs | 63µs | BEGIN@1.242 | OpenAPI::Modern::
1 | 1 | 1 | 53µs | 121µs | BEGIN@19 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 44µs | 953µs | BEGIN@12 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 36µs | 49µs | BEGIN@16 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 20µs | 35µs | BEGIN@15 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 13µs | 39µs | BEGIN@14 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 9µs | 9µs | BEGIN@10 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 9µs | 60µs | BEGIN@18 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 9µs | 26µs | BEGIN@33 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 8µs | 192µs | BEGIN@13 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 8µs | 329µs | BEGIN@25 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 8µs | 229µs | BEGIN@27 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 8µs | 48µs | __ANON__[:56] | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 7µs | 19µs | BEGIN@21 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 7µs | 22µs | BEGIN@22 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 7µs | 514µs | BEGIN@26 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 7µs | 97µs | BEGIN@2.243 | OpenAPI::Modern::
1 | 1 | 1 | 6µs | 304µs | BEGIN@11 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 6µs | 65µs | BEGIN@31 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 5µs | 13µs | BEGIN@17 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 5µs | 18µs | BEGIN@20 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 5µs | 16µs | BEGIN@23 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 4µs | 61µs | BEGIN@24 | JSON::Schema::Modern::Document::OpenAPI::
1 | 1 | 1 | 4µs | 47µs | BEGIN@43 | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:158] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:190] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:196] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:197] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:198] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:199] | JSON::Schema::Modern::Document::OpenAPI::
0 | 0 | 0 | 0s | 0s | __ANON__[:69] | JSON::Schema::Modern::Document::OpenAPI::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 33µs | 2 | 67µs | # spent 63µs (59+4) within OpenAPI::Modern::BEGIN@1.242 which was called:
# once (59µs+4µs) by OpenAPI::Modern::BEGIN@28 at line 1 # spent 63µs making 1 call to OpenAPI::Modern::BEGIN@1.242
# spent 4µs making 1 call to strict::import |
2 | 2 | 41µs | 2 | 187µs | # spent 97µs (7+90) within OpenAPI::Modern::BEGIN@2.243 which was called:
# once (7µs+90µs) by OpenAPI::Modern::BEGIN@28 at line 2 # spent 97µs making 1 call to OpenAPI::Modern::BEGIN@2.243
# spent 90µs making 1 call to warnings::import |
3 | package JSON::Schema::Modern::Document::OpenAPI; | ||||
4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||
5 | # ABSTRACT: One OpenAPI v3.1 document | ||||
6 | # KEYWORDS: JSON Schema data validation request response OpenAPI | ||||
7 | |||||
8 | 1 | 0s | our $VERSION = '0.037'; | ||
9 | |||||
10 | 2 | 27µs | 1 | 9µs | # spent 9µs within JSON::Schema::Modern::Document::OpenAPI::BEGIN@10 which was called:
# once (9µs+0s) by OpenAPI::Modern::BEGIN@28 at line 10 # spent 9µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@10 |
11 | 2 | 32µs | 2 | 602µs | # spent 304µs (6+298) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 which was called:
# once (6µs+298µs) by OpenAPI::Modern::BEGIN@28 at line 11 # spent 304µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@11
# spent 298µs making 1 call to Moo::import |
12 | 3 | 110µs | 3 | 1.86ms | # spent 953µs (44+909) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 which was called:
# once (44µs+909µs) by OpenAPI::Modern::BEGIN@28 at line 12 # spent 953µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@12
# spent 891µs making 1 call to strictures::import
# spent 18µs making 1 call to strictures::VERSION |
13 | 2 | 89µs | 2 | 376µs | # spent 192µs (8+184) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 which was called:
# once (8µs+184µs) by OpenAPI::Modern::BEGIN@28 at line 13 # spent 192µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@13
# spent 184µs making 1 call to experimental::import |
14 | 2 | 25µs | 2 | 42µs | # spent 39µs (13+26) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 which was called:
# once (13µs+26µs) by OpenAPI::Modern::BEGIN@28 at line 14 # spent 39µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@14
# spent 3µs making 1 call to if::import |
15 | 2 | 20µs | 2 | 37µs | # spent 35µs (20+15) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@15 which was called:
# once (20µs+15µs) by OpenAPI::Modern::BEGIN@28 at line 15 # spent 35µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@15
# spent 2µs making 1 call to if::unimport |
16 | 2 | 16µs | 2 | 50µs | # spent 49µs (36+13) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@16 which was called:
# once (36µs+13µs) by OpenAPI::Modern::BEGIN@28 at line 16 # spent 49µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@16
# spent 1µs making 1 call to if::unimport |
17 | 2 | 17µs | 2 | 14µs | # spent 13µs (5+8) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 which was called:
# once (5µs+8µs) by OpenAPI::Modern::BEGIN@28 at line 17 # spent 13µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@17
# spent 1µs making 1 call to if::unimport |
18 | 3 | 34µs | 3 | 111µs | # spent 60µs (9+51) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@18 which was called:
# once (9µs+51µs) by OpenAPI::Modern::BEGIN@28 at line 18 # spent 60µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@18
# spent 41µs making 1 call to Exporter::import
# spent 10µs making 1 call to UNIVERSAL::VERSION |
19 | 2 | 19µs | 2 | 189µs | # spent 121µs (53+68) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 which was called:
# once (53µs+68µs) by OpenAPI::Modern::BEGIN@28 at line 19 # spent 121µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@19
# spent 68µs making 1 call to Exporter::import |
20 | 2 | 15µs | 2 | 31µs | # spent 18µs (5+13) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 which was called:
# once (5µs+13µs) by OpenAPI::Modern::BEGIN@28 at line 20 # spent 18µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@20
# spent 13µs making 1 call to Exporter::import |
21 | 2 | 16µs | 2 | 31µs | # spent 19µs (7+12) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 which was called:
# once (7µs+12µs) by OpenAPI::Modern::BEGIN@28 at line 21 # spent 19µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@21
# spent 12µs making 1 call to Exporter::import |
22 | 2 | 17µs | 2 | 27µs | # spent 22µs (7+15) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@22 which was called:
# once (7µs+15µs) by OpenAPI::Modern::BEGIN@28 at line 22 # spent 22µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@22
# spent 5µs making 1 call to List::Util::import |
23 | 2 | 13µs | 2 | 27µs | # spent 16µs (5+11) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 which was called:
# once (5µs+11µs) by OpenAPI::Modern::BEGIN@28 at line 23 # spent 16µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@23
# spent 11µs making 1 call to Exporter::import |
24 | 2 | 18µs | 2 | 118µs | # spent 61µs (4+57) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 which was called:
# once (4µs+57µs) by OpenAPI::Modern::BEGIN@28 at line 24 # spent 61µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@24
# spent 57µs making 1 call to MooX::HandlesVia::import |
25 | 3 | 29µs | 3 | 650µs | # spent 329µs (8+321) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@25 which was called:
# once (8µs+321µs) by OpenAPI::Modern::BEGIN@28 at line 25 # spent 329µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@25
# spent 315µs making 1 call to MooX::TypeTiny::import
# spent 6µs making 1 call to UNIVERSAL::VERSION |
26 | 2 | 33µs | 2 | 1.02ms | # spent 514µs (7+507) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 which was called:
# once (7µs+507µs) by OpenAPI::Modern::BEGIN@28 at line 26 # spent 514µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@26
# spent 507µs making 1 call to Exporter::Tiny::import |
27 | 2 | 60µs | 2 | 450µs | # spent 229µs (8+221) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@27 which was called:
# once (8µs+221µs) by OpenAPI::Modern::BEGIN@28 at line 27 # spent 229µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@27
# spent 221µs making 1 call to namespace::clean::import |
28 | |||||
29 | 1 | 1µs | 1 | 796µs | extends 'JSON::Schema::Modern::Document'; # spent 796µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::extends |
30 | |||||
31 | 2 | 40µs | 2 | 124µs | # spent 65µs (6+59) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 which was called:
# once (6µs+59µs) by OpenAPI::Modern::BEGIN@28 at line 31 # spent 65µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@31
# spent 59µs making 1 call to constant::import |
32 | |||||
33 | 1 | 1µs | # spent 26µs (9+17) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@33 which was called:
# once (9µs+17µs) by OpenAPI::Modern::BEGIN@28 at line 41 | ||
34 | # local filename => identifier to add the schema as | ||||
35 | 'oas/dialect/base.schema.json' => 'https://spec.openapis.org/oas/3.1/dialect/base', # metaschema for json schemas contained within openapi documents | ||||
36 | 'oas/meta/base.schema.json' => 'https://spec.openapis.org/oas/3.1/meta/base', # vocabulary definition | ||||
37 | 'oas/schema-base.json' => 'https://spec.openapis.org/oas/3.1/schema-base', # the main openapi document schema + draft2020-12 jsonSchemaDialect | ||||
38 | 'oas/schema.json' => 'https://spec.openapis.org/oas/3.1/schema', # the main openapi document schema + permissive jsonSchemaDialect | ||||
39 | 'strict-schema.json' => 'https://raw.githubusercontent.com/karenetheridge/OpenAPI-Modern/master/share/strict-schema.json', | ||||
40 | 'strict-dialect.json' => 'https://raw.githubusercontent.com/karenetheridge/OpenAPI-Modern/master/share/strict-dialect.json', | ||||
41 | 1 | 20µs | 2 | 43µs | }; # spent 26µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@33
# spent 17µs making 1 call to constant::import |
42 | |||||
43 | 2 | 1.09ms | 2 | 90µs | # spent 47µs (4+43) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 which was called:
# once (4µs+43µs) by OpenAPI::Modern::BEGIN@28 at line 43 # spent 47µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@43
# spent 43µs making 1 call to constant::import |
44 | |||||
45 | 1 | 2µs | 1 | 1.48ms | has '+evaluator' => ( # spent 1.48ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has |
46 | required => 1, | ||||
47 | ); | ||||
48 | |||||
49 | 1 | 2µs | 1 | 1.72ms | has '+metaschema_uri' => ( # spent 1.72ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has |
50 | default => DEFAULT_METASCHEMA, | ||||
51 | ); | ||||
52 | |||||
53 | has json_schema_dialect => ( | ||||
54 | is => 'rwp', | ||||
55 | isa => InstanceOf['Mojo::URL'], | ||||
56 | 1 | 6µs | 2 | 40µs | # spent 48µs (8+40) within JSON::Schema::Modern::Document::OpenAPI::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm:56] which was called:
# once (8µs+40µs) by JSON::Schema::Modern::Document::OpenAPI::_set_json_schema_dialect at line 28 of (eval 394)[Sub/Quote.pm:3] # spent 32µs making 1 call to Mojo::URL::new
# spent 8µs making 1 call to Safe::Isa::__ANON__[Safe/Isa.pm:23] |
57 | 1 | 8µs | 2 | 1.33ms | ); # spent 1.25ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
# spent 78µs making 1 call to Types::Standard::InstanceOf |
58 | |||||
59 | # operationId => document path | ||||
60 | has operationIds => ( | ||||
61 | is => 'bare', | ||||
62 | isa => HashRef[Str], | ||||
63 | handles_via => 'Hash', | ||||
64 | handles => { | ||||
65 | _add_operationId => 'set', | ||||
66 | get_operationId_path => 'get', | ||||
67 | }, | ||||
68 | lazy => 1, | ||||
69 | default => sub { {} }, | ||||
70 | 1 | 9µs | 3 | 1.81ms | ); # spent 1.52ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
# spent 286µs making 1 call to Types::Standard::HashRef
# spent 2µs making 1 call to Types::Standard::Str |
71 | |||||
72 | 3 | 1µs | # spent 70.6s (31.0ms+70.6) within JSON::Schema::Modern::Document::OpenAPI::traverse which was called:
# once (31.0ms+70.6s) by JSON::Schema::Modern::Document::BUILD at line 146 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Document.pm | ||
73 | 1 | 6µs | 1 | 239ms | $self->_add_vocab_and_default_schemas; # spent 239ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas |
74 | |||||
75 | 1 | 4µs | 1 | 0s | my $schema = $self->schema; # spent 0s making 1 call to JSON::Schema::Modern::Document::schema |
76 | 1 | 14µs | 2 | 1µs | my $state = { # spent 1µs making 1 call to JSON::Schema::Modern::Document::canonical_uri
# spent 0s making 1 call to JSON::Schema::Modern::SPECIFICATION_VERSION_DEFAULT |
77 | initial_schema_uri => $self->canonical_uri, | ||||
78 | traversed_schema_path => '', | ||||
79 | schema_path => '', | ||||
80 | data_path => '', | ||||
81 | errors => [], | ||||
82 | evaluator => $evaluator, | ||||
83 | identifiers => [], | ||||
84 | configs => {}, | ||||
85 | spec_version => $evaluator->SPECIFICATION_VERSION_DEFAULT, | ||||
86 | vocabularies => [], | ||||
87 | }; | ||||
88 | |||||
89 | 1 | 3µs | 1 | 1µs | if ((my $type = get_type($schema)) ne 'object') { # spent 1µs making 1 call to JSON::Schema::Modern::Utilities::get_type |
90 | ()= E($state, 'invalid document type: %s', $type); | ||||
91 | return $state; | ||||
92 | } | ||||
93 | |||||
94 | # /openapi: https://spec.openapis.org/oas/v3.1.0#openapi-object | ||||
95 | 1 | 9µs | 2 | 28µs | return $state if not assert_keyword_exists({ %$state, keyword => 'openapi' }, $schema) # spent 24µs making 1 call to JSON::Schema::Modern::Utilities::assert_keyword_type
# spent 4µs making 1 call to JSON::Schema::Modern::Utilities::assert_keyword_exists |
96 | or not assert_keyword_type({ %$state, keyword => 'openapi' }, $schema, 'string'); | ||||
97 | |||||
98 | 1 | 6µs | 1 | 4µs | if ($schema->{openapi} !~ /^3\.1\.[0-9]+(-.+)?$/) { # spent 4µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::CORE:match |
99 | ()= E({ %$state, keyword => 'openapi' }, 'unrecognized openapi version %s', $schema->{openapi}); | ||||
100 | return $state; | ||||
101 | } | ||||
102 | |||||
103 | |||||
104 | # /jsonSchemaDialect: https://spec.openapis.org/oas/v3.1.0#specifying-schema-dialects | ||||
105 | { | ||||
106 | 1 | 1µs | return $state if exists $schema->{jsonSchemaDialect} | ||
107 | 1 | 0s | and not assert_keyword_type({ %$state, keyword => 'jsonSchemaDialect' }, $schema, 'string'); | ||
108 | |||||
109 | 1 | 3µs | 1 | 1µs | my $json_schema_dialect = $self->json_schema_dialect // $schema->{jsonSchemaDialect}; # spent 1µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::json_schema_dialect |
110 | |||||
111 | # "If [jsonSchemaDialect] is not set, then the OAS dialect schema id MUST be used for these Schema Objects." | ||||
112 | 1 | 1µs | $json_schema_dialect //= DEFAULT_DIALECT; | ||
113 | |||||
114 | # traverse an empty schema with this metaschema uri to confirm it is valid | ||||
115 | 1 | 8µs | 4 | 2.34ms | my $check_metaschema_state = $evaluator->traverse({}, { # spent 2.31ms making 1 call to JSON::Schema::Modern::traverse
# spent 24µs making 1 call to Mojo::URL::clone
# spent 2µs making 1 call to JSON::Schema::Modern::Document::canonical_uri
# spent 2µs making 1 call to Mojo::URL::fragment |
116 | metaschema_uri => $json_schema_dialect, | ||||
117 | initial_schema_uri => $self->canonical_uri->clone->fragment('/jsonSchemaDialect'), | ||||
118 | }); | ||||
119 | |||||
120 | # we cannot continue if the metaschema is invalid | ||||
121 | 1 | 0s | if ($check_metaschema_state->{errors}->@*) { | ||
122 | push $state->{errors}->@*, $check_metaschema_state->{errors}->@*; | ||||
123 | return $state; | ||||
124 | } | ||||
125 | |||||
126 | 1 | 1µs | $state->@{qw(spec_version vocabularies)} = $check_metaschema_state->@{qw(spec_version vocabularies)}; | ||
127 | 1 | 6µs | 1 | 63µs | $self->_set_json_schema_dialect($json_schema_dialect); # spent 63µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::_set_json_schema_dialect |
128 | } | ||||
129 | |||||
130 | # evaluate the document against its metaschema to find any errors, to identify all schema | ||||
131 | # resources within to add to the global resource index, and to extract all operationIds | ||||
132 | 1 | 0s | my (@json_schema_paths, @operation_paths); | ||
133 | 2556 | 416µs | my $result = $self->evaluator->evaluate( | ||
134 | $self->schema, | ||||
135 | $self->metaschema_uri, | ||||
136 | { | ||||
137 | callbacks => { | ||||
138 | 5112 | 897µs | # spent 8.57ms within JSON::Schema::Modern::Document::OpenAPI::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm:140] which was called 2556 times, avg 3µs/call:
# 2556 times (8.57ms+0s) by JSON::Schema::Modern::_eval_subschema at line 597 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm, avg 3µs/call | ||
139 | 2556 | 8.91ms | push @json_schema_paths, $state->{data_path} if $schema->{'$dynamicRef'} eq '#meta'; | ||
140 | }, | ||||
141 | 154860 | 36.0ms | # spent 106ms within JSON::Schema::Modern::Document::OpenAPI::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm:144] which was called 38715 times, avg 3µs/call:
# 38715 times (106ms+0s) by JSON::Schema::Modern::_eval_subschema at line 597 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm, avg 3µs/call | ||
142 | push @operation_paths, [ $data->{operationId} => $state->{data_path} ] | ||||
143 | 38715 | 83.4ms | if $schema->{'$ref'} eq '#/$defs/operation' and defined $data->{operationId}; | ||
144 | }, | ||||
145 | }, | ||||
146 | }, | ||||
147 | 1 | 46µs | 4 | 64.6s | ); # spent 64.6s making 1 call to JSON::Schema::Modern::evaluate
# spent 3µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::evaluator
# spent 2µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::metaschema_uri
# spent 1µs making 1 call to JSON::Schema::Modern::Document::schema |
148 | |||||
149 | 1 | 11µs | 2 | 17µs | if (not $result) { # spent 14µs making 1 call to JSON::Schema::Modern::Result::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Result.pm:29]
# spent 3µs making 1 call to JSON::PP::Boolean::__ANON__[JSON/PP/Boolean.pm:8] |
150 | $_->mode('evaluate') foreach $result->errors; | ||||
151 | push $state->{errors}->@*, $result->errors; | ||||
152 | return $state; | ||||
153 | } | ||||
154 | |||||
155 | 1 | 0s | my @real_json_schema_paths; | ||
156 | 1 | 1.03ms | 1 | 476µs | foreach my $path (sort @json_schema_paths) { # spent 476µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::CORE:sort |
157 | # disregard paths that are not the root of each embedded subschema. | ||||
158 | 467388 | 4.74s | 932220 | 8.11s | next if any { $path =~ m{^\Q$_\E(?:/|\z)} } @real_json_schema_paths; # spent 4.73s making 2556 calls to List::Util::any, avg 1.85ms/call
# spent 3.32s making 464832 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp, avg 7µs/call
# spent 61.4ms making 464832 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:match, avg 132ns/call |
159 | |||||
160 | 963 | 1.46ms | unshift @real_json_schema_paths, $path; | ||
161 | 963 | 12.4ms | 1926 | 1.07s | $self->_traverse_schema($self->get($path), { %$state, schema_path => $path }); # spent 1.01s making 963 calls to JSON::Schema::Modern::Document::OpenAPI::_traverse_schema, avg 1.05ms/call
# spent 55.8ms making 963 calls to Mojo::JSON::Pointer::get, avg 58µs/call |
162 | } | ||||
163 | |||||
164 | 1 | 1µs | foreach my $pair (@operation_paths) { | ||
165 | my ($operation_id, $path) = @$pair; | ||||
166 | if (my $existing = $self->get_operationId_path($operation_id)) { | ||||
167 | ()= E({ %$state, keyword => 'operationId', schema_path => $path }, | ||||
168 | 'duplicate of operationId at %s', $existing); | ||||
169 | } | ||||
170 | else { | ||||
171 | $self->_add_operationId($operation_id => $path); | ||||
172 | } | ||||
173 | } | ||||
174 | |||||
175 | 1 | 3.68ms | return $state; | ||
176 | } | ||||
177 | |||||
178 | ######## NO PUBLIC INTERFACES FOLLOW THIS POINT ######## | ||||
179 | |||||
180 | 2 | 0s | # spent 239ms (258µs+239) within JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas which was called:
# once (258µs+239ms) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 73 | ||
181 | 1 | 1µs | 1 | 1µs | my $js = $self->evaluator; # spent 1µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::evaluator |
182 | 1 | 6µs | 1 | 57.9ms | $js->add_vocabulary('JSON::Schema::Modern::Vocabulary::OpenAPI'); # spent 57.9ms making 1 call to JSON::Schema::Modern::add_vocabulary |
183 | |||||
184 | $js->add_format_validation( | ||||
185 | int32 => +{ type => 'integer', sub => sub ($x) { | ||||
186 | require Math::BigInt; | ||||
187 | $x = Math::BigInt->new($x); | ||||
188 | my $bound = Math::BigInt->new(2) ** 31; | ||||
189 | $x >= -$bound && $x < $bound; | ||||
190 | } }, | ||||
191 | int64 => +{ type => 'integer', sub => sub ($x) { | ||||
192 | require Math::BigInt; | ||||
193 | $x = Math::BigInt->new($x); | ||||
194 | my $bound = Math::BigInt->new(2) ** 63; | ||||
195 | $x >= -$bound && $x < $bound; | ||||
196 | } }, | ||||
197 | float => +{ type => 'number', sub => sub ($) { 1 } }, | ||||
198 | double => +{ type => 'number', sub => sub ($) { 1 } }, | ||||
199 | password => +{ type => 'string', sub => sub ($) { 1 } }, | ||||
200 | 1 | 16µs | 1 | 784µs | ); # spent 784µs making 1 call to JSON::Schema::Modern::add_format_validation |
201 | |||||
202 | 1 | 14µs | 1 | 5µs | foreach my $pairs (pairs DEFAULT_SCHEMAS->%*) { # spent 5µs making 1 call to List::Util::pairs |
203 | 6 | 6µs | my ($filename, $uri) = @$pairs; | ||
204 | 6 | 591µs | 36 | 174ms | my $document = $js->add_schema($uri, # spent 171ms making 6 calls to JSON::Schema::Modern::add_schema, avg 28.6ms/call
# spent 1.89ms making 6 calls to File::ShareDir::dist_dir, avg 315µs/call
# spent 470µs making 6 calls to Cpanel::JSON::XS::decode, avg 78µs/call
# spent 74µs making 6 calls to JSON::Schema::Modern::_json_decoder, avg 12µs/call
# spent 65µs making 6 calls to Path::Tiny::path, avg 11µs/call
# spent 25µs making 6 calls to Path::Tiny::slurp_raw, avg 4µs/call |
205 | $js->_json_decoder->decode(path(dist_dir('OpenAPI-Modern'), $filename)->slurp_raw)); | ||||
206 | 6 | 46µs | 8 | 1.41ms | $js->add_schema($uri.'/latest', $document) if $uri =~ /schema(-base)?$/; # spent 1.40ms making 2 calls to JSON::Schema::Modern::add_schema, avg 698µs/call
# spent 17µs making 6 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:match, avg 3µs/call |
207 | } | ||||
208 | } | ||||
209 | |||||
210 | # https://spec.openapis.org/oas/v3.1.0#schema-object | ||||
211 | 3852 | 1.10ms | # spent 1.01s (23.6ms+991ms) within JSON::Schema::Modern::Document::OpenAPI::_traverse_schema which was called 963 times, avg 1.05ms/call:
# 963 times (23.6ms+991ms) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 161, avg 1.05ms/call | ||
212 | 963 | 1.57ms | return if not is_plain_hashref($schema) or not keys %$schema; | ||
213 | |||||
214 | my $subschema_state = $self->evaluator->traverse($schema, { | ||||
215 | %$state, # so we don't have to enumerate everything that may be in config_override | ||||
216 | initial_schema_uri => canonical_uri($state), | ||||
217 | traversed_schema_path => $state->{traversed_schema_path}.$state->{schema_path}, | ||||
218 | 725 | 12.4ms | 2900 | 991ms | metaschema_uri => $self->json_schema_dialect, # spent 949ms making 725 calls to JSON::Schema::Modern::traverse, avg 1.31ms/call
# spent 39.2ms making 725 calls to JSON::Schema::Modern::Utilities::canonical_uri, avg 54µs/call
# spent 1.43ms making 725 calls to JSON::Schema::Modern::Document::OpenAPI::json_schema_dialect, avg 2µs/call
# spent 1.34ms making 725 calls to JSON::Schema::Modern::Document::OpenAPI::evaluator, avg 2µs/call |
219 | }); | ||||
220 | |||||
221 | 725 | 928µs | push $state->{errors}->@*, $subschema_state->{errors}->@*; | ||
222 | 725 | 270µs | return if $subschema_state->{errors}->@*; | ||
223 | |||||
224 | 725 | 5.73ms | push $state->{identifiers}->@*, $subschema_state->{identifiers}->@*; | ||
225 | } | ||||
226 | |||||
227 | 1 | 17µs | 1; | ||
228 | |||||
229 | 1 | 32µs | 1 | 387µs | __END__ # spent 387µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 61.4ms within JSON::Schema::Modern::Document::OpenAPI::CORE:match which was called 464839 times, avg 132ns/call:
# 464832 times (61.4ms+0s) by List::Util::any at line 158, avg 132ns/call
# 6 times (17µs+0s) by JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas at line 206, avg 3µs/call
# once (4µs+0s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 98 | |||||
# spent 3.32s within JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp which was called 464832 times, avg 7µs/call:
# 464832 times (3.32s+0s) by List::Util::any at line 158, avg 7µs/call | |||||
# spent 476µs within JSON::Schema::Modern::Document::OpenAPI::CORE:sort which was called:
# once (476µs+0s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 156 |