| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package OpenAPI::Generator::Util; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
77
|
|
|
4
|
3
|
|
|
3
|
|
23
|
use warnings; |
|
|
3
|
|
|
|
|
35
|
|
|
|
3
|
|
|
|
|
71
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use Carp; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
159
|
|
|
7
|
3
|
|
|
3
|
|
16
|
use Exporter qw(import); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
1127
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
10
|
|
|
|
|
|
|
merge_definitions |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub merge_definitions { |
|
14
|
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
1
|
11
|
my(@definitions) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
4
|
50
|
|
|
|
11
|
croak 'no definitions to merge' unless @definitions; |
|
18
|
|
|
|
|
|
|
|
|
19
|
4
|
100
|
|
|
|
10
|
if (scalar @definitions == 1) { |
|
20
|
1
|
|
|
|
|
7
|
return $definitions[0]; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
5
|
my %common_def; |
|
24
|
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
8
|
for my $def (@definitions) { |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# paths |
|
28
|
8
|
|
|
|
|
9
|
while (my($path, $path_schema) = each %{$def->{paths}}) { |
|
|
18
|
|
|
|
|
59
|
|
|
29
|
10
|
|
|
|
|
13
|
while (my($method, $method_schema) = each %{$path_schema}) { |
|
|
20
|
|
|
|
|
47
|
|
|
30
|
10
|
50
|
|
|
|
22
|
if (exists $common_def{paths}{$path}{$method}) { |
|
31
|
0
|
|
|
|
|
0
|
croak "$method $path duplicates"; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
10
|
|
|
|
|
20
|
$common_def{paths}{$path}{$method} = $method_schema; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# comp param |
|
38
|
8
|
|
|
|
|
10
|
while (my($param, $param_schema) = each %{$def->{components}{parameters}}) { |
|
|
13
|
|
|
|
|
35
|
|
|
39
|
5
|
50
|
|
|
|
11
|
if (exists $common_def{components}{parameters}{$param}) { |
|
40
|
0
|
|
|
|
|
0
|
croak "param $param duplicates" |
|
41
|
|
|
|
|
|
|
} |
|
42
|
5
|
|
|
|
|
10
|
$common_def{components}{parameters}{$param} = $param_schema; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# comp schemas |
|
46
|
8
|
|
|
|
|
9
|
while (my($comp, $comp_schema) = each %{$def->{components}{schemas}}) { |
|
|
13
|
|
|
|
|
32
|
|
|
47
|
5
|
50
|
|
|
|
19
|
if (exists $common_def{components}{schemas}{$comp}) { |
|
48
|
0
|
|
|
|
|
0
|
croak "schema $comp duplicates" |
|
49
|
|
|
|
|
|
|
} |
|
50
|
5
|
|
|
|
|
12
|
$common_def{components}{schemas}{$comp} = $comp_schema; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# comp security |
|
54
|
8
|
|
|
|
|
9
|
while (my($security, $security_schema) = each %{$def->{components}{securitySchemes}}) { |
|
|
13
|
|
|
|
|
39
|
|
|
55
|
5
|
50
|
|
|
|
9
|
if (exists $common_def{components}{securitySchemes}{$security}) { |
|
56
|
0
|
|
|
|
|
0
|
croak "security $security duplicates" |
|
57
|
|
|
|
|
|
|
} |
|
58
|
5
|
|
|
|
|
59
|
$common_def{components}{securitySchemes}{$security} = $security_schema; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
24
|
return \%common_def; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1 |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |