scorpio 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,14 +118,6 @@ module Scorpio
118
118
  end
119
119
  update_dynamic_methods
120
120
 
121
- openapi_document.paths.each do |path, path_item|
122
- path_item.each do |http_method, operation|
123
- unless operation.is_a?(Scorpio::OpenAPI::Operation)
124
- next
125
- end
126
- end
127
- end
128
-
129
121
  # TODO blame validate openapi_document
130
122
 
131
123
  update_dynamic_methods
@@ -202,7 +194,7 @@ module Scorpio
202
194
  request_attributes = []
203
195
  # if the path has attributes in common with model schema attributes, we'll define on
204
196
  # instance method
205
- request_attributes |= Addressable::Template.new(operation.path).variables
197
+ request_attributes |= operation.path_template.variables
206
198
  # TODO if the method request schema has attributes in common with the model schema attributes,
207
199
  # should we define an instance method?
208
200
  #request_attributes |= request_schema && request_schema['type'] == 'object' && request_schema['properties'] ?
@@ -221,8 +213,19 @@ module Scorpio
221
213
  h[operation] = begin
222
214
  raise(ArgumentError, operation.pretty_inspect) unless operation.is_a?(Scorpio::OpenAPI::Operation)
223
215
 
224
- if operation.tags.respond_to?(:to_ary) && operation.tags.include?(tag_name) && operation.operationId =~ /\A#{Regexp.escape(tag_name)}\.(\w+)\z/
225
- method_name = $1
216
+ # if Pet is the Scorpio resource class
217
+ # and Pet.tag_name is "pet"
218
+ # and operation's operationId is "pet.add"
219
+ # then the operation's method name on Pet will be "add".
220
+ # if the operationId is just "addPet"
221
+ # then the operation's method name on Pet will be "addPet".
222
+ tag_name_match = tag_name &&
223
+ operation.tags.respond_to?(:to_ary) && # TODO maybe operation.tags.valid?
224
+ operation.tags.include?(tag_name) &&
225
+ operation.operationId.match(/\A#{Regexp.escape(tag_name)}\.(\w+)\z/)
226
+
227
+ if tag_name_match
228
+ method_name = tag_name_match[1]
226
229
  else
227
230
  method_name = operation.operationId
228
231
  end
@@ -233,7 +236,7 @@ module Scorpio
233
236
  def update_class_and_instance_api_methods
234
237
  openapi_document.paths.each do |path, path_item|
235
238
  path_item.each do |http_method, operation|
236
- next if http_method == 'parameters' # parameters is not an operation. TOOD maybe just select the keys that are http methods?
239
+ next unless operation.is_a?(Scorpio::OpenAPI::Operation)
237
240
  method_name = method_names_by_operation[operation]
238
241
  if method_name
239
242
  # class method
@@ -1,9 +1,13 @@
1
1
  module Scorpio
2
2
  class Response < ::Ur::Response
3
+ # @return [::JSI::Schema] the schema for this response according to its OpenAPI doc
3
4
  def response_schema
4
5
  ur.scorpio_request.operation.response_schema(status: status, media_type: media_type)
5
6
  end
6
7
 
8
+ # @return [Object] the body (String) is parsed according to the response media type and
9
+ # if supported (only application/json is currently supported) instantiated according to
10
+ # #response_schema
7
11
  def body_object
8
12
  # TODO handle media types like `application/schema-instance+json` or vendor things like github's
9
13
  if media_type == 'application/json'
@@ -2,6 +2,14 @@ module Scorpio
2
2
  class Ur < ::Ur
3
3
  attr_accessor :scorpio_request
4
4
 
5
+ # raises a subclass of Scorpio::HTTPError if the response has an error status.
6
+ # raises nothing if the status is 2xx.
7
+ # raises ClientError or one of its response-specific subclasses if the status is 4xx.
8
+ # raises ServerError or one of its response-specific subclasses if the status is 5xx.
9
+ # raises a generic HTTPError otherwise.
10
+ #
11
+ # @raise [Scorpio::HTTPError]
12
+ # @return [void]
5
13
  def raise_on_http_error
6
14
  error_class = Scorpio.error_classes_by_status[response.status]
7
15
  error_class ||= if (400..499).include?(response.status)
@@ -22,6 +30,10 @@ module Scorpio
22
30
  end
23
31
 
24
32
  private
33
+ # overrides JSI::Base#class_for_schema to use Scorpio::Response instead of ::Ur::Response.
34
+ # maybe a Scorpio::Ur::Request in the future if I need to extend that ... or Scorpio::Request
35
+ # if I decide to make that subclass ::Ur::Request. not sure if that's a good idea or a terrible
36
+ # idea.
25
37
  def class_for_schema(schema)
26
38
  jsi_class_for_schema = super
27
39
  if jsi_class_for_schema == ::Ur::Response
@@ -1,3 +1,3 @@
1
1
  module Scorpio
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "sqlite3", "~> 1.3.6" # loosen this in accordance with active_record/connection_adapters/sqlite3_adapter.rb
37
37
  spec.add_development_dependency "database_cleaner"
38
38
  spec.add_development_dependency "simplecov"
39
+ spec.add_development_dependency "yard"
39
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorpio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsi
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: yard
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  description: ORM style REST client
238
252
  email:
239
253
  - ethan@unth
@@ -242,13 +256,13 @@ extensions: []
242
256
  extra_rdoc_files: []
243
257
  files:
244
258
  - ".simplecov"
259
+ - ".yardopts"
245
260
  - CHANGELOG.md
246
261
  - LICENSE.txt
247
262
  - README.md
248
263
  - Rakefile
249
264
  - bin/documents_to_yml.rb
250
- - documents/openapis.org/v3/schema.json
251
- - documents/openapis.org/v3/schema.yml
265
+ - documents/github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0/schema.yaml
252
266
  - documents/swagger.io/v2/schema.json
253
267
  - documents/swagger.io/v2/schema.yml
254
268
  - documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest
@@ -1,1239 +0,0 @@
1
- {
2
- "title": "A JSON Schema for OpenAPI 3.0.",
3
- "id": "http://openapis.org/v3/schema.json#",
4
- "$schema": "http://json-schema.org/draft-04/schema#",
5
- "type": "object",
6
- "description": "This is the root document object of the OpenAPI document.",
7
- "required": [
8
- "openapi",
9
- "info",
10
- "paths"
11
- ],
12
- "additionalProperties": false,
13
- "patternProperties": {
14
- "^x-": {
15
- "$ref": "#/definitions/specificationExtension"
16
- }
17
- },
18
- "properties": {
19
- "openapi": {
20
- "type": "string"
21
- },
22
- "info": {
23
- "$ref": "#/definitions/info"
24
- },
25
- "servers": {
26
- "type": "array",
27
- "items": {
28
- "$ref": "#/definitions/server"
29
- },
30
- "uniqueItems": true
31
- },
32
- "paths": {
33
- "$ref": "#/definitions/paths"
34
- },
35
- "components": {
36
- "$ref": "#/definitions/components"
37
- },
38
- "security": {
39
- "type": "array",
40
- "items": {
41
- "$ref": "#/definitions/securityRequirement"
42
- },
43
- "uniqueItems": true
44
- },
45
- "tags": {
46
- "type": "array",
47
- "items": {
48
- "$ref": "#/definitions/tag"
49
- },
50
- "uniqueItems": true
51
- },
52
- "externalDocs": {
53
- "$ref": "#/definitions/externalDocs"
54
- }
55
- },
56
- "definitions": {
57
- "info": {
58
- "type": "object",
59
- "description": "The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.",
60
- "required": [
61
- "title",
62
- "version"
63
- ],
64
- "additionalProperties": false,
65
- "patternProperties": {
66
- "^x-": {
67
- "$ref": "#/definitions/specificationExtension"
68
- }
69
- },
70
- "properties": {
71
- "title": {
72
- "type": "string"
73
- },
74
- "description": {
75
- "type": "string"
76
- },
77
- "termsOfService": {
78
- "type": "string"
79
- },
80
- "contact": {
81
- "$ref": "#/definitions/contact"
82
- },
83
- "license": {
84
- "$ref": "#/definitions/license"
85
- },
86
- "version": {
87
- "type": "string"
88
- }
89
- }
90
- },
91
- "contact": {
92
- "type": "object",
93
- "description": "Contact information for the exposed API.",
94
- "additionalProperties": false,
95
- "patternProperties": {
96
- "^x-": {
97
- "$ref": "#/definitions/specificationExtension"
98
- }
99
- },
100
- "properties": {
101
- "name": {
102
- "type": "string"
103
- },
104
- "url": {
105
- "type": "string",
106
- "format": "uri"
107
- },
108
- "email": {
109
- "type": "string",
110
- "format": "email"
111
- }
112
- }
113
- },
114
- "license": {
115
- "type": "object",
116
- "description": "License information for the exposed API.",
117
- "required": [
118
- "name"
119
- ],
120
- "additionalProperties": false,
121
- "patternProperties": {
122
- "^x-": {
123
- "$ref": "#/definitions/specificationExtension"
124
- }
125
- },
126
- "properties": {
127
- "name": {
128
- "type": "string"
129
- },
130
- "url": {
131
- "type": "string"
132
- }
133
- }
134
- },
135
- "server": {
136
- "type": "object",
137
- "description": "An object representing a Server.",
138
- "required": [
139
- "url"
140
- ],
141
- "additionalProperties": false,
142
- "patternProperties": {
143
- "^x-": {
144
- "$ref": "#/definitions/specificationExtension"
145
- }
146
- },
147
- "properties": {
148
- "url": {
149
- "type": "string"
150
- },
151
- "description": {
152
- "type": "string"
153
- },
154
- "variables": {
155
- "$ref": "#/definitions/serverVariables"
156
- }
157
- }
158
- },
159
- "serverVariable": {
160
- "type": "object",
161
- "description": "An object representing a Server Variable for server URL template substitution.",
162
- "required": [
163
- "default"
164
- ],
165
- "additionalProperties": false,
166
- "patternProperties": {
167
- "^x-": {
168
- "$ref": "#/definitions/specificationExtension"
169
- }
170
- },
171
- "properties": {
172
- "enum": {
173
- "type": "array",
174
- "items": {
175
- "type": "string"
176
- },
177
- "uniqueItems": true
178
- },
179
- "default": {
180
- "type": "string"
181
- },
182
- "description": {
183
- "type": "string"
184
- }
185
- }
186
- },
187
- "components": {
188
- "type": "object",
189
- "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.",
190
- "additionalProperties": false,
191
- "patternProperties": {
192
- "^x-": {
193
- "$ref": "#/definitions/specificationExtension"
194
- }
195
- },
196
- "properties": {
197
- "schemas": {
198
- "$ref": "#/definitions/schemasOrReferences"
199
- },
200
- "responses": {
201
- "$ref": "#/definitions/responsesOrReferences"
202
- },
203
- "parameters": {
204
- "$ref": "#/definitions/parametersOrReferences"
205
- },
206
- "examples": {
207
- "$ref": "#/definitions/examplesOrReferences"
208
- },
209
- "requestBodies": {
210
- "$ref": "#/definitions/requestBodiesOrReferences"
211
- },
212
- "headers": {
213
- "$ref": "#/definitions/headersOrReferences"
214
- },
215
- "securitySchemes": {
216
- "$ref": "#/definitions/securitySchemesOrReferences"
217
- },
218
- "links": {
219
- "$ref": "#/definitions/linksOrReferences"
220
- },
221
- "callbacks": {
222
- "$ref": "#/definitions/callbacksOrReferences"
223
- }
224
- }
225
- },
226
- "paths": {
227
- "type": "object",
228
- "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.",
229
- "additionalProperties": false,
230
- "patternProperties": {
231
- "^/": {
232
- "$ref": "#/definitions/pathItem"
233
- },
234
- "^x-": {
235
- "$ref": "#/definitions/specificationExtension"
236
- }
237
- }
238
- },
239
- "pathItem": {
240
- "type": "object",
241
- "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.",
242
- "additionalProperties": false,
243
- "patternProperties": {
244
- "^x-": {
245
- "$ref": "#/definitions/specificationExtension"
246
- }
247
- },
248
- "properties": {
249
- "$ref": {
250
- "type": "string"
251
- },
252
- "summary": {
253
- "type": "string"
254
- },
255
- "description": {
256
- "type": "string"
257
- },
258
- "get": {
259
- "$ref": "#/definitions/operation"
260
- },
261
- "put": {
262
- "$ref": "#/definitions/operation"
263
- },
264
- "post": {
265
- "$ref": "#/definitions/operation"
266
- },
267
- "delete": {
268
- "$ref": "#/definitions/operation"
269
- },
270
- "options": {
271
- "$ref": "#/definitions/operation"
272
- },
273
- "head": {
274
- "$ref": "#/definitions/operation"
275
- },
276
- "patch": {
277
- "$ref": "#/definitions/operation"
278
- },
279
- "trace": {
280
- "$ref": "#/definitions/operation"
281
- },
282
- "servers": {
283
- "type": "array",
284
- "items": {
285
- "$ref": "#/definitions/server"
286
- },
287
- "uniqueItems": true
288
- },
289
- "parameters": {
290
- "type": "array",
291
- "items": {
292
- "$ref": "#/definitions/parameterOrReference"
293
- },
294
- "uniqueItems": true
295
- }
296
- }
297
- },
298
- "operation": {
299
- "type": "object",
300
- "description": "Describes a single API operation on a path.",
301
- "required": [
302
- "responses"
303
- ],
304
- "additionalProperties": false,
305
- "patternProperties": {
306
- "^x-": {
307
- "$ref": "#/definitions/specificationExtension"
308
- }
309
- },
310
- "properties": {
311
- "tags": {
312
- "type": "array",
313
- "items": {
314
- "type": "string"
315
- },
316
- "uniqueItems": true
317
- },
318
- "summary": {
319
- "type": "string"
320
- },
321
- "description": {
322
- "type": "string"
323
- },
324
- "externalDocs": {
325
- "$ref": "#/definitions/externalDocs"
326
- },
327
- "operationId": {
328
- "type": "string"
329
- },
330
- "parameters": {
331
- "type": "array",
332
- "items": {
333
- "$ref": "#/definitions/parameterOrReference"
334
- },
335
- "uniqueItems": true
336
- },
337
- "requestBody": {
338
- "$ref": "#/definitions/requestBodyOrReference"
339
- },
340
- "responses": {
341
- "$ref": "#/definitions/responses"
342
- },
343
- "callbacks": {
344
- "$ref": "#/definitions/callbacksOrReferences"
345
- },
346
- "deprecated": {
347
- "type": "boolean"
348
- },
349
- "security": {
350
- "type": "array",
351
- "items": {
352
- "$ref": "#/definitions/securityRequirement"
353
- },
354
- "uniqueItems": true
355
- },
356
- "servers": {
357
- "type": "array",
358
- "items": {
359
- "$ref": "#/definitions/server"
360
- },
361
- "uniqueItems": true
362
- }
363
- }
364
- },
365
- "externalDocs": {
366
- "type": "object",
367
- "description": "Allows referencing an external resource for extended documentation.",
368
- "required": [
369
- "url"
370
- ],
371
- "additionalProperties": false,
372
- "patternProperties": {
373
- "^x-": {
374
- "$ref": "#/definitions/specificationExtension"
375
- }
376
- },
377
- "properties": {
378
- "description": {
379
- "type": "string"
380
- },
381
- "url": {
382
- "type": "string"
383
- }
384
- }
385
- },
386
- "parameter": {
387
- "type": "object",
388
- "description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.",
389
- "required": [
390
- "name",
391
- "in"
392
- ],
393
- "additionalProperties": false,
394
- "patternProperties": {
395
- "^x-": {
396
- "$ref": "#/definitions/specificationExtension"
397
- }
398
- },
399
- "properties": {
400
- "name": {
401
- "type": "string"
402
- },
403
- "in": {
404
- "type": "string"
405
- },
406
- "description": {
407
- "type": "string"
408
- },
409
- "required": {
410
- "type": "boolean"
411
- },
412
- "deprecated": {
413
- "type": "boolean"
414
- },
415
- "allowEmptyValue": {
416
- "type": "boolean"
417
- },
418
- "style": {
419
- "type": "string"
420
- },
421
- "explode": {
422
- "type": "boolean"
423
- },
424
- "allowReserved": {
425
- "type": "boolean"
426
- },
427
- "schema": {
428
- "$ref": "#/definitions/schemaOrReference"
429
- },
430
- "example": {
431
- "$ref": "#/definitions/any"
432
- },
433
- "examples": {
434
- "$ref": "#/definitions/examplesOrReferences"
435
- },
436
- "content": {
437
- "$ref": "#/definitions/mediaTypes"
438
- }
439
- }
440
- },
441
- "requestBody": {
442
- "type": "object",
443
- "description": "Describes a single request body.",
444
- "required": [
445
- "content"
446
- ],
447
- "additionalProperties": false,
448
- "patternProperties": {
449
- "^x-": {
450
- "$ref": "#/definitions/specificationExtension"
451
- }
452
- },
453
- "properties": {
454
- "description": {
455
- "type": "string"
456
- },
457
- "content": {
458
- "$ref": "#/definitions/mediaTypes"
459
- },
460
- "required": {
461
- "type": "boolean"
462
- }
463
- }
464
- },
465
- "mediaType": {
466
- "type": "object",
467
- "description": "Each Media Type Object provides schema and examples for the media type identified by its key.",
468
- "additionalProperties": false,
469
- "patternProperties": {
470
- "^x-": {
471
- "$ref": "#/definitions/specificationExtension"
472
- }
473
- },
474
- "properties": {
475
- "schema": {
476
- "$ref": "#/definitions/schemaOrReference"
477
- },
478
- "example": {
479
- "$ref": "#/definitions/any"
480
- },
481
- "examples": {
482
- "$ref": "#/definitions/examplesOrReferences"
483
- },
484
- "encoding": {
485
- "$ref": "#/definitions/encodings"
486
- }
487
- }
488
- },
489
- "encoding": {
490
- "type": "object",
491
- "description": "A single encoding definition applied to a single schema property.",
492
- "additionalProperties": false,
493
- "patternProperties": {
494
- "^x-": {
495
- "$ref": "#/definitions/specificationExtension"
496
- }
497
- },
498
- "properties": {
499
- "contentType": {
500
- "type": "string"
501
- },
502
- "headers": {
503
- "$ref": "#/definitions/headersOrReferences"
504
- },
505
- "style": {
506
- "type": "string"
507
- },
508
- "explode": {
509
- "type": "boolean"
510
- },
511
- "allowReserved": {
512
- "type": "boolean"
513
- }
514
- }
515
- },
516
- "responses": {
517
- "type": "object",
518
- "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.",
519
- "additionalProperties": false,
520
- "patternProperties": {
521
- "^([0-9X]{3})$": {
522
- "$ref": "#/definitions/responseOrReference"
523
- },
524
- "^x-": {
525
- "$ref": "#/definitions/specificationExtension"
526
- }
527
- },
528
- "properties": {
529
- "default": {
530
- "$ref": "#/definitions/responseOrReference"
531
- }
532
- }
533
- },
534
- "response": {
535
- "type": "object",
536
- "description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.",
537
- "required": [
538
- "description"
539
- ],
540
- "additionalProperties": false,
541
- "patternProperties": {
542
- "^x-": {
543
- "$ref": "#/definitions/specificationExtension"
544
- }
545
- },
546
- "properties": {
547
- "description": {
548
- "type": "string"
549
- },
550
- "headers": {
551
- "$ref": "#/definitions/headersOrReferences"
552
- },
553
- "content": {
554
- "$ref": "#/definitions/mediaTypes"
555
- },
556
- "links": {
557
- "$ref": "#/definitions/linksOrReferences"
558
- }
559
- }
560
- },
561
- "callback": {
562
- "type": "object",
563
- "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.",
564
- "additionalProperties": false,
565
- "patternProperties": {
566
- "^": {
567
- "$ref": "#/definitions/pathItem"
568
- },
569
- "^x-": {
570
- "$ref": "#/definitions/specificationExtension"
571
- }
572
- }
573
- },
574
- "example": {
575
- "type": "object",
576
- "description": "",
577
- "additionalProperties": false,
578
- "patternProperties": {
579
- "^x-": {
580
- "$ref": "#/definitions/specificationExtension"
581
- }
582
- },
583
- "properties": {
584
- "summary": {
585
- "type": "string"
586
- },
587
- "description": {
588
- "type": "string"
589
- },
590
- "value": {
591
- "$ref": "#/definitions/any"
592
- },
593
- "externalValue": {
594
- "type": "string"
595
- }
596
- }
597
- },
598
- "link": {
599
- "type": "object",
600
- "description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.",
601
- "additionalProperties": false,
602
- "patternProperties": {
603
- "^x-": {
604
- "$ref": "#/definitions/specificationExtension"
605
- }
606
- },
607
- "properties": {
608
- "operationRef": {
609
- "type": "string"
610
- },
611
- "operationId": {
612
- "type": "string"
613
- },
614
- "parameters": {
615
- "$ref": "#/definitions/anysOrExpressions"
616
- },
617
- "requestBody": {
618
- "$ref": "#/definitions/anyOrExpression"
619
- },
620
- "description": {
621
- "type": "string"
622
- },
623
- "server": {
624
- "$ref": "#/definitions/server"
625
- }
626
- }
627
- },
628
- "header": {
629
- "type": "object",
630
- "description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).",
631
- "additionalProperties": false,
632
- "patternProperties": {
633
- "^x-": {
634
- "$ref": "#/definitions/specificationExtension"
635
- }
636
- },
637
- "properties": {
638
- "description": {
639
- "type": "string"
640
- },
641
- "required": {
642
- "type": "boolean"
643
- },
644
- "deprecated": {
645
- "type": "boolean"
646
- },
647
- "allowEmptyValue": {
648
- "type": "boolean"
649
- },
650
- "style": {
651
- "type": "string"
652
- },
653
- "explode": {
654
- "type": "boolean"
655
- },
656
- "allowReserved": {
657
- "type": "boolean"
658
- },
659
- "schema": {
660
- "$ref": "#/definitions/schemaOrReference"
661
- },
662
- "example": {
663
- "$ref": "#/definitions/any"
664
- },
665
- "examples": {
666
- "$ref": "#/definitions/examplesOrReferences"
667
- },
668
- "content": {
669
- "$ref": "#/definitions/mediaTypes"
670
- }
671
- }
672
- },
673
- "tag": {
674
- "type": "object",
675
- "description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.",
676
- "required": [
677
- "name"
678
- ],
679
- "additionalProperties": false,
680
- "patternProperties": {
681
- "^x-": {
682
- "$ref": "#/definitions/specificationExtension"
683
- }
684
- },
685
- "properties": {
686
- "name": {
687
- "type": "string"
688
- },
689
- "description": {
690
- "type": "string"
691
- },
692
- "externalDocs": {
693
- "$ref": "#/definitions/externalDocs"
694
- }
695
- }
696
- },
697
- "examples": {
698
- "type": "object",
699
- "description": "",
700
- "additionalProperties": false
701
- },
702
- "reference": {
703
- "type": "object",
704
- "description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.",
705
- "required": [
706
- "$ref"
707
- ],
708
- "additionalProperties": false,
709
- "properties": {
710
- "$ref": {
711
- "type": "string"
712
- }
713
- }
714
- },
715
- "schema": {
716
- "type": "object",
717
- "description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.",
718
- "additionalProperties": false,
719
- "patternProperties": {
720
- "^x-": {
721
- "$ref": "#/definitions/specificationExtension"
722
- }
723
- },
724
- "properties": {
725
- "nullable": {
726
- "type": "boolean"
727
- },
728
- "discriminator": {
729
- "$ref": "#/definitions/discriminator"
730
- },
731
- "readOnly": {
732
- "type": "boolean"
733
- },
734
- "writeOnly": {
735
- "type": "boolean"
736
- },
737
- "xml": {
738
- "$ref": "#/definitions/xml"
739
- },
740
- "externalDocs": {
741
- "$ref": "#/definitions/externalDocs"
742
- },
743
- "example": {
744
- "$ref": "#/definitions/any"
745
- },
746
- "deprecated": {
747
- "type": "boolean"
748
- },
749
- "title": {
750
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
751
- },
752
- "multipleOf": {
753
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
754
- },
755
- "maximum": {
756
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
757
- },
758
- "exclusiveMaximum": {
759
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
760
- },
761
- "minimum": {
762
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
763
- },
764
- "exclusiveMinimum": {
765
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
766
- },
767
- "maxLength": {
768
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength"
769
- },
770
- "minLength": {
771
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minLength"
772
- },
773
- "pattern": {
774
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
775
- },
776
- "maxItems": {
777
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems"
778
- },
779
- "minItems": {
780
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minItems"
781
- },
782
- "uniqueItems": {
783
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
784
- },
785
- "maxProperties": {
786
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties"
787
- },
788
- "minProperties": {
789
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties"
790
- },
791
- "required": {
792
- "$ref": "http://json-schema.org/draft-04/schema#/properties/required"
793
- },
794
- "enum": {
795
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
796
- },
797
- "type": {
798
- "type": "string"
799
- },
800
- "allOf": {
801
- "type": "array",
802
- "items": {
803
- "$ref": "#/definitions/schemaOrReference"
804
- },
805
- "minItems": 1
806
- },
807
- "oneOf": {
808
- "type": "array",
809
- "items": {
810
- "$ref": "#/definitions/schemaOrReference"
811
- },
812
- "minItems": 1
813
- },
814
- "anyOf": {
815
- "type": "array",
816
- "items": {
817
- "$ref": "#/definitions/schemaOrReference"
818
- },
819
- "minItems": 1
820
- },
821
- "not": {
822
- "$ref": "#/definitions/schema"
823
- },
824
- "items": {
825
- "$ref": "#/definitions/schemaOrReference"
826
- },
827
- "properties": {
828
- "type": "object",
829
- "additionalProperties": {
830
- "$ref": "#/definitions/schemaOrReference"
831
- }
832
- },
833
- "additionalProperties": {
834
- "oneOf": [
835
- {
836
- "$ref": "#/definitions/schemaOrReference"
837
- },
838
- {
839
- "type": "boolean"
840
- }
841
- ]
842
- },
843
- "default": {
844
- "$ref": "#/definitions/defaultType"
845
- },
846
- "description": {
847
- "type": "string"
848
- },
849
- "format": {
850
- "type": "string"
851
- }
852
- }
853
- },
854
- "discriminator": {
855
- "type": "object",
856
- "description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.",
857
- "required": [
858
- "propertyName"
859
- ],
860
- "additionalProperties": false,
861
- "properties": {
862
- "propertyName": {
863
- "type": "string"
864
- },
865
- "mapping": {
866
- "$ref": "#/definitions/strings"
867
- }
868
- }
869
- },
870
- "xml": {
871
- "type": "object",
872
- "description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.",
873
- "additionalProperties": false,
874
- "patternProperties": {
875
- "^x-": {
876
- "$ref": "#/definitions/specificationExtension"
877
- }
878
- },
879
- "properties": {
880
- "name": {
881
- "type": "string"
882
- },
883
- "namespace": {
884
- "type": "string"
885
- },
886
- "prefix": {
887
- "type": "string"
888
- },
889
- "attribute": {
890
- "type": "boolean"
891
- },
892
- "wrapped": {
893
- "type": "boolean"
894
- }
895
- }
896
- },
897
- "securityScheme": {
898
- "type": "object",
899
- "description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.",
900
- "required": [
901
- "type"
902
- ],
903
- "additionalProperties": false,
904
- "patternProperties": {
905
- "^x-": {
906
- "$ref": "#/definitions/specificationExtension"
907
- }
908
- },
909
- "properties": {
910
- "type": {
911
- "type": "string"
912
- },
913
- "description": {
914
- "type": "string"
915
- },
916
- "name": {
917
- "type": "string"
918
- },
919
- "in": {
920
- "type": "string"
921
- },
922
- "scheme": {
923
- "type": "string"
924
- },
925
- "bearerFormat": {
926
- "type": "string"
927
- },
928
- "flows": {
929
- "$ref": "#/definitions/oauthFlows"
930
- },
931
- "openIdConnectUrl": {
932
- "type": "string"
933
- }
934
- }
935
- },
936
- "oauthFlows": {
937
- "type": "object",
938
- "description": "Allows configuration of the supported OAuth Flows.",
939
- "additionalProperties": false,
940
- "patternProperties": {
941
- "^x-": {
942
- "$ref": "#/definitions/specificationExtension"
943
- }
944
- },
945
- "properties": {
946
- "implicit": {
947
- "$ref": "#/definitions/oauthFlow"
948
- },
949
- "password": {
950
- "$ref": "#/definitions/oauthFlow"
951
- },
952
- "clientCredentials": {
953
- "$ref": "#/definitions/oauthFlow"
954
- },
955
- "authorizationCode": {
956
- "$ref": "#/definitions/oauthFlow"
957
- }
958
- }
959
- },
960
- "oauthFlow": {
961
- "type": "object",
962
- "description": "Configuration details for a supported OAuth Flow",
963
- "additionalProperties": false,
964
- "patternProperties": {
965
- "^x-": {
966
- "$ref": "#/definitions/specificationExtension"
967
- }
968
- },
969
- "properties": {
970
- "authorizationUrl": {
971
- "type": "string"
972
- },
973
- "tokenUrl": {
974
- "type": "string"
975
- },
976
- "refreshUrl": {
977
- "type": "string"
978
- },
979
- "scopes": {
980
- "$ref": "#/definitions/strings"
981
- }
982
- }
983
- },
984
- "securityRequirement": {
985
- "type": "object",
986
- "description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.",
987
- "additionalProperties": false,
988
- "patternProperties": {
989
- "^[a-zA-Z0-9\\.\\-_]+$": {
990
- "type": "array",
991
- "items": {
992
- "type": "string"
993
- },
994
- "uniqueItems": true
995
- }
996
- }
997
- },
998
- "anyOrExpression": {
999
- "oneOf": [
1000
- {
1001
- "$ref": "#/definitions/any"
1002
- },
1003
- {
1004
- "$ref": "#/definitions/expression"
1005
- }
1006
- ]
1007
- },
1008
- "callbackOrReference": {
1009
- "oneOf": [
1010
- {
1011
- "$ref": "#/definitions/callback"
1012
- },
1013
- {
1014
- "$ref": "#/definitions/reference"
1015
- }
1016
- ]
1017
- },
1018
- "exampleOrReference": {
1019
- "oneOf": [
1020
- {
1021
- "$ref": "#/definitions/example"
1022
- },
1023
- {
1024
- "$ref": "#/definitions/reference"
1025
- }
1026
- ]
1027
- },
1028
- "headerOrReference": {
1029
- "oneOf": [
1030
- {
1031
- "$ref": "#/definitions/header"
1032
- },
1033
- {
1034
- "$ref": "#/definitions/reference"
1035
- }
1036
- ]
1037
- },
1038
- "linkOrReference": {
1039
- "oneOf": [
1040
- {
1041
- "$ref": "#/definitions/link"
1042
- },
1043
- {
1044
- "$ref": "#/definitions/reference"
1045
- }
1046
- ]
1047
- },
1048
- "parameterOrReference": {
1049
- "oneOf": [
1050
- {
1051
- "$ref": "#/definitions/parameter"
1052
- },
1053
- {
1054
- "$ref": "#/definitions/reference"
1055
- }
1056
- ]
1057
- },
1058
- "requestBodyOrReference": {
1059
- "oneOf": [
1060
- {
1061
- "$ref": "#/definitions/requestBody"
1062
- },
1063
- {
1064
- "$ref": "#/definitions/reference"
1065
- }
1066
- ]
1067
- },
1068
- "responseOrReference": {
1069
- "oneOf": [
1070
- {
1071
- "$ref": "#/definitions/response"
1072
- },
1073
- {
1074
- "$ref": "#/definitions/reference"
1075
- }
1076
- ]
1077
- },
1078
- "schemaOrReference": {
1079
- "oneOf": [
1080
- {
1081
- "$ref": "#/definitions/schema"
1082
- },
1083
- {
1084
- "$ref": "#/definitions/reference"
1085
- }
1086
- ]
1087
- },
1088
- "securitySchemeOrReference": {
1089
- "oneOf": [
1090
- {
1091
- "$ref": "#/definitions/securityScheme"
1092
- },
1093
- {
1094
- "$ref": "#/definitions/reference"
1095
- }
1096
- ]
1097
- },
1098
- "anysOrExpressions": {
1099
- "type": "object",
1100
- "additionalProperties": {
1101
- "$ref": "#/definitions/anyOrExpression"
1102
- }
1103
- },
1104
- "callbacksOrReferences": {
1105
- "type": "object",
1106
- "additionalProperties": {
1107
- "$ref": "#/definitions/callbackOrReference"
1108
- }
1109
- },
1110
- "encodings": {
1111
- "type": "object",
1112
- "additionalProperties": {
1113
- "$ref": "#/definitions/encoding"
1114
- }
1115
- },
1116
- "examplesOrReferences": {
1117
- "type": "object",
1118
- "additionalProperties": {
1119
- "$ref": "#/definitions/exampleOrReference"
1120
- }
1121
- },
1122
- "headersOrReferences": {
1123
- "type": "object",
1124
- "additionalProperties": {
1125
- "$ref": "#/definitions/headerOrReference"
1126
- }
1127
- },
1128
- "linksOrReferences": {
1129
- "type": "object",
1130
- "additionalProperties": {
1131
- "$ref": "#/definitions/linkOrReference"
1132
- }
1133
- },
1134
- "mediaTypes": {
1135
- "type": "object",
1136
- "additionalProperties": {
1137
- "$ref": "#/definitions/mediaType"
1138
- }
1139
- },
1140
- "parametersOrReferences": {
1141
- "type": "object",
1142
- "additionalProperties": {
1143
- "$ref": "#/definitions/parameterOrReference"
1144
- }
1145
- },
1146
- "requestBodiesOrReferences": {
1147
- "type": "object",
1148
- "additionalProperties": {
1149
- "$ref": "#/definitions/requestBodyOrReference"
1150
- }
1151
- },
1152
- "responsesOrReferences": {
1153
- "type": "object",
1154
- "additionalProperties": {
1155
- "$ref": "#/definitions/responseOrReference"
1156
- }
1157
- },
1158
- "schemasOrReferences": {
1159
- "type": "object",
1160
- "additionalProperties": {
1161
- "$ref": "#/definitions/schemaOrReference"
1162
- }
1163
- },
1164
- "securitySchemesOrReferences": {
1165
- "type": "object",
1166
- "additionalProperties": {
1167
- "$ref": "#/definitions/securitySchemeOrReference"
1168
- }
1169
- },
1170
- "serverVariables": {
1171
- "type": "object",
1172
- "additionalProperties": {
1173
- "$ref": "#/definitions/serverVariable"
1174
- }
1175
- },
1176
- "strings": {
1177
- "type": "object",
1178
- "additionalProperties": {
1179
- "type": "string"
1180
- }
1181
- },
1182
- "object": {
1183
- "type": "object",
1184
- "additionalProperties": true
1185
- },
1186
- "any": {
1187
- "additionalProperties": true
1188
- },
1189
- "expression": {
1190
- "type": "object",
1191
- "additionalProperties": true
1192
- },
1193
- "specificationExtension": {
1194
- "description": "Any property starting with x- is valid.",
1195
- "oneOf": [
1196
- {
1197
- "type": "null"
1198
- },
1199
- {
1200
- "type": "number"
1201
- },
1202
- {
1203
- "type": "boolean"
1204
- },
1205
- {
1206
- "type": "string"
1207
- },
1208
- {
1209
- "type": "object"
1210
- },
1211
- {
1212
- "type": "array"
1213
- }
1214
- ]
1215
- },
1216
- "defaultType": {
1217
- "oneOf": [
1218
- {
1219
- "type": "null"
1220
- },
1221
- {
1222
- "type": "array"
1223
- },
1224
- {
1225
- "type": "object"
1226
- },
1227
- {
1228
- "type": "number"
1229
- },
1230
- {
1231
- "type": "boolean"
1232
- },
1233
- {
1234
- "type": "string"
1235
- }
1236
- ]
1237
- }
1238
- }
1239
- }