← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Thu Dec 15 15:23:56 2022
Reported on Thu Dec 15 15:27:04 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document/OpenAPI.pm
StatementsExecuted 680933 statements in 4.91s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
464832113.32s3.32sJSON::Schema::Modern::Document::OpenAPI::::CORE:regcompJSON::Schema::Modern::Document::OpenAPI::CORE:regcomp (opcode)
3871511106ms106msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:144]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:144]
4648393161.4ms61.4msJSON::Schema::Modern::Document::OpenAPI::::CORE:matchJSON::Schema::Modern::Document::OpenAPI::CORE:match (opcode)
11131.0ms70.6sJSON::Schema::Modern::Document::OpenAPI::::traverseJSON::Schema::Modern::Document::OpenAPI::traverse
9631123.6ms1.01sJSON::Schema::Modern::Document::OpenAPI::::_traverse_schemaJSON::Schema::Modern::Document::OpenAPI::_traverse_schema
2556118.57ms8.57msJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:140]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:140]
111476µs476µsJSON::Schema::Modern::Document::OpenAPI::::CORE:sortJSON::Schema::Modern::Document::OpenAPI::CORE:sort (opcode)
111258µs239msJSON::Schema::Modern::Document::OpenAPI::::_add_vocab_and_default_schemasJSON::Schema::Modern::Document::OpenAPI::_add_vocab_and_default_schemas
11159µs63µsOpenAPI::Modern::::BEGIN@1.242 OpenAPI::Modern::BEGIN@1.242
11153µs121µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@19JSON::Schema::Modern::Document::OpenAPI::BEGIN@19
11144µs953µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@12JSON::Schema::Modern::Document::OpenAPI::BEGIN@12
11136µs49µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@16JSON::Schema::Modern::Document::OpenAPI::BEGIN@16
11120µs35µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@15JSON::Schema::Modern::Document::OpenAPI::BEGIN@15
11113µs39µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@14JSON::Schema::Modern::Document::OpenAPI::BEGIN@14
1119µs9µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@10JSON::Schema::Modern::Document::OpenAPI::BEGIN@10
1119µs60µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@18JSON::Schema::Modern::Document::OpenAPI::BEGIN@18
1119µs26µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@33JSON::Schema::Modern::Document::OpenAPI::BEGIN@33
1118µs192µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@13JSON::Schema::Modern::Document::OpenAPI::BEGIN@13
1118µs329µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@25JSON::Schema::Modern::Document::OpenAPI::BEGIN@25
1118µs229µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@27JSON::Schema::Modern::Document::OpenAPI::BEGIN@27
1118µs48µsJSON::Schema::Modern::Document::OpenAPI::::__ANON__[:56]JSON::Schema::Modern::Document::OpenAPI::__ANON__[:56]
1117µs19µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@21JSON::Schema::Modern::Document::OpenAPI::BEGIN@21
1117µs22µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@22JSON::Schema::Modern::Document::OpenAPI::BEGIN@22
1117µs514µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@26JSON::Schema::Modern::Document::OpenAPI::BEGIN@26
1117µs97µsOpenAPI::Modern::::BEGIN@2.243 OpenAPI::Modern::BEGIN@2.243
1116µs304µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@11JSON::Schema::Modern::Document::OpenAPI::BEGIN@11
1116µs65µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@31JSON::Schema::Modern::Document::OpenAPI::BEGIN@31
1115µs13µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@17JSON::Schema::Modern::Document::OpenAPI::BEGIN@17
1115µs18µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@20JSON::Schema::Modern::Document::OpenAPI::BEGIN@20
1115µs16µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@23JSON::Schema::Modern::Document::OpenAPI::BEGIN@23
1114µs61µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@24JSON::Schema::Modern::Document::OpenAPI::BEGIN@24
1114µs47µsJSON::Schema::Modern::Document::OpenAPI::::BEGIN@43JSON::Schema::Modern::Document::OpenAPI::BEGIN@43
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
1233µs267µ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
use strict;
# spent 63µs making 1 call to OpenAPI::Modern::BEGIN@1.242 # spent 4µs making 1 call to strict::import
2241µs2187µ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
use warnings;
# spent 97µs making 1 call to OpenAPI::Modern::BEGIN@2.243 # spent 90µ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
810sour $VERSION = '0.037';
9
10227µs19µ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
use 5.020;
11232µs2602µ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
use Moo;
# spent 304µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 # spent 298µs making 1 call to Moo::import
123110µs31.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
use strictures 2;
# 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
13289µs2376µ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
use experimental qw(signatures postderef);
# spent 192µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 # spent 184µs making 1 call to experimental::import
14225µs242µ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
use if "$]" >= 5.022, experimental => 're_strict';
# spent 39µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 # spent 3µs making 1 call to if::import
15220µs237µ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
no if "$]" >= 5.031009, feature => 'indirect';
# spent 35µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@15 # spent 2µs making 1 call to if::unimport
16216µs250µ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
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 49µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@16 # spent 1µs making 1 call to if::unimport
17217µs214µ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
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 13µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@17 # spent 1µs making 1 call to if::unimport
18334µs3111µ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
use JSON::Schema::Modern::Utilities 0.525 qw(assert_keyword_exists assert_keyword_type E canonical_uri get_type);
# 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
19219µs2189µ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
use Safe::Isa;
# spent 121µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@19 # spent 68µs making 1 call to Exporter::import
20215µs231µ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
use File::ShareDir 'dist_dir';
# spent 18µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@20 # spent 13µs making 1 call to Exporter::import
21216µs231µ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
use Path::Tiny;
# spent 19µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@21 # spent 12µs making 1 call to Exporter::import
22217µs227µ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
use List::Util qw(any pairs);
# spent 22µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@22 # spent 5µs making 1 call to List::Util::import
23213µs227µ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
use Ref::Util 'is_plain_hashref';
# spent 16µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@23 # spent 11µs making 1 call to Exporter::import
24218µs2118µ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
use MooX::HandlesVia;
# spent 61µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@24 # spent 57µs making 1 call to MooX::HandlesVia::import
25329µs3650µ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
use MooX::TypeTiny 0.002002;
# 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
26233µs21.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
use Types::Standard qw(InstanceOf HashRef Str);
# spent 514µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@26 # spent 507µs making 1 call to Exporter::Tiny::import
27260µs2450µ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
use namespace::clean;
# 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
2911µs1796µsextends 'JSON::Schema::Modern::Document';
# spent 796µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::extends
30
31240µs2124µ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
use constant DEFAULT_DIALECT => 'https://spec.openapis.org/oas/3.1/dialect/base';
# spent 65µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@31 # spent 59µs making 1 call to constant::import
32
3311µ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
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',
41120µs243µ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
4321.09ms290µ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
use constant DEFAULT_METASCHEMA => 'https://spec.openapis.org/oas/3.1/schema-base/latest';
# spent 47µs making 1 call to JSON::Schema::Modern::Document::OpenAPI::BEGIN@43 # spent 43µs making 1 call to constant::import
44
4512µs11.48mshas '+evaluator' => (
# spent 1.48ms making 1 call to JSON::Schema::Modern::Document::OpenAPI::has
46 required => 1,
47);
48
4912µs11.72mshas '+metaschema_uri' => (
# spent 1.72ms 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'],
5616µs240µ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]
coerce => sub { $_[0]->$_isa('Mojo::URL') ? $_[0] : Mojo::URL->new($_[0]) },
# spent 32µs making 1 call to Mojo::URL::new # spent 8µs making 1 call to Safe::Isa::__ANON__[Safe/Isa.pm:23]
5718µs21.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
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 { {} },
7019µs31.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
7231µ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
sub traverse ($self, $evaluator) {
7316µs1239ms $self->_add_vocab_and_default_schemas;
74
7514µs10s my $schema = $self->schema;
# spent 0s making 1 call to JSON::Schema::Modern::Document::schema
76114µ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µs11µ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
9519µs228µs return $state if not assert_keyword_exists({ %$state, keyword => 'openapi' }, $schema)
96 or not assert_keyword_type({ %$state, keyword => 'openapi' }, $schema, 'string');
97
9816µs14µ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 {
10611µs return $state if exists $schema->{jsonSchemaDialect}
10710s and not assert_keyword_type({ %$state, keyword => 'jsonSchemaDialect' }, $schema, 'string');
108
10913µs11µ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
11518µs42.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
12110s 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)};
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
13210s my (@json_schema_paths, @operation_paths);
1332556416µs my $result = $self->evaluator->evaluate(
134 $self->schema,
135 $self->metaschema_uri,
136 {
137 callbacks => {
1385112897µ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
'$dynamicRef' => sub ($, $schema, $state) {
13925568.91ms push @json_schema_paths, $state->{data_path} if $schema->{'$dynamicRef'} eq '#meta';
140 },
14115486036.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
'$ref' => sub ($data, $schema, $state) {
142 push @operation_paths, [ $data->{operationId} => $state->{data_path} ]
1433871583.4ms if $schema->{'$ref'} eq '#/$defs/operation' and defined $data->{operationId};
144 },
145 },
146 },
147146µs464.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
149111µs217µ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.03ms1476µs foreach my $path (sort @json_schema_paths) {
157 # disregard paths that are not the root of each embedded subschema.
1584673884.74s9322208.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
1609631.46ms unshift @real_json_schema_paths, $path;
16196312.4ms19261.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
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
17513.68ms return $state;
176}
177
178######## NO PUBLIC INTERFACES FOLLOW THIS POINT ########
179
18020s
# 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
sub _add_vocab_and_default_schemas ($self) {
18111µs11µs my $js = $self->evaluator;
18216µs157.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 } },
200116µs1784µs );
# spent 784µs making 1 call to JSON::Schema::Modern::add_format_validation
201
202114µs15µs foreach my $pairs (pairs DEFAULT_SCHEMAS->%*) {
# spent 5µs making 1 call to List::Util::pairs
20366µs my ($filename, $uri) = @$pairs;
2046591µs36174ms 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));
206646µs81.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
21138521.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
sub _traverse_schema ($self, $schema, $state) {
2129631.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},
21872512.4ms2900991ms 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
221725928µs push $state->{errors}->@*, $subschema_state->{errors}->@*;
222725270µs return if $subschema_state->{errors}->@*;
223
2247255.73ms push $state->{identifiers}->@*, $subschema_state->{identifiers}->@*;
225}
226
227117µs1;
228
229132µs1387µs__END__
 
# 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
sub JSON::Schema::Modern::Document::OpenAPI::CORE:match; # opcode
# 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
sub JSON::Schema::Modern::Document::OpenAPI::CORE:regcomp; # opcode
# 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
sub JSON::Schema::Modern::Document::OpenAPI::CORE:sort; # opcode