line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
75014
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
282428
|
|
|
1
|
|
|
|
|
13
|
|
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.01'; |
17
|
|
|
|
|
|
|
#ABSTRACT: Object model for Swagger schema files |
18
|
1
|
|
|
1
|
|
2498
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
175189
|
|
|
1
|
|
|
|
|
5
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
key swagger => (isa => enum([ '2.0' ]), required => 1); |
21
|
|
|
|
|
|
|
key info => (isa => 'Swagger::Schema::Info', required => 1); |
22
|
|
|
|
|
|
|
key host => (isa => 'Str'); #MAY contain a port |
23
|
|
|
|
|
|
|
key basePath => (isa => subtype(as 'Str', where { $_ =~ /^\// })); |
24
|
|
|
|
|
|
|
array schemes => (isa => enum([ 'http', 'https', 'ws', 'wss'])); |
25
|
|
|
|
|
|
|
array consumes => (isa => 'Str'); #Str must be mime type: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#mimeTypes |
26
|
|
|
|
|
|
|
array produces => (isa => 'Str'); |
27
|
|
|
|
|
|
|
object paths => (isa => 'Swagger::Schema::Path', required => 1); |
28
|
|
|
|
|
|
|
object definitions => (isa => 'Swagger::Schema::Schema'); |
29
|
|
|
|
|
|
|
object parameters => (isa => 'Swagger::Schema::Parameter'); |
30
|
|
|
|
|
|
|
object responses => (isa => 'Swagger::Schema::Response'); |
31
|
|
|
|
|
|
|
object securityDefinitions => (isa => 'Swagger::Schema::SecurityScheme'); |
32
|
|
|
|
|
|
|
# The below declaration is declared as Any, because there is no way to represent |
33
|
|
|
|
|
|
|
# any array of hashrefs of strings |
34
|
|
|
|
|
|
|
#array security => (isa => 'Swagger::Schema::SecurityRequirement'); |
35
|
|
|
|
|
|
|
array security => (isa => 'Any'); |
36
|
|
|
|
|
|
|
array tags => (isa => 'Swagger::Schema::Tag'); |
37
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package Swagger::Schema::SecurityScheme { |
41
|
1
|
|
|
1
|
|
8058
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
5
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
|
7665
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
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
|
|
516
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
60
|
|
|
|
|
|
|
key get => (isa => 'Swagger::Schema::Operation'); |
61
|
|
|
|
|
|
|
key put => (isa => 'Swagger::Schema::Operation'); |
62
|
|
|
|
|
|
|
key post => (isa => 'Swagger::Schema::Operation'); |
63
|
|
|
|
|
|
|
key delete => (isa => 'Swagger::Schema::Operation'); |
64
|
|
|
|
|
|
|
key options => (isa => 'Swagger::Schema::Operation'); |
65
|
|
|
|
|
|
|
key head => (isa => 'Swagger::Schema::Operation'); |
66
|
|
|
|
|
|
|
key patch => (isa => 'Swagger::Schema::Operation'); |
67
|
|
|
|
|
|
|
array parameters => (isa => 'Swagger::Schema::Parameter'); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package Swagger::Schema::Tag { |
71
|
1
|
|
|
1
|
|
7512
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
72
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
73
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
74
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
enum 'Swagger::Schema::ParameterTypes', |
78
|
|
|
|
|
|
|
[qw/string number integer boolean array file object/]; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Swagger::Schema::Schema { |
81
|
1
|
|
|
1
|
|
7822
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
key ref => (isa => 'Str', location => '$ref'); |
84
|
|
|
|
|
|
|
key x_ms_client_flatten => (isa => 'Bool', location => 'x-ms-client-flatten'); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes'); |
87
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
88
|
|
|
|
|
|
|
key allowEmptyValue => (isa => 'Bool'); |
89
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
90
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
91
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
92
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
93
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
94
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
95
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
96
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
97
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
98
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
99
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
100
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
101
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
102
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
103
|
|
|
|
|
|
|
#x-^ patterned fields |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
key items => (isa => 'Swagger::Schema::Schema'); |
106
|
|
|
|
|
|
|
array allOf => (isa => 'Swagger::Schema::Schema'); |
107
|
|
|
|
|
|
|
object properties => (isa => 'Swagger::Schema::Schema'); |
108
|
|
|
|
|
|
|
object additionalProperties => (isa => 'Any'); |
109
|
|
|
|
|
|
|
key readOnly => (isa => 'Bool'); |
110
|
|
|
|
|
|
|
#key xml => (isa => 'Swagger::Schema::XML'); |
111
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
112
|
|
|
|
|
|
|
key example => (isa => 'Any'); |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
1
|
|
7761
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
package Swagger::Schema::Parameter { |
118
|
1
|
|
|
1
|
|
475
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
119
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
120
|
|
|
|
|
|
|
key in => (isa => 'Str'); |
121
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
122
|
|
|
|
|
|
|
key required => (isa => 'Bool'); |
123
|
|
|
|
|
|
|
key x_ms_client_flatten => (isa => 'Bool', location => 'x-ms-client-flatten'); |
124
|
|
|
|
|
|
|
key x_ms_skip_url_encoding => (isa => 'Bool', location => 'x-ms-skip-url-encoding'); |
125
|
|
|
|
|
|
|
key x_ms_enum => (isa => 'Swagger::Schema::MSX::Enum', location => 'x-ms-enum'); |
126
|
|
|
|
|
|
|
key x_ms_parameter_grouping => (isa => 'Swagger::Schema::MSX::ParameterGrouping', location => 'x-ms-parameter-grouping'); |
127
|
|
|
|
|
|
|
key x_ms_client_request_id => (isa => 'Bool', location => 'x-ms-client-request-id'); |
128
|
|
|
|
|
|
|
key x_ms_client_name => (isa => 'Str', location => 'x-ms-client-name'); |
129
|
|
|
|
|
|
|
key x_ms_parameter_location => (isa => 'Str', location => 'x-ms-parameter-location'); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
package Swagger::Schema::MSX::ParameterGrouping { |
133
|
1
|
|
|
1
|
|
8081
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
134
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
135
|
|
|
|
|
|
|
key postfix => (isa => 'Str'); |
136
|
1
|
|
|
1
|
|
8259
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
package Swagger::Schema::MSX::Enum { |
140
|
1
|
|
|
1
|
|
445
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
141
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
142
|
|
|
|
|
|
|
key modelAsString => (isa => 'Bool'); |
143
|
1
|
|
|
1
|
|
7895
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
package Swagger::Schema::RefParameter { |
147
|
1
|
|
|
1
|
|
463
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
148
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
149
|
|
|
|
|
|
|
key ref => (isa => 'Str', location => '$ref'); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
package Swagger::Schema::BodyParameter { |
153
|
1
|
|
|
1
|
|
8374
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
154
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
155
|
|
|
|
|
|
|
key schema => (isa => 'Swagger::Schema::Schema', required => 1); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
package Swagger::Schema::OtherParameter { |
159
|
1
|
|
|
1
|
|
8524
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
160
|
|
|
|
|
|
|
extends 'Swagger::Schema::Parameter'; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes', required => 1); |
163
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
164
|
|
|
|
|
|
|
key allowEmptyValue => (isa => 'Bool'); |
165
|
|
|
|
|
|
|
object items => (isa => 'Any'); |
166
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
167
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
168
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
169
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
170
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
171
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
172
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
173
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
174
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
175
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
176
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
177
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
178
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
179
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
180
|
|
|
|
|
|
|
#x-^ patterned fields |
181
|
|
|
|
|
|
|
|
182
|
1
|
|
|
1
|
|
8598
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
enum 'Swagger::Schema::CollectionFormat', |
186
|
|
|
|
|
|
|
[qw/csv ssv tsv pipes/]; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
package Swagger::Schema::Item { |
189
|
1
|
|
|
1
|
|
540
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
key type => (isa => 'Swagger::Schema::ParameterTypes', required => 1); |
192
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
array items => (isa => 'Swagger::Schema::Item'); |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Swagger::Schema::CollectionFormat'); |
197
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
198
|
|
|
|
|
|
|
key maximum => (isa => 'Num'); |
199
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
200
|
|
|
|
|
|
|
key minimum => (isa => 'Num'); |
201
|
|
|
|
|
|
|
key exclusiveMinimum => (isa => 'Bool'); |
202
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
203
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
204
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
205
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
206
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
207
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
208
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
209
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
210
|
|
|
|
|
|
|
#x-^ patterned fields |
211
|
|
|
|
|
|
|
|
212
|
1
|
|
|
1
|
|
8798
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
package Swagger::Schema::Operation { |
216
|
1
|
|
|
1
|
|
484
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
217
|
|
|
|
|
|
|
array tags => (isa => 'Str'); |
218
|
|
|
|
|
|
|
key summary => (isa => 'Str'); |
219
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
220
|
|
|
|
|
|
|
key externalDocs => (isa => 'Swagger::Schema::ExternalDocumentation'); |
221
|
|
|
|
|
|
|
key operationId => (isa => 'Str'); |
222
|
|
|
|
|
|
|
array consumes => (isa => 'Str'); #Must be a Mime Type |
223
|
|
|
|
|
|
|
array produces => (isa => 'Str'); #Must be a Mime Type |
224
|
|
|
|
|
|
|
array parameters => (isa => 'Swagger::Schema::Parameter'); |
225
|
|
|
|
|
|
|
object responses => (isa => 'Swagger::Schema::Response'); |
226
|
|
|
|
|
|
|
key schemes => (isa => 'Str'); |
227
|
|
|
|
|
|
|
key deprecated => (isa => 'Bool'); |
228
|
|
|
|
|
|
|
#key security => (isa => |
229
|
|
|
|
|
|
|
#TODO: x-^ fields |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
package Swagger::Schema::Response { |
233
|
1
|
|
|
1
|
|
8497
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
234
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
235
|
|
|
|
|
|
|
key schema => (isa => 'Swagger::Schema::Parameter'); |
236
|
|
|
|
|
|
|
object headers => (isa => 'Swagger::Schema::Header'); |
237
|
|
|
|
|
|
|
#key examples => (isa => ''); |
238
|
|
|
|
|
|
|
#TODO: patterned fields |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
package Swagger::Schema::Header { |
242
|
1
|
|
|
1
|
|
8062
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
243
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
244
|
|
|
|
|
|
|
key type => (isa => 'Str', required => 1); |
245
|
|
|
|
|
|
|
key format => (isa => 'Str'); |
246
|
|
|
|
|
|
|
object items => (isa => 'HashRef'); |
247
|
|
|
|
|
|
|
key collectionFormat => (isa => 'Str'); |
248
|
|
|
|
|
|
|
key default => (isa => 'Any'); |
249
|
|
|
|
|
|
|
key maximum => (isa => 'Int'); |
250
|
|
|
|
|
|
|
key exclusiveMaximum => (isa => 'Bool'); |
251
|
|
|
|
|
|
|
key minimum => (isa => 'Int'); |
252
|
|
|
|
|
|
|
key exclusiveMinumum => (isa => 'Bool'); |
253
|
|
|
|
|
|
|
key maxLength => (isa => 'Int'); |
254
|
|
|
|
|
|
|
key minLength => (isa => 'Int'); |
255
|
|
|
|
|
|
|
key pattern => (isa => 'Str'); |
256
|
|
|
|
|
|
|
key maxItems => (isa => 'Int'); |
257
|
|
|
|
|
|
|
key minItems => (isa => 'Int'); |
258
|
|
|
|
|
|
|
key uniqueItems => (isa => 'Bool'); |
259
|
|
|
|
|
|
|
array enum => (isa => 'Any'); |
260
|
|
|
|
|
|
|
key multipleOf => (isa => 'Num'); |
261
|
|
|
|
|
|
|
|
262
|
1
|
|
|
1
|
|
8115
|
no MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
package Swagger::Schema::ExternalDocumentation { |
266
|
1
|
|
|
1
|
|
499
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
267
|
|
|
|
|
|
|
key description => (isa => 'Str'); |
268
|
|
|
|
|
|
|
key url => (isa => 'Str', required => 1); #Must be in the format of a URL |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
package Swagger::Schema::Info { |
272
|
1
|
|
|
1
|
|
8133
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
273
|
|
|
|
|
|
|
key title => (isa => 'Str', required => 1); |
274
|
|
|
|
|
|
|
key description => (isa => 'Str'); #Can contain GFM |
275
|
|
|
|
|
|
|
key termsOfService => (isa => 'Str'); |
276
|
|
|
|
|
|
|
key contact => (isa => 'Swagger::Schema::Contact'); |
277
|
|
|
|
|
|
|
key license => (isa => 'Swagger::Schema::License'); |
278
|
|
|
|
|
|
|
key version => (isa => 'Str', required => 1); |
279
|
|
|
|
|
|
|
#TODO: x-^ extensions |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
package Swagger::Schema::License { |
283
|
1
|
|
|
1
|
|
8408
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
284
|
|
|
|
|
|
|
key name => (isa => 'Str', required => 1); |
285
|
|
|
|
|
|
|
key url => (isa => 'Str'); #Must be in the format of a URL |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
package Swagger::Schema::Contact { |
289
|
1
|
|
|
1
|
|
8194
|
use MooseX::DataModel; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
290
|
|
|
|
|
|
|
key name => (isa => 'Str'); |
291
|
|
|
|
|
|
|
key url => (isa => 'Str'); |
292
|
|
|
|
|
|
|
key email => (isa => 'Str'); |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
### main pod documentation begin ### |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=encoding UTF-8 |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head1 NAME |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Swagger::Schema - Object access to Swagger / OpenAPI schema files |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head1 SYNOPSIS |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
use File::Slurp; |
305
|
|
|
|
|
|
|
my $data = read_file($swagger_file); |
306
|
|
|
|
|
|
|
my $schema = Swagger::Schema->MooseX::DataModel::new_from_json($data); |
307
|
|
|
|
|
|
|
# use the object model |
308
|
|
|
|
|
|
|
say "This API consists of:"; |
309
|
|
|
|
|
|
|
foreach my $path (sort keys %{ $schema->paths }){ |
310
|
|
|
|
|
|
|
foreach my $http_verb (sort keys %{ $schema->paths->{ $path } }) { |
311
|
|
|
|
|
|
|
say "$http_verb on $path"; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head1 DESCRIPTION |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Get programmatic access to a Swagger / OpenAPI file. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head1 OBJECT MODEL |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
The object model is defined with L<MooseX::DataModel>. Take a look at the |
322
|
|
|
|
|
|
|
C<lib/Swagger/Schema.pm> file or the swagger spec |
323
|
|
|
|
|
|
|
L<https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md> |
324
|
|
|
|
|
|
|
to know what you can find inside the objects |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head1 SEE ALSO |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
L<https://github.com/OAI/OpenAPI-Specification> |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
L<http://swagger.io> |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=head1 AUTHOR |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Jose Luis Martinez |
335
|
|
|
|
|
|
|
CAPSiDE |
336
|
|
|
|
|
|
|
jlmartinez@capside.com |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head1 BUGS and SOURCE |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/swagger-schema-perl |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/swagger-schema-perl/issues |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=head1 COPYRIGHT and LICENSE |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
Copyright (c) 2015 by CAPSiDE |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
This code is distributed under the Apache 2 License. The full text of the |
349
|
|
|
|
|
|
|
license can be found in the LICENSE file included with this module. |