← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:33:55 2022
Reported on Wed Dec 14 15:40:04 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm
StatementsExecuted 684792 statements in 5.02s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
466819113.31s3.31sJSON::Schema::Modern::Document::OpenAPI::::CORE:regcompJSON::Schema::Modern::Document::OpenAPI::CORE:regcomp (opcode)
3905511118ms118msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:144]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:144]
4668263160.0ms60.0msJSON::Schema::Modern::Document::OpenAPI::::CORE:matchJSON::Schema::Modern::Document::OpenAPI::CORE:match (opcode)
11136.7ms104sJSON::Schema::Modern::Document::OpenAPI::::traverseJSON::Schema::Modern::Document::OpenAPI::traverse
9651122.5ms1.18sJSON::Schema::Modern::Document::OpenAPI::::_traverse_schemaJSON::Schema::Modern::Document::OpenAPI::_traverse_schema
25861110.5ms10.5msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:140]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:140]
111723µs723µsJSON::Schema::Modern::Document::OpenAPI::::CORE:sortJSON::Schema::Modern::Document::OpenAPI::CORE:sort (opcode)
111267µs196msJSON::Schema::Modern::Document::OpenAPI::::_add_vocab_and_default_schemasJSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas
11135µs38µsOpenAPI::Modern::::BEGIN@1.241 OpenAPI::Modern::BEGIN@1.241
11119µs901µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@12JSON::Schema::Modern::Document::OpenAPI::BEGIN@12
11119µs33µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@20JSON::Schema::Modern::Document::OpenAPI::BEGIN@20
11116µs73µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@18JSON::Schema::Modern::Document::OpenAPI::BEGIN@18
11116µs168µsJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:56]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:56]
11115µs38µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@15JSON::Schema::Modern::Document::OpenAPI::BEGIN@15
11114µs44µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@14JSON::Schema::Modern::Document::OpenAPI::BEGIN@14
11113µs28µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@16JSON::Schema::Modern::Document::OpenAPI::BEGIN@16
11113µs735µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@26JSON::Schema::Modern::Document::OpenAPI::BEGIN@26
11111µs11µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@10JSON::Schema::Modern::Document::OpenAPI::BEGIN@10
11111µs502µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@25JSON::Schema::Modern::Document::OpenAPI::BEGIN@25
11111µs37µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@33JSON::Schema::Modern::Document::OpenAPI::BEGIN@33
11110µs34µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@22JSON::Schema::Modern::Document::OpenAPI::BEGIN@22
1119µs340µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@11JSON::Schema::Modern::Document::OpenAPI::BEGIN@11
1119µs22µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@17JSON::Schema::Modern::Document::OpenAPI::BEGIN@17
1119µs27µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@21JSON::Schema::Modern::Document::OpenAPI::BEGIN@21
1119µs341µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@27JSON::Schema::Modern::Document::OpenAPI::BEGIN@27
1118µs122µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@13JSON::Schema::Modern::Document::OpenAPI::BEGIN@13
1118µs54µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@31JSON::Schema::Modern::Document::OpenAPI::BEGIN@31
1118µs35µsOpenAPI::Modern::::BEGIN@2.242 OpenAPI::Modern::BEGIN@2.242
1117µs65µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@24JSON::Schema::Modern::Document::OpenAPI::BEGIN@24
1116µs32µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@43JSON::Schema::Modern::Document::OpenAPI::BEGIN@43
1115µs101µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@19JSON::Schema::Modern::Document::OpenAPI::BEGIN@19
1115µs19µ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
1238µs241µs
# spent 38µs (35+3) within OpenAPI::Modern::BEGIN@1.241 which was called: # once (35µs+3µs) by OpenAPI::Modern::BEGIN@28 at line 1
use strict;
# spent 38µs making 1 call to OpenAPI::Modern::BEGIN@1.241 # spent 3µs making 1 call to strict::import
2248µs262µs
# spent 35µs (8+27) within OpenAPI::Modern::BEGIN@2.242 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.242 # 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.031';
9
10238µs111µs
# spent 11µs within JSON::Schema::Modern::Document::OpenAPI::BEGIN@10 which was called: # once (11µs+0s) by OpenAPI::Modern::BEGIN@28 at line 10
use 5.020;
11231µs2671µs
# spent 340µs (9+331) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 which was called: # once (9µs+331µs) by OpenAPI::Modern::BEGIN@28 at line 11
use Moo;
# spent 340µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 # spent 331µs making 1 call to Moo::import
12337µs31.78ms
# spent 901µs (19+882) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 which was called: # once (19µs+882µs) by OpenAPI::Modern::BEGIN@28 at line 12
use strictures 2;
# spent 901µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 # spent 860µs making 1 call to strictures::import # spent 21µs making 1 call to strictures::VERSION
13248µs2236µs
# spent 122µs (8+114) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 which was called: # once (8µs+114µs) by OpenAPI::Modern::BEGIN@28 at line 13
use experimental qw(signatures postderef);
# spent 122µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 # spent 114µs making 1 call to experimental::import
14235µs247µs
# spent 44µs (14+30) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 which was called: # once (14µs+30µs) by OpenAPI::Modern::BEGIN@28 at line 14
use if "$]" >= 5.022, experimental => 're_strict';
# spent 44µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 # spent 3µs making 1 call to if::import
15229µs241µs
# spent 38µs (15+23) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@15 which was called: # once (15µs+23µ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 3µs making 1 call to if::unimport
16232µs230µs
# spent 28µs (13+15) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@16 which was called: # once (13µs+15µ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
17229µs223µs
# spent 22µs (9+13) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 which was called: # once (9µs+13µs) by OpenAPI::Modern::BEGIN@28 at line 17
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 22µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 # spent 1µs making 1 call to if::unimport
18340µs3130µs
# spent 73µs (16+57) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@18 which was called: # once (16µs+57µ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 73µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@18 # spent 49µs making 1 call to Exporter::import # spent 8µs making 1 call to UNIVERSAL::VERSION
19224µs2197µs
# spent 101µs (5+96) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 which was called: # once (5µs+96µs) by OpenAPI::Modern::BEGIN@28 at line 19
use Safe::Isa;
# spent 101µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 # spent 96µs making 1 call to Exporter::import
20226µs247µs
# spent 33µs (19+14) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 which was called: # once (19µs+14µs) by OpenAPI::Modern::BEGIN@28 at line 20
use File::ShareDir 'dist_dir';
# spent 33µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 # spent 14µs making 1 call to Exporter::import
21224µs245µs
# spent 27µs (9+18) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 which was called: # once (9µs+18µs) by OpenAPI::Modern::BEGIN@28 at line 21
use Path::Tiny;
# spent 27µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 # spent 18µs making 1 call to Exporter::import
22224µs241µ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 7µs making 1 call to List::Util::import
23217µs233µs
# spent 19µs (5+14) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 which was called: # once (5µs+14µs) by OpenAPI::Modern::BEGIN@28 at line 23
use Ref::Util 'is_plain_hashref';
# spent 19µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 # spent 14µs making 1 call to Exporter::import
24229µs2123µs
# spent 65µs (7+58) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 which was called: # once (7µs+58µs) by OpenAPI::Modern::BEGIN@28 at line 24
use MooX::HandlesVia;
# spent 65µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 # spent 58µs making 1 call to MooX::HandlesVia::import
25340µs3993µs
# spent 502µs (11+491) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@25 which was called: # once (11µs+491µs) by OpenAPI::Modern::BEGIN@28 at line 25
use MooX::TypeTiny 0.002002;
# spent 502µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@25 # spent 485µs making 1 call to MooX::TypeTiny::import # spent 6µs making 1 call to UNIVERSAL::VERSION
26245µs21.46ms
# spent 735µs (13+722) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 which was called: # once (13µs+722µs) by OpenAPI::Modern::BEGIN@28 at line 26
use Types::Standard qw(InstanceOf HashRef Str);
# spent 735µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 # spent 722µs making 1 call to Exporter::Tiny::import
27244µs2673µs
# spent 341µs (9+332) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@27 which was called: # once (9µs+332µs) by OpenAPI::Modern::BEGIN@28 at line 27
use namespace::clean;
# spent 341µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@27 # spent 332µs making 1 call to namespace::clean::import
28
2911µs11.18msextends 'JSON::Schema::Modern::Document';
# spent 1.18ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::extends
30
31261µs2100µs
# spent 54µs (8+46) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 which was called: # once (8µ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 54µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 # spent 46µs making 1 call to constant::import
32
3310s
# spent 37µs (11+26) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@33 which was called: # once (11µs+26µ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',
41130µs263µs};
# spent 37µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@33 # spent 26µs making 1 call to constant::import
42
4321.47ms258µs
# spent 32µs (6+26) within JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 which was called: # once (6µs+26µs) by OpenAPI::Modern::BEGIN@28 at line 43
use constant DEFAULT_METASCHEMA => 'https://spec.openapis.org/oas/3.1/schema-base/latest';
# spent 32µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 # spent 26µs making 1 call to constant::import
44
4513µs11.49mshas '+evaluator' => (
# spent 1.49ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
46 required => 1,
47);
48
4912µs11.64mshas '+metaschema_uri' => (
# spent 1.64ms 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'],
56113µs2152µs
# spent 168µs (16+152) 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 (16µs+152µs) by JSON::Schema::Modern::Document::OpenAPI::_set_json_schema_dialect at line 28 of (eval 390)[Sub/Quote.pm:3]
coerce => sub { $_[0]->$_isa('Mojo::URL') ? $_[0] : Mojo::URL->new($_[0]) },
# spent 142µs making 1 call to Mojo::URL::new # spent 10µs making 1 call to Safe::Isa::__ANON__[Safe/Isa.pm:23]
57111µs21.64ms);
# spent 1.55ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has # spent 82µ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 { {} },
70115µs32.62ms);
# spent 2.28ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has # spent 339µs making 1 call to Types::Standard::HashRef # spent 3µs making 1 call to Types::Standard::Str
71
7232µs
# spent 104s (36.7ms+104) within JSON::Schema::Modern::Document::OpenAPI::traverse which was called: # once (36.7ms+104s) by JSON::Schema::Modern::Document::BUILD at line 146 of JSON/Schema/Modern/Document.pm
sub traverse ($self, $evaluator) {
7319µs1196ms $self->_add_vocab_and_default_schemas;
74
7515µs13µs my $schema = $self->schema;
# spent 3µs making 1 call to JSON::Schema::Modern::Document::schema
76122µs22µ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µs14µs if ((my $type = get_type($schema)) ne 'object') {
# spent 4µ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µs246µs return $state if not assert_keyword_exists({ %$state, keyword => 'openapi' }, $schema)
96 or not assert_keyword_type({ %$state, keyword => 'openapi' }, $schema, 'string');
97
98110µ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}
10710s and not assert_keyword_type({ %$state, keyword => 'jsonSchemaDialect' }, $schema, 'string');
108
10912µs13µ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
115111µs43.12ms my $check_metaschema_state = $evaluator->traverse({}, {
# spent 3.08ms making 1 call to JSON::Schema::Modern::traverse # spent 41µs making 1 call to Mojo::URL::clone # spent 1µs making 1 call to JSON::Schema::Modern::Document::canonical_uri # spent 1µ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
12111µs if ($check_metaschema_state->{errors}->@*) {
122 push $state->{errors}->@*, $check_metaschema_state->{errors}->@*;
123 return $state;
124 }
125
12611µs $state->@{qw(spec_version vocabularies)} = $check_metaschema_state->@{qw(spec_version vocabularies)};
127112µs1206µ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
13210s my (@json_schema_paths, @operation_paths);
1332586389µs my $result = $self->evaluator->evaluate(
134 $self->schema,
135 $self->metaschema_uri,
136 {
137 callbacks => {
13851721.01ms
# spent 10.5ms 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 (10.5ms+0s) by JSON::Schema::Modern::_eval_subschema at line 558 of JSON/Schema/Modern.pm, avg 4µs/call
'$dynamicRef' => sub ($, $schema, $state) {
139258610.2ms push @json_schema_paths, $state->{data_path} if $schema->{'$dynamicRef'} eq '#meta';
140 },
14115622029.2ms
# spent 118ms 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 (118ms+0s) by JSON::Schema::Modern::_eval_subschema at line 558 of JSON/Schema/Modern.pm, avg 3µs/call
'$ref' => sub ($data, $schema, $state) {
142 push @operation_paths, [ $data->{operationId} => $state->{data_path} ]
14339055103ms if $schema->{'$ref'} eq '#/$defs/operation' and defined $data->{operationId};
144 },
145 },
146 },
147158µs497.6s );
# spent 97.6s making 1 call to JSON::Schema::Modern::evaluate # spent 3µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::evaluator # spent 3µs making 1 call to JSON::Schema::Modern::Document::schema # spent 2µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::metaschema_uri
148
14918µs218µs if (not $result) {
150 $_->mode('evaluate') foreach $result->errors;
151 push $state->{errors}->@*, $result->errors;
152 return $state;
153 }
154
15517µs my @real_json_schema_paths;
15611.48ms1723µs foreach my $path (sort @json_schema_paths) {
157 # disregard paths that are not the root of each embedded subschema.
1584694054.83s9362248.19s next if any { $path =~ m{^\Q$_\E(?:/|\z)} } @real_json_schema_paths;
# spent 4.81s making 2586 calls to List::Util::any, avg 1.86ms/call # spent 3.31s making 466819 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp, avg 7µs/call # spent 60.0ms making 466819 calls to JSON::Schema::Modern::Document::OpenAPI::CORE:match, avg 128ns/call
159
1609651.55ms unshift @real_json_schema_paths, $path;
16196512.6ms19301.24s $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.23ms/call # spent 60.0ms making 965 calls to Mojo::JSON::Pointer::get, avg 62µ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
17517.44ms return $state;
176}
177
178######## NO PUBLIC INTERFACES FOLLOW THIS POINT ########
179
18020s
# spent 196ms (267µs+196) within JSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas which was called: # once (267µs+196ms) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 73
sub _add_vocab_and_default_schemas ($self) {
18110s10s my $js = $self->evaluator;
18215µs164.8ms $js->add_vocabulary('JSON::Schema::Modern::Vocabulary::OpenAPI');
# spent 64.8ms 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 } },
200118µs11.15ms );
# spent 1.15ms making 1 call to JSON::Schema::Modern::add_format_validation
201
202114µs14µs foreach my $pairs (pairs DEFAULT_SCHEMAS->%*) {
# spent 4µs making 1 call to List::Util::pairs
20365µs my ($filename, $uri) = @$pairs;
20461.25ms36126ms my $document = $js->add_schema($uri,
# spent 123ms making 6 calls to JSON::Schema::Modern::add_schema, avg 20.5ms/call # spent 1.30ms making 6 calls to File::ShareDir::dist_dir, avg 217µs/call # spent 1.13ms making 6 calls to Cpanel::JSON::XS::decode, avg 188µs/call # spent 79µs making 6 calls to JSON::Schema::Modern::_json_decoder, avg 13µs/call # spent 70µs making 6 calls to Path::Tiny::path, avg 12µs/call # spent 27µ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));
206635µs81.43ms $js->add_schema($uri.'/latest', $document) if $uri =~ /schema(-base)?$/;
# spent 1.41ms making 2 calls to JSON::Schema::Modern::add_schema, avg 707µs/call # spent 12µ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.10ms
# spent 1.18s (22.5ms+1.16) within JSON::Schema::Modern::Document::OpenAPI::_traverse_schema which was called 965 times, avg 1.23ms/call: # 965 times (22.5ms+1.16s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 161, avg 1.23ms/call
sub _traverse_schema ($self, $schema, $state) {
2129651.47ms 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},
21872712.8ms29081.16s metaschema_uri => $self->json_schema_dialect,
# spent 1.11s making 727 calls to JSON::Schema::Modern::traverse, avg 1.53ms/call # spent 45.0ms making 727 calls to JSON::Schema::Modern::Utilities::canonical_uri, avg 62µs/call # spent 1.82ms making 727 calls to JSON::Schema::Modern::Document::OpenAPI::json_schema_dialect, avg 3µs/call # spent 1.64ms making 727 calls to JSON::Schema::Modern::Document::OpenAPI::evaluator, avg 2µs/call
219 });
220
221727923µs push $state->{errors}->@*, $subschema_state->{errors}->@*;
222727400µs return if $subschema_state->{errors}->@*;
223
2247275.32ms push $state->{identifiers}->@*, $subschema_state->{identifiers}->@*;
225}
226
227124µs1;
228
229156µs1699µs__END__
 
# spent 60.0ms within JSON::Schema::Modern::Document::OpenAPI::CORE:match which was called 466826 times, avg 128ns/call: # 466819 times (60.0ms+0s) by List::Util::any at line 158, avg 128ns/call # 6 times (12µ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.31s within JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp which was called 466819 times, avg 7µs/call: # 466819 times (3.31s+0s) by List::Util::any at line 158, avg 7µs/call
sub JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp; # opcode
# spent 723µs within JSON::Schema::Modern::Document::OpenAPI::CORE:sort which was called: # once (723µs+0s) by JSON::Schema::Modern::Document::OpenAPI::traverse at line 156
sub JSON::Schema::Modern::Document::OpenAPI::CORE:sort; # opcode