line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
102237
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
288838
|
|
|
1
|
|
|
|
|
12
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
coerce 'Swagger::Schema::Parameter', |
4
|
|
|
|
|
|
|
from 'HashRef', |
5
|
|
|
|
|
|
|
via { |
6
|
|
|
|
|
|
|
if (exists $_->{ in } and $_->{ in } eq 'body') { |
7
|
|
|
|
|
|
|
return Swagger::Schema::BodyParameter->new($_); |
8
|
|
|
|
|
|
|
} elsif ($_->{ '$ref' }) { |
9
|
|
|
|
|
|
|
return Swagger::Schema::RefParameter->new($_); |
10
|
|
|
|
|
|
|
} else { |
11
|
|
|
|
|
|
|
return Swagger::Schema::OtherParameter->new($_); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Swagger::Schema { |
16
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
17
|
|
|
|
|
|
|
#ABSTRACT: Object model for Swagger schema files |
18
|
1
|
|
|
1
|
|
2837
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
188191
|
|
|
1
|
|
|
|
|
5
|
|
19
|
1
|
|
|
1
|
|
8484
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
20
|
1
|
|
|
1
|
|
2303
|
use namespace::autoclean; |
|
1
|
|
|
|
|
8317
|
|
|
1
|
|
|
|
|
5
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
key swagger => (isa => enum([ '2.0' ]), required => 1); |
23
|
|
|
|
|
|
|
key info => (isa => 'Swagger::Schema::Info', required => 1); |
24
|
|
|
|
|
|
|
key host => (isa => 'Str'); #MAY contain a port |
25
|
|
|
|
|
|
|
key basePath => (isa => subtype(as 'Str', where { $_ =~ /^\// })); |
26
|
|
|
|
|
|
|
array schemes => (isa => enum([ 'http', 'https', 'ws', 'wss'])); |
27
|
|
|
|
|
|
|
array consumes => (isa => 'Str'); #Str must be mime type: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#mimeTypes |
28
|
|
|
|
|
|
|
array produces => (isa => 'Str'); |
29
|
|
|
|
|
|
|
object paths => (isa => 'Swagger::Schema::Path', required => 1); |
30
|
|
|
|
|
|
|
object definitions => (isa => 'Swagger::Schema::Schema'); |
31
|
|
|
|
|
|
|
object parameters => (isa => 'Swagger::Schema::Parameter'); |
32
|
|
|
|
|
|
|
object responses => (isa => 'Swagger::Schema::Response'); |
33
|
|
|
|
|
|
|
object securityDefinitions => (isa => 'Swagger::Schema::SecurityScheme'); |
34
|
|
|
|
|
|
|
# The below declaration is declared as Any, because there is no way to represent |
35
|
|
|
|
|
|
|
# any array of hashrefs of strings |
36
|
|
|
|
|
|
|
#array security => (isa => 'Swagger::Schema::SecurityRequirement'); |
37
|
|
|
|
|
|
|
array security => (isa => 'Any'); |
38
|
|
|
|
|
|
|
array tags => (isa => 'Swagger::Schema::Tag'); |
39
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
package Swagger::Schema::SecurityScheme { |
43
|
1
|
|
|
1
|
|
3068
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
44
|
1
|
|
|
1
|
|
8735
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#package Swagger::Schema::SecurityRequirement { |
49
|
|
|
|
|
|
|
# use MooseX::DataModel; |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# # See the security attribute in Swagger::Schema |
52
|
|
|
|
|
|
|
# # this object is more like a plain hashref |
53
|
|
|
|
|
|
|
# # it only has a patterned field {name}, which holds an array of strings |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# no MooseX::DataModel; |
56
|
|
|
|
|
|
|
#} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
package Swagger::Schema::Path { |
59
|
1
|
|
|
1
|
|
2691
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
60
|
1
|
|
|
1
|
|
8260
|
use namespace::autoclean; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
4
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
key get => (isa => 'Swagger::Schema::Operation'); |
63
|
|
|
|
|
|
|
key put => (isa => 'Swagger::Schema::Operation'); |
64
|
|
|
|
|
|
|
key post => (isa => 'Swagger::Schema::Operation'); |
65
|
|
|
|
|
|
|
key delete => (isa => 'Swagger::Schema::Operation'); |
66
|
|
|
|
|
|
|
key options => (isa => 'Swagger::Schema::Operation'); |
67
|
|
|
|
|
|
|
key head => (isa => 'Swagger::Schema::Operation'); |
68
|
|
|
|
|
|
|
key patch => (isa => 'Swagger::Schema::Operation'); |
69
|
|
|
|
|
|
|
array parameters => (isa => 'Swagger::Schema::Parameter'); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
package Swagger::Schema::Tag { |
73
|
1
|
|
|
1
|
|
2694
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
74
|
1
|
|
|
1
|
|
8263
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
77
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
78
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
enum 'Swagger::Schema::ParameterTypes', |
82
|
|
|
|
|
|
|
[qw/string number integer boolean array file object/]; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
package Swagger::Schema::Schema { |
85
|
1
|
|
|
1
|
|
2690
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
86
|
1
|
|
|
1
|
|
8379
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
key ref => (isa => 'Str', location => '$ref'); |
89
|
|
|
|
|
|
|
key x_ms_client_flatten => (isa => 'Bool', location => 'x-ms-client-flatten'); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes'); |
92
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
93
|
|
|
|
|
|
|
key allowEmptyValue => (isa => 'Bool'); |
94
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
95
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
96
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
97
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
98
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
99
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
100
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
101
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
102
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
103
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
104
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
105
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
106
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
107
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
108
|
|
|
|
|
|
|
#x-^ patterned fields |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
key items => (isa => 'Swagger::Schema::Schema'); |
111
|
|
|
|
|
|
|
array allOf => (isa => 'Swagger::Schema::Schema'); |
112
|
|
|
|
|
|
|
object properties => (isa => 'Swagger::Schema::Schema'); |
113
|
|
|
|
|
|
|
key additionalProperties => (isa => 'Swagger::Schema::Schema'); |
114
|
|
|
|
|
|
|
key readOnly => (isa => 'Bool'); |
115
|
|
|
|
|
|
|
#key xml => (isa => 'Swagger::Schema::XML'); |
116
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
117
|
|
|
|
|
|
|
key example => (isa => 'Any'); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
package Swagger::Schema::Parameter { |
121
|
1
|
|
|
1
|
|
3207
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
122
|
1
|
|
|
1
|
|
8631
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
125
|
|
|
|
|
|
|
key in => (isa => 'Str'); |
126
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
127
|
|
|
|
|
|
|
key required => (isa => 'Bool'); |
128
|
|
|
|
|
|
|
key x_ms_client_flatten => (isa => 'Bool', location => 'x-ms-client-flatten'); |
129
|
|
|
|
|
|
|
key x_ms_skip_url_encoding => (isa => 'Bool', location => 'x-ms-skip-url-encoding'); |
130
|
|
|
|
|
|
|
key x_ms_enum => (isa => 'Swagger::Schema::MSX::Enum', location => 'x-ms-enum'); |
131
|
|
|
|
|
|
|
key x_ms_parameter_grouping => (isa => 'Swagger::Schema::MSX::ParameterGrouping', location => 'x-ms-parameter-grouping'); |
132
|
|
|
|
|
|
|
key x_ms_client_request_id => (isa => 'Bool', location => 'x-ms-client-request-id'); |
133
|
|
|
|
|
|
|
key x_ms_client_name => (isa => 'Str', location => 'x-ms-client-name'); |
134
|
|
|
|
|
|
|
key x_ms_parameter_location => (isa => 'Str', location => 'x-ms-parameter-location'); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
package Swagger::Schema::MSX::ParameterGrouping { |
138
|
1
|
|
|
1
|
|
2790
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
139
|
1
|
|
|
1
|
|
8378
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
142
|
|
|
|
|
|
|
key postfix => (isa => 'Str'); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
package Swagger::Schema::MSX::Enum { |
146
|
1
|
|
|
1
|
|
2684
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
147
|
1
|
|
|
1
|
|
17112
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
150
|
|
|
|
|
|
|
key modelAsString => (isa => 'Bool'); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
package Swagger::Schema::RefParameter { |
154
|
1
|
|
|
1
|
|
2845
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
155
|
1
|
|
|
1
|
|
8948
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
158
|
|
|
|
|
|
|
key ref => (isa => 'Str', location => '$ref'); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
package Swagger::Schema::BodyParameter { |
162
|
1
|
|
|
1
|
|
2681
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
163
|
1
|
|
|
1
|
|
8392
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
16
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
166
|
|
|
|
|
|
|
key schema => (isa => 'Swagger::Schema::Schema', required => 1); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
package Swagger::Schema::OtherParameter { |
170
|
1
|
|
|
1
|
|
4031
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
171
|
1
|
|
|
1
|
|
8414
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes', required => 1); |
176
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
177
|
|
|
|
|
|
|
key allowEmptyValue => (isa => 'Bool'); |
178
|
|
|
|
|
|
|
object items => (isa => 'Any'); |
179
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
180
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
181
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
182
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
183
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
184
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
185
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
186
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
187
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
188
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
189
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
190
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
191
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
192
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
193
|
|
|
|
|
|
|
#x-^ patterned fields |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
enum 'Swagger::Schema::CollectionFormat', |
197
|
|
|
|
|
|
|
[qw/csv ssv tsv pipes/]; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
package Swagger::Schema::Item { |
200
|
1
|
|
|
1
|
|
2865
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
201
|
1
|
|
|
1
|
|
8540
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes', required => 1); |
204
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
array items => (isa => 'Swagger::Schema::Item'); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Swagger::Schema::CollectionFormat'); |
209
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
210
|
|
|
|
|
|
|
key maximum => (isa => 'Num'); |
211
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
212
|
|
|
|
|
|
|
key minimum => (isa => 'Num'); |
213
|
|
|
|
|
|
|
key exclusiveMinimum => (isa => 'Bool'); |
214
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
215
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
216
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
217
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
218
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
219
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
220
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
221
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
222
|
|
|
|
|
|
|
#x-^ patterned fields |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
package Swagger::Schema::Operation { |
226
|
1
|
|
|
1
|
|
2778
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
227
|
1
|
|
|
1
|
|
8570
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
array tags => (isa => 'Str'); |
230
|
|
|
|
|
|
|
key summary => (isa => 'Str'); |
231
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
232
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
233
|
|
|
|
|
|
|
key operationId => (isa => 'Str'); |
234
|
|
|
|
|
|
|
array consumes => (isa => 'Str'); #Must be a Mime Type |
235
|
|
|
|
|
|
|
array produces => (isa => 'Str'); #Must be a Mime Type |
236
|
|
|
|
|
|
|
array parameters => (isa => 'Swagger::Schema::Parameter'); |
237
|
|
|
|
|
|
|
object responses => (isa => 'Swagger::Schema::Response'); |
238
|
|
|
|
|
|
|
array schemes => (isa => 'Str'); |
239
|
|
|
|
|
|
|
key deprecated => (isa => 'Bool'); |
240
|
|
|
|
|
|
|
key x_ms_long_running_operation => (isa => 'Bool', location => 'x-ms-long-running-operation'); |
241
|
|
|
|
|
|
|
#key security => (isa => |
242
|
|
|
|
|
|
|
#TODO: x-^ fields |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
package Swagger::Schema::Response { |
246
|
1
|
|
|
1
|
|
2824
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
247
|
1
|
|
|
1
|
|
8465
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
250
|
|
|
|
|
|
|
key schema => (isa => 'Swagger::Schema::Parameter'); |
251
|
|
|
|
|
|
|
object headers => (isa => 'Swagger::Schema::Header'); |
252
|
|
|
|
|
|
|
#key examples => (isa => ''); |
253
|
|
|
|
|
|
|
#TODO: patterned fields |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
package Swagger::Schema::Header { |
257
|
1
|
|
|
1
|
|
2634
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
5
|
|
258
|
1
|
|
|
1
|
|
8348
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
261
|
|
|
|
|
|
|
key type => (isa => 'Str', required => 1); |
262
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
263
|
|
|
|
|
|
|
object items => (isa => 'HashRef'); |
264
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
265
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
266
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
267
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
268
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
269
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
270
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
271
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
272
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
273
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
274
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
275
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
276
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
277
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
package Swagger::Schema::ExternalDocumentation { |
281
|
1
|
|
|
1
|
|
3144
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
282
|
1
|
|
|
1
|
|
8341
|
use namespace::autoclean; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
6
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
285
|
|
|
|
|
|
|
key url => (isa => 'Str', required => 1); #Must be in the format of a URL |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
package Swagger::Schema::Info { |
289
|
1
|
|
|
1
|
|
2648
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
290
|
1
|
|
|
1
|
|
8324
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
key title => (isa => 'Str', required => 1); |
293
|
|
|
|
|
|
|
key description => (isa => 'Str'); #Can contain GFM |
294
|
|
|
|
|
|
|
key termsOfService => (isa => 'Str'); |
295
|
|
|
|
|
|
|
key contact => (isa => 'Swagger::Schema::Contact'); |
296
|
|
|
|
|
|
|
key license => (isa => 'Swagger::Schema::License'); |
297
|
|
|
|
|
|
|
key version => (isa => 'Str', required => 1); |
298
|
|
|
|
|
|
|
#TODO: x-^ extensions |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
package Swagger::Schema::License { |
302
|
1
|
|
|
1
|
|
2664
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
303
|
1
|
|
|
1
|
|
8347
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
key name => (isa => 'Str', required => 1); |
306
|
|
|
|
|
|
|
key url => (isa => 'Str'); #Must be in the format of a URL |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
package Swagger::Schema::Contact { |
310
|
1
|
|
|
1
|
|
2679
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
311
|
1
|
|
|
1
|
|
8481
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
314
|
|
|
|
|
|
|
key url => (isa => 'Str'); |
315
|
|
|
|
|
|
|
key email => (isa => 'Str'); |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
### main pod documentation begin ### |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=encoding UTF-8 |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head1 NAME |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Swagger::Schema - Object access to Swagger / OpenAPI schema files |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=head1 SYNOPSIS |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
use File::Slurp; |
328
|
|
|
|
|
|
|
my $data = read_file($swagger_file); |
329
|
|
|
|
|
|
|
my $schema = Swagger::Schema->MooseX::DataModel::new_from_json($data); |
330
|
|
|
|
|
|
|
# use the object model |
331
|
|
|
|
|
|
|
say "This API consists of:"; |
332
|
|
|
|
|
|
|
foreach my $path (sort keys %{ $schema->paths }){ |
333
|
|
|
|
|
|
|
foreach my $http_verb (sort keys %{ $schema->paths->{ $path } }) { |
334
|
|
|
|
|
|
|
say "$http_verb on $path"; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head1 DESCRIPTION |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
Get programmatic access to a Swagger / OpenAPI file (version 2). |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
If you're looking for OpenAPI 3 support, take a look at: L<Swagger::Schema::V3> |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=head1 OBJECT MODEL |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
The object model is defined with L<MooseX::DataModel>. Take a look at the |
347
|
|
|
|
|
|
|
C<lib/Swagger/Schema.pm> file or the swagger spec |
348
|
|
|
|
|
|
|
L<https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md> |
349
|
|
|
|
|
|
|
to know what you can find inside the objects |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head1 SEE ALSO |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
L<https://github.com/OAI/OpenAPI-Specification> |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
L<http://swagger.io> |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=head1 AUTHOR |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
Jose Luis Martinez |
360
|
|
|
|
|
|
|
CAPSiDE |
361
|
|
|
|
|
|
|
jlmartinez@capside.com |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head1 THANKS |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Andrew Solomon for contributions to the V3 Swagger code |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=head1 BUGS and SOURCE |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/swagger-schema-perl |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/swagger-schema-perl/issues |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=head1 COPYRIGHT and LICENSE |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
Copyright (c) 2015 by CAPSiDE |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
This code is distributed under the Apache 2 License. The full text of the |
378
|
|
|
|
|
|
|
license can be found in the LICENSE file included with this module. |