← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 16:10:05 2022
Reported on Wed Dec 14 16:12:58 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm
StatementsExecuted 684792 statements in 5.47s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
466819113.50s3.50sJSON::Schema::Modern::Document::OpenAPI::::CORE:regcompJSON::Schema::Modern::Document::OpenAPI::CORE:regcomp (opcode)
3905511121ms121msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:144]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:144]
4668263169.5ms69.5msJSON::Schema::Modern::Document::OpenAPI::::CORE:matchJSON::Schema::Modern::Document::OpenAPI::CORE:match (opcode)
11141.8ms94.3sJSON::Schema::Modern::Document::OpenAPI::::traverseJSON::Schema::Modern::Document::OpenAPI::traverse
9651125.3ms1.18sJSON::Schema::Modern::Document::OpenAPI::::_traverse_schemaJSON::Schema::Modern::Document::OpenAPI::_traverse_schema
25861111.2ms11.2msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:140]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:140]
111896µs896µsJSON::Schema::Modern::Document::OpenAPI::::CORE:sortJSON::Schema::Modern::Document::OpenAPI::CORE:sort (opcode)
111261µs195msJSON::Schema::Modern::Document::OpenAPI::::_add_vocab_and_default_schemasJSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas
11128µs139µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@19JSON::Schema::Modern::Document::OpenAPI::BEGIN@19
11125µs969µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@12JSON::Schema::Modern::Document::OpenAPI::BEGIN@12
11125µs27µsOpenAPI::Modern::::BEGIN@1.242 OpenAPI::Modern::BEGIN@1.242
11124µs54µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@14JSON::Schema::Modern::Document::OpenAPI::BEGIN@14
11121µs38µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@15JSON::Schema::Modern::Document::OpenAPI::BEGIN@15
11117µs819µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@26JSON::Schema::Modern::Document::OpenAPI::BEGIN@26
11116µs81µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@18JSON::Schema::Modern::Document::OpenAPI::BEGIN@18
11114µs515µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@25JSON::Schema::Modern::Document::OpenAPI::BEGIN@25
11112µs28µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@16JSON::Schema::Modern::Document::OpenAPI::BEGIN@16
11111µs355µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@27JSON::Schema::Modern::Document::OpenAPI::BEGIN@27
11111µs57µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@31JSON::Schema::Modern::Document::OpenAPI::BEGIN@31
11111µs35µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@33JSON::Schema::Modern::Document::OpenAPI::BEGIN@33
11110µs10µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@10JSON::Schema::Modern::Document::OpenAPI::BEGIN@10
11110µs25µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@17JSON::Schema::Modern::Document::OpenAPI::BEGIN@17
11110µs34µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@22JSON::Schema::Modern::Document::OpenAPI::BEGIN@22
1118µs119µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@13JSON::Schema::Modern::Document::OpenAPI::BEGIN@13
1118µs35µsOpenAPI::Modern::::BEGIN@2.243 OpenAPI::Modern::BEGIN@2.243
1117µs265µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@11JSON::Schema::Modern::Document::OpenAPI::BEGIN@11
1117µs82µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@24JSON::Schema::Modern::Document::OpenAPI::BEGIN@24
1116µs24µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@20JSON::Schema::Modern::Document::OpenAPI::BEGIN@20
1116µs26µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@43JSON::Schema::Modern::Document::OpenAPI::BEGIN@43
1115µs20µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@21JSON::Schema::Modern::Document::OpenAPI::BEGIN@21
1115µs43µsJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:56]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:56]
1114µs18µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@23JSON::Schema::Modern::Document::OpenAPI::BEGIN@23
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:158]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:158]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:190]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:190]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:196]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:196]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:197]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:197]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:198]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:198]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:199]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:199]
0000s0sJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:69]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:69]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1229µs229µs
# spent 27µs (25+2) within OpenAPI::Modern::BEGIN@1.242 which was called: # once (25µs+2µs) by OpenAPI::Modern::BEGIN@28 at line 1
use strict;
# spent 27µs making 1 call to OpenAPI::Modern::BEGIN@1.242 # spent 2µs making 1 call to strict::import
2248µs262µs
# spent 35µs (8+27) within OpenAPI::Modern::BEGIN@2.243 which was called: # once (8µs+27µs) by OpenAPI::Modern::BEGIN@28 at line 2
use warnings;
# spent 35µs making 1 call to OpenAPI::Modern::BEGIN@2.243 # spent 27µs making 1 call to warnings::import
3package 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
811µsour $VERSION = '0.037';
9
10233µs110µs
# spent 10µs within JSON::Schema::Modern::Document::OpenAPI::BEGIN@10 which was called: # once (10µs+0s) by OpenAPI::Modern::BEGIN@28 at line 10
use 5.020;
11233µs2523µs
# spent 265µs (7+258) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 which was called: # once (7µs+258µs) by OpenAPI::Modern::BEGIN@28 at line 11
use Moo;
# spent 265µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 # spent 258µs making 1 call to Moo::import
12348µs31.91ms
# spent 969µs (25+944) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 which was called: # once (25µs+944µs) by OpenAPI::Modern::BEGIN@28 at line 12
use strictures 2;
# spent 969µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 # spent 925µs making 1 call to strictures::import # spent 19µs making 1 call to strictures::VERSION
13247µs2230µs
# spent 119µs (8+111) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 which was called: # once (8µs+111µs) by OpenAPI::Modern::BEGIN@28 at line 13
use experimental qw(signatures postderef);
# spent 119µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 # spent 111µs making 1 call to experimental::import
14251µs259µs
# spent 54µs (24+30) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 which was called: # once (24µs+30µs) by OpenAPI::Modern::BEGIN@28 at line 14
use if "$]" >= 5.022, experimental => 're_strict';
# spent 54µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 # spent 5µs making 1 call to if::import
15230µs239µs
# spent 38µs (21+17) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@15 which was called: # once (21µs+17µs) by OpenAPI::Modern::BEGIN@28 at line 15
no if "$]" >= 5.031009, feature => 'indirect';
# spent 38µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@15 # spent 1µs making 1 call to if::unimport
16227µs230µs
# spent 28µs (12+16) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@16 which was called: # once (12µs+16µs) by OpenAPI::Modern::BEGIN@28 at line 16
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 28µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@16 # spent 2µs making 1 call to if::unimport
17233µs226µs
# spent 25µs (10+15) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 which was called: # once (10µs+15µs) by OpenAPI::Modern::BEGIN@28 at line 17
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 25µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 # spent 1µs making 1 call to if::unimport
18351µs3146µs
# spent 81µs (16+65) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@18 which was called: # once (16µs+65µs) by OpenAPI::Modern::BEGIN@28 at line 18
use JSON::Schema::Modern::Utilities 0.525 qw(assert_keyword_exists assert_keyword_type E canonical_uri get_type);
# spent 81µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@18 # spent 49µs making 1 call to Exporter::import # spent 16µs making 1 call to UNIVERSAL::VERSION
19230µs2250µs
# spent 139µs (28+111) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 which was called: # once (28µs+111µs) by OpenAPI::Modern::BEGIN@28 at line 19
use Safe::Isa;
# spent 139µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 # spent 111µs making 1 call to Exporter::import
20219µs242µs
# spent 24µs (6+18) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 which was called: # once (6µs+18µs) by OpenAPI::Modern::BEGIN@28 at line 20
use File::ShareDir 'dist_dir';
# spent 24µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 # spent 18µs making 1 call to Exporter::import
21226µs235µs
# spent 20µs (5+15) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 which was called: # once (5µs+15µs) by OpenAPI::Modern::BEGIN@28 at line 21
use Path::Tiny;
# spent 20µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 # spent 15µs making 1 call to Exporter::import
22222µs243µs
# spent 34µs (10+24) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@22 which was called: # once (10µs+24µs) by OpenAPI::Modern::BEGIN@28 at line 22
use List::Util qw(any pairs);
# spent 34µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@22 # spent 9µs making 1 call to List::Util::import
23218µs232µs
# spent 18µs (4+14) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 which was called: # once (4µs+14µs) by OpenAPI::Modern::BEGIN@28 at line 23
use Ref::Util 'is_plain_hashref';
# spent 18µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 # spent 14µs making 1 call to Exporter::import
24223µs2157µs
# spent 82µs (7+75) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 which was called: # once (7µs+75µs) by OpenAPI::Modern::BEGIN@28 at line 24
use MooX::HandlesVia;
# spent 82µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 # spent 75µs making 1 call to MooX::HandlesVia::import
25348µs31.02ms
# spent 515µs (14+501) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@25 which was called: # once (14µs+501µs) by OpenAPI::Modern::BEGIN@28 at line 25
use MooX::TypeTiny 0.002002;
# spent 515µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@25 # spent 490µs making 1 call to MooX::TypeTiny::import # spent 11µs making 1 call to UNIVERSAL::VERSION
26258µs21.62ms
# spent 819µs (17+802) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 which was called: # once (17µs+802µs) by OpenAPI::Modern::BEGIN@28 at line 26
use Types::Standard qw(InstanceOf HashRef Str);
# spent 819µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 # spent 802µs making 1 call to Exporter::Tiny::import
27255µs2699µs
# spent 355µs (11+344) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@27 which was called: # once (11µs+344µs) by OpenAPI::Modern::BEGIN@28 at line 27
use namespace::clean;
# spent 355µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@27 # spent 344µs making 1 call to namespace::clean::import
28
2912µs11.21msextends 'JSON::Schema::Modern::Document';
# spent 1.21ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::extends
30
31256µs2103µs
# spent 57µs (11+46) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 which was called: # once (11µs+46µs) by OpenAPI::Modern::BEGIN@28 at line 31
use constant DEFAULT_DIALECT => 'https://spec.openapis.org/oas/3.1/dialect/base';
# spent 57µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 # spent 46µs making 1 call to constant::import
32
3310s
# spent 35µs (11+24) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@33 which was called: # once (11µs+24µs) by OpenAPI::Modern::BEGIN@28 at line 41
use constant DEFAULT_SCHEMAS => {
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',
41127µs259µs};
# spent 35µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@33 # spent 24µs making 1 call to constant::import
42
4321.40ms246µs
# spent 26µs (6+20) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 which was called: # once (6µs+20µs) by OpenAPI::Modern::BEGIN@28 at line 43
use constant DEFAULT_METASCHEMA => 'https://spec.openapis.org/oas/3.1/schema-base/latest';
# spent 26µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 # spent 20µs making 1 call to constant::import
44
4519µs11.61mshas '+evaluator' => (
# spent 1.61ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
46 required => 1,
47);
48
4913µs12.32mshas '+metaschema_uri' => (
# spent 2.32ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
50 default => DEFAULT_METASCHEMA,
51);
52
53has json_schema_dialect => (
54 is => 'rwp',
55 isa => InstanceOf['Mojo::URL'],
5615µs238µs
# spent 43µs (5+38) 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 (5µs+38µs) by JSON::Schema::Modern::Document::OpenAPI::_set_json_schema_dialect at line 28 of (eval 394)[Sub/Quote.pm:3]
coerce => sub { $_[0]->$_isa('Mojo::URL') ? $_[0] : Mojo::URL->new($_[0]) },
# spent 29µs making 1 call to Mojo::URL::new # spent 9µs making 1 call to Safe::Isa::__ANON__[Safe/Isa.pm:23]
57110µs21.77ms);
# spent 1.63ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has # spent 139µs making 1 call to Types::Standard::InstanceOf
58
59# operationId => document path
60has 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 { {} },
70110µs31.97ms);
# spent 1.56ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has # spent 408µs making 1 call to Types::Standard::HashRef # spent 3µs making 1 call to Types::Standard::Str
71
7231µs
# spent 94.3s (41.8ms+94.2) within JSON::Schema::Modern::Document::OpenAPI::traverse which was called: # once (41.8ms+94.2s) by JSON::Schema::Modern::Document::BUILD at line 146 of JSON/Schema/Modern/Document.pm
sub traverse ($self, $evaluator) {
7319µs1195ms $self->_add_vocab_and_default_schemas;
74
75117µs15µs my $schema = $self->schema;
# spent 5µs making 1 call to JSON::Schema::Modern::Document::schema
76120µs21µs my $state = {
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
8913µs13µs if ((my $type = get_type($schema)) ne 'object') {
# spent 3µ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
95111µs239µs return $state if not assert_keyword_exists({ %$state, keyword => 'openapi' }, $schema)
96 or not assert_keyword_type({ %$state, keyword => 'openapi' }, $schema, 'string');
97
98111µs17µs if ($schema->{openapi} !~ /^3\.1\.[0-9]+(-.+)?$/) {
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 {
10610s return $state if exists $schema->{jsonSchemaDialect}
10711µs and not assert_keyword_type({ %$state, keyword => 'jsonSchemaDialect' }, $schema, 'string');
108
10912µs12µs my $json_schema_dialect = $self->json_schema_dialect // $schema->{jsonSchemaDialect};
110
111 # "If [jsonSchemaDialect] is not set, then the OAS dialect schema id MUST be used for these Schema Objects."
11211µs $json_schema_dialect //= DEFAULT_DIALECT;
113
114 # traverse an empty schema with this metaschema uri to confirm it is valid
115110µs42.69ms my $check_metaschema_state = $evaluator->traverse({}, {
# spent 2.65ms making 1 call to JSON::Schema::Modern::traverse # spent 40µs making 1 call to Mojo::URL::clone # spent 2µs making 1 call to Mojo::URL::fragment # spent 1µs making 1 call to JSON::Schema::Modern::Document::canonical_uri
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
12111µs if ($check_metaschema_state->{errors}->@*) {
122 push $state->{errors}->@*, $check_metaschema_state->{errors}->@*;
123 return $state;
124 }
125
12612µs $state->@{qw(spec_version vocabularies)} = $check_metaschema_state->@{qw(spec_version vocabularies)};
12716µs163µs $self->_set_json_schema_dialect($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
13211µs my (@json_schema_paths, @operation_paths);
1332586507µs my $result = $self->evaluator->evaluate(
134 $self->schema,
135 $self->metaschema_uri,
136 {
137 callbacks => {
13851721.33ms
# spent 11.2ms 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 2586 times, avg 4µs/call: # 2586 times (11.2ms+0s) by JSON::Schema::Modern::_eval_subschema at line 588 of JSON/Schema/Modern.pm, avg 4µs/call
'$dynamicRef' => sub ($, $schema, $state) {
139258611.3ms push @json_schema_paths, $state->{data_path} if $schema->{'$dynamicRef'} eq '#meta';
140 },
14115622032.9ms
# spent 121ms 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 39055 times, avg 3µs/call: # 39055 times (121ms+0s) by JSON::Schema::Modern::_eval_subschema at line 588 of JSON/Schema/Modern.pm, avg 3µs/call
'$ref' => sub ($data, $schema, $state) {
142 push @operation_paths, [ $data->{operationId} => $state->{data_path} ]
14339055140ms if $schema->{'$ref'} eq '#/$defs/operation' and defined $data->{operationId};
144 },
145 },
146 },
147140µs487.5s );
# spent 87.5s making 1 call to JSON::Schema::Modern::evaluate # 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::OpenAPI::evaluator # spent 0s making 1 call to JSON::Schema::Modern::Document::schema
148
149111µs214µs if (not $result) {
150 $_->mode('evaluate') foreach $result->errors;
151 push $state->{errors}->@*, $result->errors;
152 return $state;
153 }
154
15510s my @real_json_schema_paths;
15611.64ms1896µs foreach my $path (sort @json_schema_paths) {
157 # disregard paths that are not the root of each embedded subschema.
1584694055.23s9362248.79s next if any { $path =~ m{^\Q$_\E(?:/|\z)} } @real_json_schema_paths;
# spent 5.22s making 2586 calls to List::Util::any, avg 2.02ms/call # spent 3.50s making 466819 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp, avg 8µs/call # spent 69.5ms making 466819 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:match, avg 149ns/call
159
1609651.94ms unshift @real_json_schema_paths, $path;
16196514.6ms19301.26s $self->_traverse_schema($self->get($path), { %$state, schema_path => $path });
# spent 1.18s making 965 calls to JSON::Schema::Modern::Document::OpenAPI::_traverse_schema, avg 1.22ms/call # spent 85.0ms making 965 calls to Mojo::JSON::Pointer::get, avg 88µs/call
162 }
163
16411µ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
17519.09ms return $state;
176}
177
178######## NO PUBLIC INTERFACES FOLLOW THIS POINT ########
179
18020s
# spent 195ms (261µs+194) within JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas which was called: # once (261µs+194ms) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 73
sub _add_vocab_and_default_schemas ($self) {
18111µs10s my $js = $self->evaluator;
18217µs161.2ms $js->add_vocabulary('JSON::Schema::Modern::Vocabulary::OpenAPI');
# spent 61.2ms 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 } },
200120µs11.19ms );
# spent 1.19ms making 1 call to JSON::Schema::Modern::add_format_validation
201
202129µs18µs foreach my $pairs (pairs DEFAULT_SCHEMAS->%*) {
# spent 8µs making 1 call to List::Util::pairs
20364µs my ($filename, $uri) = @$pairs;
2046685µs36126ms my $document = $js->add_schema($uri,
# spent 124ms making 6 calls to JSON::Schema::Modern::add_schema, avg 20.7ms/call # spent 766µs making 6 calls to File::ShareDir::dist_dir, avg 128µs/call # spent 561µs making 6 calls to Cpanel::JSON::XS::decode, avg 94µs/call # spent 108µs making 6 calls to JSON::Schema::Modern::_json_decoder, avg 18µs/call # spent 64µs making 6 calls to Path::Tiny::path, avg 11µs/call # spent 33µs making 6 calls to Path::Tiny::slurp_raw, avg 6µs/call
205 $js->_json_decoder->decode(path(dist_dir('OpenAPI-Modern'), $filename)->slurp_raw));
206641µs81.88ms $js->add_schema($uri.'/latest', $document) if $uri =~ /schema(-base)?$/;
# spent 1.87ms making 2 calls to JSON::Schema::Modern::add_schema, avg 933µs/call # spent 15µs making 6 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:match, avg 2µs/call
207 }
208}
209
210# https://spec.openapis.org/oas/v3.1.0#schema-object
21138601.14ms
# spent 1.18s (25.3ms+1.15) within JSON::Schema::Modern::Document::OpenAPI::_traverse_schema which was called 965 times, avg 1.22ms/call: # 965 times (25.3ms+1.15s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 161, avg 1.22ms/call
sub _traverse_schema ($self, $schema, $state) {
2129651.93ms 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},
21872714.4ms29081.15s metaschema_uri => $self->json_schema_dialect,
# spent 1.10s making 727 calls to JSON::Schema::Modern::traverse, avg 1.52ms/call # spent 45.1ms making 727 calls to JSON::Schema::Modern::Utilities::canonical_uri, avg 62µs/call # spent 1.92ms making 727 calls to JSON::Schema::Modern::Document::OpenAPI::json_schema_dialect, avg 3µs/call # spent 1.75ms making 727 calls to JSON::Schema::Modern::Document::OpenAPI::evaluator, avg 2µs/call
219 });
220
2217271.10ms push $state->{errors}->@*, $subschema_state->{errors}->@*;
222727327µs return if $subschema_state->{errors}->@*;
223
2247275.84ms push $state->{identifiers}->@*, $subschema_state->{identifiers}->@*;
225}
226
227116µs1;
228
229151µs1618µs__END__
 
# spent 69.5ms within JSON::Schema::Modern::Document::OpenAPI::CORE:match which was called 466826 times, avg 149ns/call: # 466819 times (69.5ms+0s) by List::Util::any at line 158, avg 149ns/call # 6 times (15µs+0s) by JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas at line 206, avg 2µs/call # once (7µs+0s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 98
sub JSON::Schema::Modern::Document::OpenAPI::CORE:match; # opcode
# spent 3.50s within JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp which was called 466819 times, avg 8µs/call: # 466819 times (3.50s+0s) by List::Util::any at line 158, avg 8µs/call
sub JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp; # opcode
# spent 896µs within JSON::Schema::Modern::Document::OpenAPI::CORE:sort which was called: # once (896µs+0s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 156
sub JSON::Schema::Modern::Document::OpenAPI::CORE:sort; # opcode