open_api-loader 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +15 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +28 -0
  6. data/.travis.yml +24 -0
  7. data/CHANGELOG.md +10 -0
  8. data/Gemfile +8 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +99 -0
  11. data/Rakefile +10 -0
  12. data/bin/console +6 -0
  13. data/bin/setup +6 -0
  14. data/lib/open_api-loader.rb +1 -0
  15. data/lib/open_api/loader.rb +44 -0
  16. data/lib/open_api/loader/collector.rb +61 -0
  17. data/lib/open_api/loader/denormalizer.rb +27 -0
  18. data/lib/open_api/loader/denormalizer/parameters.rb +46 -0
  19. data/lib/open_api/loader/denormalizer/security.rb +35 -0
  20. data/lib/open_api/loader/denormalizer/servers.rb +36 -0
  21. data/lib/open_api/loader/denormalizer/variables.rb +54 -0
  22. data/lib/open_api/loader/reader.rb +47 -0
  23. data/lib/open_api/loader/ref.rb +85 -0
  24. data/lib/open_api/loader/translator.rb +50 -0
  25. data/lib/open_api/loader/translator/clean_definitions.rb +16 -0
  26. data/lib/open_api/loader/translator/convert_bodies.rb +77 -0
  27. data/lib/open_api/loader/translator/convert_forms.rb +71 -0
  28. data/lib/open_api/loader/translator/convert_parameters.rb +135 -0
  29. data/lib/open_api/loader/translator/convert_responses.rb +63 -0
  30. data/lib/open_api/loader/translator/convert_security_schemes.rb +49 -0
  31. data/lib/open_api/loader/translator/convert_servers.rb +46 -0
  32. data/lib/open_api/loader/translator/convert_version.rb +12 -0
  33. data/lib/open_api/loader/translator/denormalize_consumes.rb +44 -0
  34. data/lib/open_api/loader/translator/denormalize_parameters.rb +55 -0
  35. data/lib/open_api/loader/translator/denormalize_produces.rb +53 -0
  36. data/open_api-loader.gemspec +25 -0
  37. data/spec/fixtures/oas2/collected.yaml +1012 -0
  38. data/spec/fixtures/oas2/denormalized.yaml +1462 -0
  39. data/spec/fixtures/oas2/loaded.yaml +564 -0
  40. data/spec/fixtures/oas2/models.yaml +118 -0
  41. data/spec/fixtures/oas2/source.json +1 -0
  42. data/spec/fixtures/oas2/source.yaml +569 -0
  43. data/spec/fixtures/oas2/translated.yaml +1396 -0
  44. data/spec/fixtures/oas3/collected.yaml +233 -0
  45. data/spec/fixtures/oas3/denormalized.yaml +233 -0
  46. data/spec/fixtures/oas3/source.json +1 -0
  47. data/spec/fixtures/oas3/source.yaml +217 -0
  48. data/spec/loader_spec.rb +53 -0
  49. data/spec/spec_helper.rb +17 -0
  50. data/spec/support/fixture_helpers.rb +18 -0
  51. data/spec/support/path_helpers.rb +27 -0
  52. data/spec/unit/collector_spec.rb +31 -0
  53. data/spec/unit/denormalizer_spec.rb +17 -0
  54. data/spec/unit/reader_spec.rb +53 -0
  55. data/spec/unit/ref_spec.rb +107 -0
  56. data/spec/unit/translator_spec.rb +15 -0
  57. metadata +232 -0
@@ -0,0 +1,118 @@
1
+ #
2
+ # The part of the source specification extracted to the separate file
3
+ #
4
+ # The corresnponding "$ref"-s in lines 92, 109
5
+ # were changed from "#/definitions/..." to "#/..."
6
+ #
7
+ # It is "$ref"-erred from files "petstore.yaml" and "petstore.json"
8
+ # This file is used to ensure correct dereferencing.
9
+ #
10
+ ---
11
+ Order:
12
+ type: "object"
13
+ properties:
14
+ id:
15
+ type: "integer"
16
+ format: "int64"
17
+ petId:
18
+ type: "integer"
19
+ format: "int64"
20
+ quantity:
21
+ type: "integer"
22
+ format: "int32"
23
+ shipDate:
24
+ type: "string"
25
+ format: "date-time"
26
+ status:
27
+ type: "string"
28
+ description: "Order Status"
29
+ enum:
30
+ - "placed"
31
+ - "approved"
32
+ - "delivered"
33
+ complete:
34
+ type: "boolean"
35
+ default: false
36
+ xml:
37
+ name: "Order"
38
+ Category:
39
+ type: "object"
40
+ properties:
41
+ id:
42
+ type: "integer"
43
+ format: "int64"
44
+ name:
45
+ type: "string"
46
+ xml:
47
+ name: "Category"
48
+ User:
49
+ type: "object"
50
+ properties:
51
+ id:
52
+ type: "integer"
53
+ format: "int64"
54
+ username:
55
+ type: "string"
56
+ firstName:
57
+ type: "string"
58
+ lastName:
59
+ type: "string"
60
+ email:
61
+ type: "string"
62
+ password:
63
+ type: "string"
64
+ phone:
65
+ type: "string"
66
+ userStatus:
67
+ type: "integer"
68
+ format: "int32"
69
+ description: "User Status"
70
+ xml:
71
+ name: "User"
72
+ Tag:
73
+ type: "object"
74
+ properties:
75
+ id:
76
+ type: "integer"
77
+ format: "int64"
78
+ name:
79
+ type: "string"
80
+ xml:
81
+ name: "Tag"
82
+ Pet:
83
+ type: "object"
84
+ required:
85
+ - "name"
86
+ - "photoUrls"
87
+ properties:
88
+ id:
89
+ type: "integer"
90
+ format: "int64"
91
+ category:
92
+ $ref: "#/Category"
93
+ name:
94
+ type: "string"
95
+ example: "doggie"
96
+ photoUrls:
97
+ type: "array"
98
+ xml:
99
+ name: "photoUrl"
100
+ wrapped: true
101
+ items:
102
+ type: "string"
103
+ tags:
104
+ type: "array"
105
+ xml:
106
+ name: "tag"
107
+ wrapped: true
108
+ items:
109
+ $ref: "#/Tag"
110
+ status:
111
+ type: "string"
112
+ description: "pet status in the store"
113
+ enum:
114
+ - "available"
115
+ - "pending"
116
+ - "sold"
117
+ xml:
118
+ name: "Pet"
@@ -0,0 +1 @@
1
+ {"swagger":"2.0","info":{"description":"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["http"],"consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store","description":"","operationId":"addPet","parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"models.yaml#/Pet"}}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"put":{"tags":["pet"],"summary":"Update an existing pet","description":"","operationId":"updatePet","parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"models.yaml#/Pet"}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"},"405":{"description":"Validators exception"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByStatus":{"get":{"tags":["pet"],"summary":"Finds Pets by status","description":"Multiple status values can be provided with comma separated strings","operationId":"findPetsByStatus","produces":["application/xml","application/json"],"parameters":[{"name":"status","in":"query","description":"Status values that need to be considered for filter","required":true,"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"models.yaml#/Pet"}}},"400":{"description":"Invalid status value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByTags":{"get":{"tags":["pet"],"summary":"Finds Pets by tags","description":"Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.","operationId":"findPetsByTags","produces":["application/xml","application/json"],"parameters":[{"name":"tags","in":"query","description":"Tags to filter by","required":true,"type":"array","items":{"type":"string"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"models.yaml#/Pet"}}},"400":{"description":"Invalid tag value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}],"deprecated":true}},"/pet/{petId}":{"parameters":[{"name":"petId","in":"path","description":"ID of pet","required":true,"type":"integer","format":"int64"}],"get":{"tags":["pet"],"summary":"Find pet by ID","description":"Returns a single pet","operationId":"getPetById","produces":["application/xml","application/json"],"responses":{"200":{"description":"successful operation","schema":{"$ref":"models.yaml#/Pet"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"api_key":[]}]},"post":{"tags":["pet"],"summary":"Updates a pet in the store with form data","description":"","operationId":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"parameters":[{"name":"name","in":"formData","description":"Updated name of the pet","required":false,"type":"string"},{"name":"status","in":"formData","description":"Updated status of the pet","required":false,"type":"string"}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"delete":{"tags":["pet"],"summary":"Deletes a pet","description":"","operationId":"deletePet","produces":["application/xml","application/json"],"parameters":[{"name":"api_key","in":"header","required":false,"type":"string"}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{"parameters":[{"name":"petId","in":"path","description":"ID of pet","required":true,"type":"integer","format":"int64"}],"post":{"tags":["pet"],"summary":"uploads an image","description":"","operationId":"uploadFile","consumes":["multipart/form-data"],"produces":["application/json"],"parameters":[{"name":"additionalMetadata","in":"formData","description":"Additional data to pass to server","required":false,"type":"string"},{"name":"file","in":"formData","description":"file to upload","required":false,"type":"file"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiResponse"}}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/store/inventory":{"get":{"tags":["store"],"summary":"Returns pet inventories by status","description":"Returns a map of status codes to quantities","operationId":"getInventory","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"object","additionalProperties":{"type":"integer","format":"int32"}}}},"security":[{"api_key":[]}]}},"/store/order":{"post":{"tags":["store"],"summary":"Place an order for a pet","description":"","operationId":"placeOrder","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"order placed for purchasing the pet","required":true,"schema":{"$ref":"models.yaml#/Order"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"models.yaml#/Order"}},"400":{"description":"Invalid Order"}}}},"/store/order/{orderId}":{"parameters":[{"name":"orderId","in":"path","description":"ID of purchase order","required":true,"type":"integer","maximum":10.0,"minimum":1.0,"format":"int64"}],"get":{"tags":["store"],"summary":"Find purchase order by ID","description":"For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions","operationId":"getOrderById","produces":["application/xml","application/json"],"responses":{"200":{"description":"successful operation","schema":{"$ref":"models.yaml#/Order"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}},"delete":{"tags":["store"],"summary":"Delete purchase order by ID","description":"For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors","operationId":"deleteOrder","produces":["application/xml","application/json"],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}}},"/user":{"post":{"tags":["user"],"summary":"Create user","description":"This can only be done by the logged in user.","operationId":"createUser","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Created user object","required":true,"schema":{"$ref":"models.yaml#/User"}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithArray":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithArrayInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"models.yaml#/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithList":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithListInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"models.yaml#/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/login":{"get":{"tags":["user"],"summary":"Logs user into the system","description":"","operationId":"loginUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"type":"string"},"headers":{"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"},"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"}}},"400":{"description":"Invalid username/password supplied"}}}},"/user/logout":{"get":{"tags":["user"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/xml","application/json"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/user/{username}":{"parameters":[{"name":"username","in":"path","description":"The name of the user. Use user1 for testing. ","required":true,"type":"string"}],"get":{"tags":["user"],"summary":"Get user by user name","description":"","operationId":"getUserByName","produces":["application/xml","application/json"],"responses":{"200":{"description":"successful operation","schema":{"$ref":"models.yaml#/User"}},"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}},"put":{"tags":["user"],"summary":"Updated user","description":"This can only be done by the logged in user.","operationId":"updateUser","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Updated user object","required":true,"schema":{"$ref":"models.yaml#/User"}}],"responses":{"400":{"description":"Invalid user supplied"},"404":{"description":"User not found"}}},"delete":{"tags":["user"],"summary":"Delete user","description":"This can only be done by the logged in user.","operationId":"deleteUser","parameters":[{"name":"username","in":"path","description":"The name of the user to be deleted. ","required":true,"type":"string"}],"produces":["application/xml","application/json"],"responses":{"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}}}},"securityDefinitions":{"petstore_auth":{"type":"oauth2","authorizationUrl":"http://petstore.swagger.io/oauth/dialog","flow":"implicit","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}},"api_key":{"type":"apiKey","name":"api_key","in":"header"}},"definitions":{"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"type":{"type":"string"},"message":{"type":"string"}}}},"externalDocs":{"description":"Find out more about Swagger","url":"http://swagger.io"}}
@@ -0,0 +1,569 @@
1
+ #
2
+ # The source specification to be loaded
3
+ #
4
+ # The file has been downloaded from "http://swagger.io".
5
+ # Then some definitions were extracted from this file
6
+ # into the the outer file "models.yaml". The corresponding "$ref"-s
7
+ # where changed from "#/definitions/..." to "models.yaml#/...".
8
+ #
9
+ # The file 'source.json' contains exactly the same data in the JSON format.
10
+ #
11
+ ---
12
+ swagger: "2.0"
13
+ info:
14
+ description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
15
+ version: "1.0.0"
16
+ title: "Swagger Petstore"
17
+ termsOfService: "http://swagger.io/terms/"
18
+ contact:
19
+ email: "apiteam@swagger.io"
20
+ license:
21
+ name: "Apache 2.0"
22
+ url: "http://www.apache.org/licenses/LICENSE-2.0.html"
23
+ host: "petstore.swagger.io"
24
+ basePath: "/v2"
25
+ tags:
26
+ - name: "pet"
27
+ description: "Everything about your Pets"
28
+ externalDocs:
29
+ description: "Find out more"
30
+ url: "http://swagger.io"
31
+ - name: "store"
32
+ description: "Access to Petstore orders"
33
+ - name: "user"
34
+ description: "Operations about user"
35
+ externalDocs:
36
+ description: "Find out more about our store"
37
+ url: "http://swagger.io"
38
+ schemes:
39
+ - http
40
+ consumes:
41
+ - application/json
42
+ - application/xml
43
+ produces:
44
+ - application/xml
45
+ - application/json
46
+ paths:
47
+ /pet:
48
+ post:
49
+ tags:
50
+ - "pet"
51
+ summary: "Add a new pet to the store"
52
+ description: ""
53
+ operationId: "addPet"
54
+ parameters:
55
+ - in: "body"
56
+ name: "body"
57
+ description: "Pet object that needs to be added to the store"
58
+ required: true
59
+ schema:
60
+ $ref: "models.yaml#/Pet"
61
+ responses:
62
+ 405:
63
+ description: "Invalid input"
64
+ security:
65
+ - petstore_auth:
66
+ - "write:pets"
67
+ - "read:pets"
68
+ put:
69
+ tags:
70
+ - "pet"
71
+ summary: "Update an existing pet"
72
+ description: ""
73
+ operationId: "updatePet"
74
+ parameters:
75
+ - in: "body"
76
+ name: "body"
77
+ description: "Pet object that needs to be added to the store"
78
+ required: true
79
+ schema:
80
+ $ref: "models.yaml#/Pet"
81
+ responses:
82
+ 400:
83
+ description: "Invalid ID supplied"
84
+ 404:
85
+ description: "Pet not found"
86
+ 405:
87
+ description: "Validators exception"
88
+ security:
89
+ - petstore_auth:
90
+ - "write:pets"
91
+ - "read:pets"
92
+ /pet/findByStatus:
93
+ get:
94
+ tags:
95
+ - "pet"
96
+ summary: "Finds Pets by status"
97
+ description: "Multiple status values can be provided with comma separated strings"
98
+ operationId: "findPetsByStatus"
99
+ produces:
100
+ - "application/xml"
101
+ - "application/json"
102
+ parameters:
103
+ - name: "status"
104
+ in: "query"
105
+ description: "Status values that need to be considered for filter"
106
+ required: true
107
+ type: "array"
108
+ items:
109
+ type: "string"
110
+ enum:
111
+ - "available"
112
+ - "pending"
113
+ - "sold"
114
+ default: "available"
115
+ collectionFormat: "multi"
116
+ responses:
117
+ 200:
118
+ description: "successful operation"
119
+ schema:
120
+ type: "array"
121
+ items:
122
+ $ref: "models.yaml#/Pet"
123
+ 400:
124
+ description: "Invalid status value"
125
+ security:
126
+ - petstore_auth:
127
+ - "write:pets"
128
+ - "read:pets"
129
+ /pet/findByTags:
130
+ get:
131
+ tags:
132
+ - "pet"
133
+ summary: "Finds Pets by tags"
134
+ description: "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."
135
+ operationId: "findPetsByTags"
136
+ produces:
137
+ - "application/xml"
138
+ - "application/json"
139
+ parameters:
140
+ - name: "tags"
141
+ in: "query"
142
+ description: "Tags to filter by"
143
+ required: true
144
+ type: "array"
145
+ items:
146
+ type: "string"
147
+ collectionFormat: "multi"
148
+ responses:
149
+ 200:
150
+ description: "successful operation"
151
+ schema:
152
+ type: "array"
153
+ items:
154
+ $ref: "models.yaml#/Pet"
155
+ 400:
156
+ description: "Invalid tag value"
157
+ security:
158
+ - petstore_auth:
159
+ - "write:pets"
160
+ - "read:pets"
161
+ deprecated: true
162
+ /pet/{petId}:
163
+ parameters:
164
+ - name: petId
165
+ in: path
166
+ description: ID of pet
167
+ required: true
168
+ type: integer
169
+ format: int64
170
+ get:
171
+ tags:
172
+ - "pet"
173
+ summary: "Find pet by ID"
174
+ description: "Returns a single pet"
175
+ operationId: "getPetById"
176
+ produces:
177
+ - "application/xml"
178
+ - "application/json"
179
+ responses:
180
+ 200:
181
+ description: "successful operation"
182
+ schema:
183
+ $ref: "models.yaml#/Pet"
184
+ 400:
185
+ description: "Invalid ID supplied"
186
+ 404:
187
+ description: "Pet not found"
188
+ security:
189
+ - api_key: []
190
+ post:
191
+ tags:
192
+ - "pet"
193
+ summary: "Updates a pet in the store with form data"
194
+ description: ""
195
+ operationId: "updatePetWithForm"
196
+ consumes:
197
+ - "application/x-www-form-urlencoded"
198
+ parameters:
199
+ - name: "name"
200
+ in: "formData"
201
+ description: "Updated name of the pet"
202
+ required: false
203
+ type: "string"
204
+ - name: "status"
205
+ in: "formData"
206
+ description: "Updated status of the pet"
207
+ required: false
208
+ type: "string"
209
+ responses:
210
+ 405:
211
+ description: "Invalid input"
212
+ security:
213
+ - petstore_auth:
214
+ - "write:pets"
215
+ - "read:pets"
216
+ delete:
217
+ tags:
218
+ - "pet"
219
+ summary: "Deletes a pet"
220
+ description: ""
221
+ operationId: "deletePet"
222
+ produces:
223
+ - "application/xml"
224
+ - "application/json"
225
+ parameters:
226
+ - name: "api_key"
227
+ in: "header"
228
+ required: false
229
+ type: "string"
230
+ responses:
231
+ 400:
232
+ description: "Invalid ID supplied"
233
+ 404:
234
+ description: "Pet not found"
235
+ security:
236
+ - petstore_auth:
237
+ - "write:pets"
238
+ - "read:pets"
239
+ /pet/{petId}/uploadImage:
240
+ parameters:
241
+ - name: petId
242
+ in: path
243
+ description: ID of pet
244
+ required: true
245
+ type: integer
246
+ format: int64
247
+ post:
248
+ tags:
249
+ - "pet"
250
+ summary: "uploads an image"
251
+ description: ""
252
+ operationId: "uploadFile"
253
+ consumes:
254
+ - "multipart/form-data"
255
+ produces:
256
+ - "application/json"
257
+ parameters:
258
+ - name: "additionalMetadata"
259
+ in: "formData"
260
+ description: "Additional data to pass to server"
261
+ required: false
262
+ type: "string"
263
+ - name: "file"
264
+ in: "formData"
265
+ description: "file to upload"
266
+ required: false
267
+ type: "file"
268
+ responses:
269
+ 200:
270
+ description: "successful operation"
271
+ schema:
272
+ $ref: "#/definitions/ApiResponse"
273
+ security:
274
+ - petstore_auth:
275
+ - "write:pets"
276
+ - "read:pets"
277
+ /store/inventory:
278
+ get:
279
+ tags:
280
+ - "store"
281
+ summary: "Returns pet inventories by status"
282
+ description: "Returns a map of status codes to quantities"
283
+ operationId: "getInventory"
284
+ produces:
285
+ - "application/json"
286
+ parameters: []
287
+ responses:
288
+ 200:
289
+ description: "successful operation"
290
+ schema:
291
+ type: "object"
292
+ additionalProperties:
293
+ type: "integer"
294
+ format: "int32"
295
+ security:
296
+ - api_key: []
297
+ /store/order:
298
+ post:
299
+ tags:
300
+ - "store"
301
+ summary: "Place an order for a pet"
302
+ description: ""
303
+ operationId: "placeOrder"
304
+ produces:
305
+ - "application/xml"
306
+ - "application/json"
307
+ parameters:
308
+ - in: "body"
309
+ name: "body"
310
+ description: "order placed for purchasing the pet"
311
+ required: true
312
+ schema:
313
+ $ref: "models.yaml#/Order"
314
+ responses:
315
+ 200:
316
+ description: "successful operation"
317
+ schema:
318
+ $ref: "models.yaml#/Order"
319
+ 400:
320
+ description: "Invalid Order"
321
+ /store/order/{orderId}:
322
+ parameters:
323
+ - name: "orderId"
324
+ in: "path"
325
+ description: ID of purchase order
326
+ required: true
327
+ type: "integer"
328
+ maximum: 10.0
329
+ minimum: 1.0
330
+ format: "int64"
331
+ get:
332
+ tags:
333
+ - "store"
334
+ summary: "Find purchase order by ID"
335
+ description: "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions"
336
+ operationId: "getOrderById"
337
+ produces:
338
+ - "application/xml"
339
+ - "application/json"
340
+ responses:
341
+ 200:
342
+ description: "successful operation"
343
+ schema:
344
+ $ref: "models.yaml#/Order"
345
+ 400:
346
+ description: "Invalid ID supplied"
347
+ 404:
348
+ description: "Order not found"
349
+ delete:
350
+ tags:
351
+ - "store"
352
+ summary: "Delete purchase order by ID"
353
+ description: "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors"
354
+ operationId: "deleteOrder"
355
+ produces:
356
+ - "application/xml"
357
+ - "application/json"
358
+ responses:
359
+ 400:
360
+ description: "Invalid ID supplied"
361
+ 404:
362
+ description: "Order not found"
363
+ /user:
364
+ post:
365
+ tags:
366
+ - "user"
367
+ summary: "Create user"
368
+ description: "This can only be done by the logged in user."
369
+ operationId: "createUser"
370
+ produces:
371
+ - "application/xml"
372
+ - "application/json"
373
+ parameters:
374
+ - in: "body"
375
+ name: "body"
376
+ description: "Created user object"
377
+ required: true
378
+ schema:
379
+ $ref: "models.yaml#/User"
380
+ responses:
381
+ default:
382
+ description: "successful operation"
383
+ /user/createWithArray:
384
+ post:
385
+ tags:
386
+ - "user"
387
+ summary: "Creates list of users with given input array"
388
+ description: ""
389
+ operationId: "createUsersWithArrayInput"
390
+ produces:
391
+ - "application/xml"
392
+ - "application/json"
393
+ parameters:
394
+ - in: "body"
395
+ name: "body"
396
+ description: "List of user object"
397
+ required: true
398
+ schema:
399
+ type: "array"
400
+ items:
401
+ $ref: "models.yaml#/User"
402
+ responses:
403
+ default:
404
+ description: "successful operation"
405
+ /user/createWithList:
406
+ post:
407
+ tags:
408
+ - "user"
409
+ summary: "Creates list of users with given input array"
410
+ description: ""
411
+ operationId: "createUsersWithListInput"
412
+ produces:
413
+ - "application/xml"
414
+ - "application/json"
415
+ parameters:
416
+ - in: "body"
417
+ name: "body"
418
+ description: "List of user object"
419
+ required: true
420
+ schema:
421
+ type: "array"
422
+ items:
423
+ $ref: "models.yaml#/User"
424
+ responses:
425
+ default:
426
+ description: "successful operation"
427
+ /user/login:
428
+ get:
429
+ tags:
430
+ - "user"
431
+ summary: "Logs user into the system"
432
+ description: ""
433
+ operationId: "loginUser"
434
+ produces:
435
+ - "application/xml"
436
+ - "application/json"
437
+ parameters:
438
+ - name: "username"
439
+ in: "query"
440
+ description: "The user name for login"
441
+ required: true
442
+ type: "string"
443
+ - name: "password"
444
+ in: "query"
445
+ description: "The password for login in clear text"
446
+ required: true
447
+ type: "string"
448
+ responses:
449
+ 200:
450
+ description: "successful operation"
451
+ schema:
452
+ type: "string"
453
+ headers:
454
+ X-Rate-Limit:
455
+ type: "integer"
456
+ format: "int32"
457
+ description: "calls per hour allowed by the user"
458
+ X-Expires-After:
459
+ type: "string"
460
+ format: "date-time"
461
+ description: "date in UTC when token expires"
462
+ 400:
463
+ description: "Invalid username/password supplied"
464
+ /user/logout:
465
+ get:
466
+ tags:
467
+ - "user"
468
+ summary: "Logs out current logged in user session"
469
+ description: ""
470
+ operationId: "logoutUser"
471
+ produces:
472
+ - "application/xml"
473
+ - "application/json"
474
+ parameters: []
475
+ responses:
476
+ default:
477
+ description: "successful operation"
478
+ /user/{username}:
479
+ parameters:
480
+ - name: username
481
+ in: path
482
+ description: 'The name of the user. Use user1 for testing. '
483
+ required: true
484
+ type: string
485
+ get:
486
+ tags:
487
+ - "user"
488
+ summary: "Get user by user name"
489
+ description: ""
490
+ operationId: "getUserByName"
491
+ produces:
492
+ - "application/xml"
493
+ - "application/json"
494
+ responses:
495
+ 200:
496
+ description: "successful operation"
497
+ schema:
498
+ $ref: "models.yaml#/User"
499
+ 400:
500
+ description: "Invalid username supplied"
501
+ 404:
502
+ description: "User not found"
503
+ put:
504
+ tags:
505
+ - "user"
506
+ summary: "Updated user"
507
+ description: "This can only be done by the logged in user."
508
+ operationId: "updateUser"
509
+ produces:
510
+ - "application/xml"
511
+ - "application/json"
512
+ parameters:
513
+ - in: "body"
514
+ name: "body"
515
+ description: "Updated user object"
516
+ required: true
517
+ schema:
518
+ $ref: "models.yaml#/User"
519
+ responses:
520
+ 400:
521
+ description: "Invalid user supplied"
522
+ 404:
523
+ description: "User not found"
524
+ delete:
525
+ tags:
526
+ - "user"
527
+ summary: "Delete user"
528
+ description: "This can only be done by the logged in user."
529
+ operationId: "deleteUser"
530
+ parameters:
531
+ - name: username
532
+ in: path
533
+ description: 'The name of the user to be deleted. '
534
+ required: true
535
+ type: string
536
+ produces:
537
+ - "application/xml"
538
+ - "application/json"
539
+ responses:
540
+ 400:
541
+ description: "Invalid username supplied"
542
+ 404:
543
+ description: "User not found"
544
+ securityDefinitions:
545
+ petstore_auth:
546
+ type: "oauth2"
547
+ authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
548
+ flow: "implicit"
549
+ scopes:
550
+ write:pets: "modify pets in your account"
551
+ read:pets: "read your pets"
552
+ api_key:
553
+ type: "apiKey"
554
+ name: "api_key"
555
+ in: "header"
556
+ definitions:
557
+ ApiResponse:
558
+ type: "object"
559
+ properties:
560
+ code:
561
+ type: "integer"
562
+ format: "int32"
563
+ type:
564
+ type: "string"
565
+ message:
566
+ type: "string"
567
+ externalDocs:
568
+ description: "Find out more about Swagger"
569
+ url: "http://swagger.io"