rat_pack_swagger 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fdeaee701efde21c026b00ab2dd9c0adb7d75cb
4
- data.tar.gz: e7eab1bb0d62b5434b6f6daa5f1485cf2c564c92
3
+ metadata.gz: 636889f1fad2cbfd2a10246bcd2f5f42f1de2a5a
4
+ data.tar.gz: 1588c5a083a32c0b46281d916628d1247f46d3e2
5
5
  SHA512:
6
- metadata.gz: 5637b41810a20347aa6c8bda4aab77f56afa10d515ad528776d42c2d9cd5e31d4b09df6d6b96af7808276366320e193dc9894fa0d6dc3eb4362c9a17cbaa18bb
7
- data.tar.gz: 46d1c23c71f96ff53a052b7d5de52a2749dee97268ae0ecb78417914ee84beeed8dbb37d6ff162e8fcc217264918a2a42402167c79e28351cc4767ce47c19dc3
6
+ metadata.gz: def62fdfcce054727e3f2a44e1a65b37fdc572cef0b9f049d96a8345a4a74688edead293e65ea96a98c778ee766a20539592da6677d90e28b0410003f1a8554c
7
+ data.tar.gz: f9980930e52bb173ebd84f953171b9cb166fd5e2e5068c06b88df68af3bbf460fbffd3a16457e04c2d4cf49996cb7ccf0bdfb22bd3071874e3e03574e1190b29
@@ -1,58 +1,9 @@
1
1
  require 'sinatra/base'
2
2
  require 'json'
3
-
4
- class SwaggerObject
5
- instance_methods.each do |m|
6
- unless m =~ /^__/ || [:inspect, :instance_eval, :object_id].include?(m)
7
- undef_method m
8
- end
9
- end
10
-
11
- def initialize(*args, **kwargs, &block)
12
- if args.count > 0 && (!kwargs.empty? || block_given?)
13
- raise "Cannot give both unnamed arguments AND named arguments or block to Swagger parameter '#{m}'."
14
- elsif block_given?
15
- @obj = kwargs unless kwargs.empty?
16
- instance_eval &block
17
- elsif !kwargs.empty?
18
- @obj = kwargs
19
- elsif args.count > 0
20
- @obj = [*args]
21
- else
22
- raise "Cannot create SwaggerObject with no arguments."
23
- end
24
- end
25
-
26
- def add(*args, **kwargs)
27
- @obj ||= []
28
- if !@obj.is_a?(Array)
29
- raise "Swagger object must be an array to append data '#{item}'"
30
- elsif args.count > 0
31
- @obj << [*args, kwargs]
32
- else
33
- @obj << kwargs
34
- end
35
- end
36
-
37
- def method_missing(m, *args, **kwargs, &block)
38
- @obj ||= {}
39
- if block_given?
40
- @obj[m] = SwaggerObject.new(**kwargs, &block).get
41
- elsif !kwargs.empty?
42
- @obj[m] = SwaggerObject.new(**kwargs).get
43
- elsif args.count > 1
44
- @obj[m] = [*args]
45
- elsif args.count == 1
46
- @obj[m] = args[0]
47
- else
48
- raise "Cannot give zero arguments to Swagger key '#{m}'"
49
- end
50
- end
51
-
52
- def get
53
- @obj
54
- end
55
- end
3
+ require 'json-schema'
4
+ require_relative 'swagger_object'
5
+ require_relative 'swagger_spec'
6
+ require_relative 'request_validators'
56
7
 
57
8
  module RatPackSwagger
58
9
  module DefinitionClass
@@ -66,9 +17,13 @@ module RatPackSwagger
66
17
  @definition
67
18
  end
68
19
 
20
+ def to_h
21
+ definition
22
+ end
23
+
69
24
  # Class declaration API
70
25
  def properties(&block)
71
- definition[:properties].merge!(SwaggerObject.new(&block).get)
26
+ definition[:properties].merge!(SwaggerObject.new(&block).to_h)
72
27
  # create top-level property accessors for instance-like usage
73
28
  definition[:properties].keys.each do |k|
74
29
  self.send(:attr_accessor, k)
@@ -84,17 +39,8 @@ module RatPackSwagger
84
39
  mod.extend DefinitionClass
85
40
  end
86
41
 
87
- def definition
88
- self.class.definition
89
- end
90
-
91
- # Instance API
92
- def validate
93
- validate_object(definition, to_h(false))
94
- return self
95
- end
96
42
  def from_h(h)
97
- properties = definition[:properties]
43
+ properties = self.class.definition[:properties]
98
44
  h.each do |k,v|
99
45
  k = k.to_sym
100
46
  setter = "#{k}="
@@ -114,11 +60,10 @@ module RatPackSwagger
114
60
  end
115
61
  def to_h(recur = true)
116
62
  h = {}
117
- definition[:properties].keys.each do |p|
63
+ self.class.definition[:properties].keys.each do |p|
118
64
  val = send(p)
119
- puts val
120
65
  if recur
121
- if val.is_a? Array
66
+ if val.is_a?(Array)
122
67
  h[p] = val.map{|v| v.is_a?(Definition) ? v.to_h : v}
123
68
  elsif val.is_a?(Definition)
124
69
  h[p] = val.to_h
@@ -131,186 +76,95 @@ module RatPackSwagger
131
76
  end
132
77
  return h
133
78
  end
134
-
135
- # Validation
136
- def validate_object(object_definition, data)
137
- check_requireds(object_definition, data)
138
- check_object_types(object_definition, data)
139
- end
140
- def check_requireds(object_definition, data)
141
- object_definition[:properties].keys.each do |k|
142
- if object_definition[:required].include?(k) && data[k].nil?
143
- raise "Missing required property #{k}"
144
- end
145
- end
146
- end
147
- def check_object_types(object_definition, data)
148
- data.each do |k,v|
149
- property = object_definition[:properties][k]
150
-
151
- # verify 'type' if set
152
- type = property[:type]
153
- if type
154
- case type
155
- when :string
156
- raise "Property #{k} must be a string, not a #{v.class}" unless [String, Symbol].include?(v.class)
157
- when :number
158
- raise "Property #{k} must be a number, not a #{v.class}" unless v.is_a?(Numeric)
159
- when :integer
160
- if v.is_a?(Numeric)
161
- raise "Property #{k} must be an integer. Value is #{v}" unless v % 1 == 0
162
- else
163
- raise "Property #{k} must be an integer, not a #{v.class}" unless v.is_a?(Numeric)
164
- end
165
- when :boolean
166
- raise "Property #{k} must be a string, not a #{v.class}" unless [FalseClass, TrueClass].include?(v.class)
167
- when :array
168
- raise "Property #{k} must be an array, not a #{v.class}" unless v.is_a?(Array)
169
- when :object
170
- validate_object(property, v)
171
- else
172
- raise "Unknown property type '#{type}'"
173
- end
174
- end
175
-
176
- # verify type if a ref to another definition class
177
- ref = property[:$ref]
178
- if ref
179
- raise "Property #{k} should be a #{ref}, not a #{v.class}" unless ref.to_s == v.class.name
180
- end
181
-
182
- # verify enum
183
- enum = property[:enum]
184
- if enum
185
- raise "Enum for property #{k} must be an array, not a #{enum.class}" unless enum.is_a?(Array)
186
- raise "Invalid enum value (#{v}) for property #{k}. Valid enum values are #{enum}" unless enum.include?(v) || enum.include?(v.to_sym)
187
- end
188
-
189
- # verify mins and maxes
190
- min = property[:minimum]
191
- if min
192
- raise "Property #{k} value (#{v}) is less than the property minimum (#{min})" unless v >= min
193
- end
194
- max = property[:maximum]
195
- if min
196
- raise "Property #{k} value (#{v}) is less than the property maximum (#{max})" unless v <= max
197
- end
198
- end
199
- end
200
79
  end
201
80
  end
202
81
 
203
- def transform_hash_values(obj, &block)
204
- if obj.is_a? Hash
205
- obj.each do |k,v|
206
- if v.is_a?(Hash) || v.is_a?(Array)
207
- obj[k] = transform_hash_values(v, &block)
208
- else
209
- obj[k] = yield(k,v)
210
- end
211
- end
212
- elsif obj.is_a? Array
213
- obj.each_with_index do |e,i|
214
- if e.is_a?(Hash) || e.is_a?(Array)
215
- obj[i] = transform_hash_values(e, &block)
216
- end
217
- end
218
- else
219
- raise "Argument must be a Hash or an Array."
220
- end
221
- obj
222
- end
223
82
 
224
83
  module Sinatra
225
84
  module RatPackSwagger
85
+ def _spec
86
+ @@spec ||= ::RatPackSwagger::SwaggerSpec.new
87
+ end
88
+ def _validators
89
+ @@validators ||= ::RatPackSwagger::RequestValidatorCollection.new
90
+ end
91
+
226
92
  def swagger(*args, **kwargs, &block)
227
- @@doc ||= {}
228
93
  if args.count.zero?
229
94
  # assume passing data into method call
230
- @@doc.merge!(SwaggerObject.new(**kwargs, &block).get)
95
+ _spec.spec.merge!(SwaggerObject.new(**kwargs, &block).to_h)
231
96
  else
232
97
  # assume single argument is filename of existing json
233
- @@doc.merge!(::JSON.parse(File.read(args[0])))
98
+ _spec.spec.merge!(::JSON.parse(File.read(args[0])))
234
99
  end
235
100
  end
236
101
 
102
+ def definitions(*constants)
103
+ _spec.add_definitions(*constants)
104
+ end
105
+
237
106
  def description(d)
238
- @@description = d
107
+ _spec.this_route.description = d
239
108
  end
240
109
 
241
110
  def param(**kwargs, &block)
242
- @@parameters ||= []
243
- @@parameters << SwaggerObject.new(**kwargs, &block).get
111
+ _spec.this_route.parameters << SwaggerObject.new(**kwargs, &block).to_h
244
112
  end
245
113
 
246
114
  def tags(*args)
247
- @@tags ||= []
248
- args.each{|a| @@tags << a}
115
+ t = _spec.this_route.tags
116
+ args.each{|a| t << a}
249
117
  end
250
118
 
251
119
  def summary(s)
252
- @@summary = s
120
+ _spec.this_route.summary = s
253
121
  end
254
122
 
255
123
  def response(http_status_code, **kwargs, &block)
256
- @@responses ||= {}
257
- @@responses[http_status_code] = SwaggerObject.new(**kwargs, &block).get
124
+ _spec.this_route.responses[http_status_code] = SwaggerObject.new(**kwargs, &block).to_h
258
125
  end
259
126
 
260
- def definitions(*constants)
261
- @@doc[:definitions] ||= {}
262
- constants.each do |constant|
263
- if Module === constant
264
- constant.constants.each do |c|
265
- klass = constant.const_get(c)
266
- if Class === klass
267
- @@doc[:definitions][c] = klass.definition
268
- end
269
- end
270
- else
271
- @@doc[:definitions][constant.to_s.rpartition('::').last] = constant.definition
272
- end
273
- end
274
- end
275
127
 
276
128
  def self.registered(app)
129
+
277
130
  app.get '/v2/swagger.json' do
278
131
  content_type 'application/json'
279
132
  response['Access-Control-Allow-Origin'] = '*'
280
133
  response['Access-Control-Allow-Headers'] = 'Content-Type, api-key, Authorization'
281
134
  response['Access-Control-Allow-Methods'] = 'GET, POST'
282
- doc = transform_hash_values(@@doc) do |k,v|
283
- k.to_s == '$ref' ? "\#/definitions/#{v.to_s.rpartition('::').last}" : v
135
+ errors = ::JSON::Validator.fully_validate(@@spec.swagger_schema, @@spec.api_spec, errors_as_objects: true)
136
+ if errors.empty? then @@spec.api_spec_json else errors.to_json end
137
+ end
138
+
139
+ app.before do
140
+ @@validators ||= ::RatPackSwagger::RequestValidatorCollection.new
141
+ vs = @@validators.get(request.path, request.request_method.downcase)
142
+ if vs && vs[:body]
143
+ request.body.rewind
144
+ vs[:body].validate(request.body.read)
145
+ request.body.rewind
284
146
  end
285
- doc.to_json
147
+ # TODO: add other param types like 'query'
286
148
  end
287
- @@doc = {}
288
149
  end
289
150
 
290
151
  def self.route_added(verb, path, block)
291
152
  return if path == '/v2/swagger.json'
292
- return unless ['GET', 'POST', 'PUT', 'DELETE'].include?(verb)
293
-
294
- @@doc['paths'] ||= {}
295
- @@description ||= ''
296
- @@tags ||= []
297
- @@summary ||= ''
298
- @@responses ||= {}
299
-
300
- @@doc['paths'][path] ||= {}
301
- @@doc['paths'][path][verb.downcase] = {
302
- tags: @@tags,
303
- description: @@description,
304
- summary: @@summary,
305
- parameters: @@parameters,
306
- responses: @@responses
307
- }
308
-
309
- @@parameters = []
310
- @@description = nil
311
- @@tags = nil
312
- @@summary = nil
313
- @@responses = nil
153
+ verb.downcase!
154
+ return unless ['get', 'post', 'put', 'delete'].include?(verb)
155
+ @@spec.register_this_route(path, verb)
156
+
157
+ parameters = @@spec.resolved_spec[:paths][path][verb][:parameters]
158
+ return unless parameters
159
+
160
+ @@validators ||= ::RatPackSwagger::RequestValidatorCollection.new
161
+ body_param = parameters.select{|p| p[:in].to_sym == :body}.first
162
+ if @@spec.route_consumes?(path, verb, 'application/json')
163
+ if body_param
164
+ @@validators.set(path, verb, :body, ::RatPackSwagger::JsonBodyValidator.new(body_param[:schema]))
165
+ end
166
+ # TODO: add validators for other param types like 'query'
167
+ end
314
168
  end
315
169
  end
316
170
  end
@@ -1,3 +1,3 @@
1
1
  module RatPackSwagger
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,40 @@
1
+ require 'json'
2
+ require 'json-schema'
3
+
4
+ module RatPackSwagger
5
+ class RequestValidatorCollection
6
+ def initialize
7
+ @validators = {}
8
+ end
9
+
10
+ def get(path, verb, type = nil)
11
+ if @validators[path]
12
+ if @validators[path][verb]
13
+ if type
14
+ if @validators[path][verb][type]
15
+ return @validators[path][verb][type]
16
+ end
17
+ else
18
+ return @validators[path][verb]
19
+ end
20
+ end
21
+ end
22
+ return nil
23
+ end
24
+
25
+ def set(path, verb, type, validator)
26
+ @validators[path] ||= {}
27
+ @validators[path][verb] ||= {}
28
+ @validators[path][verb][type] = validator
29
+ end
30
+ end
31
+
32
+ class JsonBodyValidator
33
+ def initialize(schema)
34
+ @schema = schema
35
+ end
36
+ def validate(body)
37
+ ::JSON::Validator.validate!(@schema, body)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,1494 @@
1
+ {
2
+ "title": "A JSON Schema for Swagger 2.0 API.",
3
+ "id": "http://swagger.io/v2/schema.json#",
4
+ "type": "object",
5
+ "required": [
6
+ "swagger",
7
+ "info",
8
+ "paths"
9
+ ],
10
+ "additionalProperties": false,
11
+ "patternProperties": {
12
+ "^x-": {
13
+ "$ref": "#/definitions/vendorExtension"
14
+ }
15
+ },
16
+ "properties": {
17
+ "swagger": {
18
+ "type": "string",
19
+ "enum": [
20
+ "2.0"
21
+ ],
22
+ "description": "The Swagger version of this document."
23
+ },
24
+ "info": {
25
+ "$ref": "#/definitions/info"
26
+ },
27
+ "host": {
28
+ "type": "string",
29
+ "format": "uri",
30
+ "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
31
+ "description": "The fully qualified URI to the host of the API."
32
+ },
33
+ "basePath": {
34
+ "type": "string",
35
+ "pattern": "^/",
36
+ "description": "The base path to the API. Example: '/api'."
37
+ },
38
+ "schemes": {
39
+ "$ref": "#/definitions/schemesList"
40
+ },
41
+ "consumes": {
42
+ "description": "A list of MIME types accepted by the API.",
43
+ "$ref": "#/definitions/mediaTypeList"
44
+ },
45
+ "produces": {
46
+ "description": "A list of MIME types the API can produce.",
47
+ "$ref": "#/definitions/mediaTypeList"
48
+ },
49
+ "paths": {
50
+ "$ref": "#/definitions/paths"
51
+ },
52
+ "definitions": {
53
+ "$ref": "#/definitions/definitions"
54
+ },
55
+ "parameters": {
56
+ "$ref": "#/definitions/parameterDefinitions"
57
+ },
58
+ "responses": {
59
+ "$ref": "#/definitions/responseDefinitions"
60
+ },
61
+ "security": {
62
+ "$ref": "#/definitions/security"
63
+ },
64
+ "securityDefinitions": {
65
+ "$ref": "#/definitions/securityDefinitions"
66
+ },
67
+ "tags": {
68
+ "type": "array",
69
+ "items": {
70
+ "$ref": "#/definitions/tag"
71
+ },
72
+ "uniqueItems": true
73
+ },
74
+ "externalDocs": {
75
+ "$ref": "#/definitions/externalDocs"
76
+ }
77
+ },
78
+ "definitions": {
79
+ "info": {
80
+ "type": "object",
81
+ "description": "General information about the API.",
82
+ "required": [
83
+ "version",
84
+ "title"
85
+ ],
86
+ "additionalProperties": false,
87
+ "patternProperties": {
88
+ "^x-": {
89
+ "$ref": "#/definitions/vendorExtension"
90
+ }
91
+ },
92
+ "properties": {
93
+ "title": {
94
+ "type": "string",
95
+ "description": "A unique and precise title of the API."
96
+ },
97
+ "version": {
98
+ "type": "string",
99
+ "description": "A semantic version number of the API."
100
+ },
101
+ "description": {
102
+ "type": "string",
103
+ "description": "A longer description of the API. Should be different from the title. Github-flavored markdown is allowed."
104
+ },
105
+ "termsOfService": {
106
+ "type": "string",
107
+ "description": "The terms of service for the API."
108
+ },
109
+ "contact": {
110
+ "$ref": "#/definitions/contact"
111
+ },
112
+ "license": {
113
+ "$ref": "#/definitions/license"
114
+ }
115
+ }
116
+ },
117
+ "contact": {
118
+ "type": "object",
119
+ "description": "Contact information for the owners of the API.",
120
+ "additionalProperties": false,
121
+ "properties": {
122
+ "name": {
123
+ "type": "string",
124
+ "description": "The identifying name of the contact person/organization."
125
+ },
126
+ "url": {
127
+ "type": "string",
128
+ "description": "The URL pointing to the contact information.",
129
+ "format": "uri"
130
+ },
131
+ "email": {
132
+ "type": "string",
133
+ "description": "The email address of the contact person/organization.",
134
+ "format": "email"
135
+ }
136
+ }
137
+ },
138
+ "license": {
139
+ "type": "object",
140
+ "required": [
141
+ "name"
142
+ ],
143
+ "additionalProperties": false,
144
+ "properties": {
145
+ "name": {
146
+ "type": "string",
147
+ "description": "The name of the license type. It's encouraged to use an OSI compatible license."
148
+ },
149
+ "url": {
150
+ "type": "string",
151
+ "description": "The URL pointing to the license.",
152
+ "format": "uri"
153
+ }
154
+ }
155
+ },
156
+ "paths": {
157
+ "type": "object",
158
+ "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
159
+ "patternProperties": {
160
+ "^x-": {
161
+ "$ref": "#/definitions/vendorExtension"
162
+ },
163
+ "^/": {
164
+ "$ref": "#/definitions/pathItem"
165
+ }
166
+ },
167
+ "additionalProperties": false
168
+ },
169
+ "definitions": {
170
+ "type": "object",
171
+ "additionalProperties": {
172
+ "$ref": "#/definitions/schema"
173
+ },
174
+ "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
175
+ },
176
+ "parameterDefinitions": {
177
+ "type": "object",
178
+ "additionalProperties": {
179
+ "$ref": "#/definitions/parameter"
180
+ },
181
+ "description": "One or more JSON representations for parameters"
182
+ },
183
+ "responseDefinitions": {
184
+ "type": "object",
185
+ "additionalProperties": {
186
+ "$ref": "#/definitions/response"
187
+ },
188
+ "description": "One or more JSON representations for parameters"
189
+ },
190
+ "externalDocs": {
191
+ "type": "object",
192
+ "additionalProperties": false,
193
+ "description": "information about external documentation",
194
+ "required": [
195
+ "url"
196
+ ],
197
+ "properties": {
198
+ "description": {
199
+ "type": "string"
200
+ },
201
+ "url": {
202
+ "type": "string",
203
+ "format": "uri"
204
+ }
205
+ }
206
+ },
207
+ "examples": {
208
+ "type": "object",
209
+ "patternProperties": {
210
+ "^[a-z0-9-]+/[a-z0-9\\-+]+$": {}
211
+ },
212
+ "additionalProperties": false
213
+ },
214
+ "mimeType": {
215
+ "type": "string",
216
+ "description": "The MIME type of the HTTP message."
217
+ },
218
+ "operation": {
219
+ "type": "object",
220
+ "required": [
221
+ "responses"
222
+ ],
223
+ "additionalProperties": false,
224
+ "patternProperties": {
225
+ "^x-": {
226
+ "$ref": "#/definitions/vendorExtension"
227
+ }
228
+ },
229
+ "properties": {
230
+ "tags": {
231
+ "type": "array",
232
+ "items": {
233
+ "type": "string"
234
+ },
235
+ "uniqueItems": true
236
+ },
237
+ "summary": {
238
+ "type": "string",
239
+ "description": "A brief summary of the operation."
240
+ },
241
+ "description": {
242
+ "type": "string",
243
+ "description": "A longer description of the operation, github-flavored markdown is allowed."
244
+ },
245
+ "externalDocs": {
246
+ "$ref": "#/definitions/externalDocs"
247
+ },
248
+ "operationId": {
249
+ "type": "string",
250
+ "description": "A friendly name of the operation"
251
+ },
252
+ "produces": {
253
+ "description": "A list of MIME types the API can produce.",
254
+ "$ref": "#/definitions/mediaTypeList"
255
+ },
256
+ "consumes": {
257
+ "description": "A list of MIME types the API can consume.",
258
+ "$ref": "#/definitions/mediaTypeList"
259
+ },
260
+ "parameters": {
261
+ "$ref": "#/definitions/parametersList"
262
+ },
263
+ "responses": {
264
+ "$ref": "#/definitions/responses"
265
+ },
266
+ "schemes": {
267
+ "$ref": "#/definitions/schemesList"
268
+ },
269
+ "deprecated": {
270
+ "type": "boolean",
271
+ "default": false
272
+ },
273
+ "security": {
274
+ "$ref": "#/definitions/security"
275
+ }
276
+ }
277
+ },
278
+ "pathItem": {
279
+ "type": "object",
280
+ "additionalProperties": false,
281
+ "patternProperties": {
282
+ "^x-": {
283
+ "$ref": "#/definitions/vendorExtension"
284
+ }
285
+ },
286
+ "properties": {
287
+ "$ref": {
288
+ "type": "string"
289
+ },
290
+ "get": {
291
+ "$ref": "#/definitions/operation"
292
+ },
293
+ "put": {
294
+ "$ref": "#/definitions/operation"
295
+ },
296
+ "post": {
297
+ "$ref": "#/definitions/operation"
298
+ },
299
+ "delete": {
300
+ "$ref": "#/definitions/operation"
301
+ },
302
+ "options": {
303
+ "$ref": "#/definitions/operation"
304
+ },
305
+ "head": {
306
+ "$ref": "#/definitions/operation"
307
+ },
308
+ "patch": {
309
+ "$ref": "#/definitions/operation"
310
+ },
311
+ "parameters": {
312
+ "$ref": "#/definitions/parametersList"
313
+ }
314
+ }
315
+ },
316
+ "responses": {
317
+ "type": "object",
318
+ "description": "Response objects names can either be any valid HTTP status code or 'default'.",
319
+ "minProperties": 1,
320
+ "additionalProperties": false,
321
+ "patternProperties": {
322
+ "^([0-9]{3})$|^(default)$": {
323
+ "$ref": "#/definitions/responseValue"
324
+ },
325
+ "^x-": {
326
+ "$ref": "#/definitions/vendorExtension"
327
+ }
328
+ },
329
+ "not": {
330
+ "type": "object",
331
+ "additionalProperties": false,
332
+ "patternProperties": {
333
+ "^x-": {
334
+ "$ref": "#/definitions/vendorExtension"
335
+ }
336
+ }
337
+ }
338
+ },
339
+ "responseValue": {
340
+ "oneOf": [
341
+ {
342
+ "$ref": "#/definitions/response"
343
+ },
344
+ {
345
+ "$ref": "#/definitions/jsonReference"
346
+ }
347
+ ]
348
+ },
349
+ "response": {
350
+ "type": "object",
351
+ "required": [
352
+ "description"
353
+ ],
354
+ "properties": {
355
+ "description": {
356
+ "type": "string"
357
+ },
358
+ "schema": {
359
+ "$ref": "#/definitions/schema"
360
+ },
361
+ "headers": {
362
+ "$ref": "#/definitions/headers"
363
+ },
364
+ "examples": {
365
+ "$ref": "#/definitions/examples"
366
+ }
367
+ },
368
+ "additionalProperties": false
369
+ },
370
+ "headers": {
371
+ "type": "object",
372
+ "additionalProperties": {
373
+ "$ref": "#/definitions/header"
374
+ }
375
+ },
376
+ "header": {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": [
380
+ "type"
381
+ ],
382
+ "properties": {
383
+ "type": {
384
+ "type": "string",
385
+ "enum": [
386
+ "string",
387
+ "number",
388
+ "integer",
389
+ "boolean",
390
+ "array"
391
+ ]
392
+ },
393
+ "format": {
394
+ "type": "string"
395
+ },
396
+ "items": {
397
+ "$ref": "#/definitions/primitivesItems"
398
+ },
399
+ "collectionFormat": {
400
+ "$ref": "#/definitions/collectionFormat"
401
+ },
402
+ "default": {
403
+ "$ref": "#/definitions/default"
404
+ },
405
+ "maximum": {
406
+ "$ref": "#/definitions/maximum"
407
+ },
408
+ "exclusiveMaximum": {
409
+ "$ref": "#/definitions/exclusiveMaximum"
410
+ },
411
+ "minimum": {
412
+ "$ref": "#/definitions/minimum"
413
+ },
414
+ "exclusiveMinimum": {
415
+ "$ref": "#/definitions/exclusiveMinimum"
416
+ },
417
+ "maxLength": {
418
+ "$ref": "#/definitions/maxLength"
419
+ },
420
+ "minLength": {
421
+ "$ref": "#/definitions/minLength"
422
+ },
423
+ "pattern": {
424
+ "$ref": "#/definitions/pattern"
425
+ },
426
+ "maxItems": {
427
+ "$ref": "#/definitions/maxItems"
428
+ },
429
+ "minItems": {
430
+ "$ref": "#/definitions/minItems"
431
+ },
432
+ "uniqueItems": {
433
+ "$ref": "#/definitions/uniqueItems"
434
+ },
435
+ "enum": {
436
+ "$ref": "#/definitions/enum"
437
+ },
438
+ "multipleOf": {
439
+ "$ref": "#/definitions/multipleOf"
440
+ },
441
+ "description": {
442
+ "type": "string"
443
+ }
444
+ }
445
+ },
446
+ "vendorExtension": {
447
+ "description": "Any property starting with x- is valid.",
448
+ "additionalProperties": true,
449
+ "additionalItems": true
450
+ },
451
+ "bodyParameter": {
452
+ "type": "object",
453
+ "required": [
454
+ "name",
455
+ "in",
456
+ "schema"
457
+ ],
458
+ "patternProperties": {
459
+ "^x-": {
460
+ "$ref": "#/definitions/vendorExtension"
461
+ }
462
+ },
463
+ "properties": {
464
+ "description": {
465
+ "type": "string",
466
+ "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
467
+ },
468
+ "name": {
469
+ "type": "string",
470
+ "description": "The name of the parameter."
471
+ },
472
+ "in": {
473
+ "type": "string",
474
+ "description": "Determines the location of the parameter.",
475
+ "enum": [
476
+ "body"
477
+ ]
478
+ },
479
+ "required": {
480
+ "type": "boolean",
481
+ "description": "Determines whether or not this parameter is required or optional.",
482
+ "default": false
483
+ },
484
+ "schema": {
485
+ "$ref": "#/definitions/schema"
486
+ }
487
+ },
488
+ "additionalProperties": false
489
+ },
490
+ "headerParameterSubSchema": {
491
+ "additionalProperties": false,
492
+ "patternProperties": {
493
+ "^x-": {
494
+ "$ref": "#/definitions/vendorExtension"
495
+ }
496
+ },
497
+ "properties": {
498
+ "required": {
499
+ "type": "boolean",
500
+ "description": "Determines whether or not this parameter is required or optional.",
501
+ "default": false
502
+ },
503
+ "in": {
504
+ "type": "string",
505
+ "description": "Determines the location of the parameter.",
506
+ "enum": [
507
+ "header"
508
+ ]
509
+ },
510
+ "description": {
511
+ "type": "string",
512
+ "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
513
+ },
514
+ "name": {
515
+ "type": "string",
516
+ "description": "The name of the parameter."
517
+ },
518
+ "type": {
519
+ "type": "string",
520
+ "enum": [
521
+ "string",
522
+ "number",
523
+ "boolean",
524
+ "integer",
525
+ "array"
526
+ ]
527
+ },
528
+ "format": {
529
+ "type": "string"
530
+ },
531
+ "items": {
532
+ "$ref": "#/definitions/primitivesItems"
533
+ },
534
+ "collectionFormat": {
535
+ "$ref": "#/definitions/collectionFormat"
536
+ },
537
+ "default": {
538
+ "$ref": "#/definitions/default"
539
+ },
540
+ "maximum": {
541
+ "$ref": "#/definitions/maximum"
542
+ },
543
+ "exclusiveMaximum": {
544
+ "$ref": "#/definitions/exclusiveMaximum"
545
+ },
546
+ "minimum": {
547
+ "$ref": "#/definitions/minimum"
548
+ },
549
+ "exclusiveMinimum": {
550
+ "$ref": "#/definitions/exclusiveMinimum"
551
+ },
552
+ "maxLength": {
553
+ "$ref": "#/definitions/maxLength"
554
+ },
555
+ "minLength": {
556
+ "$ref": "#/definitions/minLength"
557
+ },
558
+ "pattern": {
559
+ "$ref": "#/definitions/pattern"
560
+ },
561
+ "maxItems": {
562
+ "$ref": "#/definitions/maxItems"
563
+ },
564
+ "minItems": {
565
+ "$ref": "#/definitions/minItems"
566
+ },
567
+ "uniqueItems": {
568
+ "$ref": "#/definitions/uniqueItems"
569
+ },
570
+ "enum": {
571
+ "$ref": "#/definitions/enum"
572
+ },
573
+ "multipleOf": {
574
+ "$ref": "#/definitions/multipleOf"
575
+ }
576
+ }
577
+ },
578
+ "queryParameterSubSchema": {
579
+ "additionalProperties": false,
580
+ "patternProperties": {
581
+ "^x-": {
582
+ "$ref": "#/definitions/vendorExtension"
583
+ }
584
+ },
585
+ "properties": {
586
+ "required": {
587
+ "type": "boolean",
588
+ "description": "Determines whether or not this parameter is required or optional.",
589
+ "default": false
590
+ },
591
+ "in": {
592
+ "type": "string",
593
+ "description": "Determines the location of the parameter.",
594
+ "enum": [
595
+ "query"
596
+ ]
597
+ },
598
+ "description": {
599
+ "type": "string",
600
+ "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
601
+ },
602
+ "name": {
603
+ "type": "string",
604
+ "description": "The name of the parameter."
605
+ },
606
+ "allowEmptyValue": {
607
+ "type": "boolean",
608
+ "default": false,
609
+ "description": "allows sending a parameter by name only or with an empty value."
610
+ },
611
+ "type": {
612
+ "type": "string",
613
+ "enum": [
614
+ "string",
615
+ "number",
616
+ "boolean",
617
+ "integer",
618
+ "array"
619
+ ]
620
+ },
621
+ "format": {
622
+ "type": "string"
623
+ },
624
+ "items": {
625
+ "$ref": "#/definitions/primitivesItems"
626
+ },
627
+ "collectionFormat": {
628
+ "$ref": "#/definitions/collectionFormatWithMulti"
629
+ },
630
+ "default": {
631
+ "$ref": "#/definitions/default"
632
+ },
633
+ "maximum": {
634
+ "$ref": "#/definitions/maximum"
635
+ },
636
+ "exclusiveMaximum": {
637
+ "$ref": "#/definitions/exclusiveMaximum"
638
+ },
639
+ "minimum": {
640
+ "$ref": "#/definitions/minimum"
641
+ },
642
+ "exclusiveMinimum": {
643
+ "$ref": "#/definitions/exclusiveMinimum"
644
+ },
645
+ "maxLength": {
646
+ "$ref": "#/definitions/maxLength"
647
+ },
648
+ "minLength": {
649
+ "$ref": "#/definitions/minLength"
650
+ },
651
+ "pattern": {
652
+ "$ref": "#/definitions/pattern"
653
+ },
654
+ "maxItems": {
655
+ "$ref": "#/definitions/maxItems"
656
+ },
657
+ "minItems": {
658
+ "$ref": "#/definitions/minItems"
659
+ },
660
+ "uniqueItems": {
661
+ "$ref": "#/definitions/uniqueItems"
662
+ },
663
+ "enum": {
664
+ "$ref": "#/definitions/enum"
665
+ },
666
+ "multipleOf": {
667
+ "$ref": "#/definitions/multipleOf"
668
+ }
669
+ }
670
+ },
671
+ "formDataParameterSubSchema": {
672
+ "additionalProperties": false,
673
+ "patternProperties": {
674
+ "^x-": {
675
+ "$ref": "#/definitions/vendorExtension"
676
+ }
677
+ },
678
+ "properties": {
679
+ "required": {
680
+ "type": "boolean",
681
+ "description": "Determines whether or not this parameter is required or optional.",
682
+ "default": false
683
+ },
684
+ "in": {
685
+ "type": "string",
686
+ "description": "Determines the location of the parameter.",
687
+ "enum": [
688
+ "formData"
689
+ ]
690
+ },
691
+ "description": {
692
+ "type": "string",
693
+ "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
694
+ },
695
+ "name": {
696
+ "type": "string",
697
+ "description": "The name of the parameter."
698
+ },
699
+ "allowEmptyValue": {
700
+ "type": "boolean",
701
+ "default": false,
702
+ "description": "allows sending a parameter by name only or with an empty value."
703
+ },
704
+ "type": {
705
+ "type": "string",
706
+ "enum": [
707
+ "string",
708
+ "number",
709
+ "boolean",
710
+ "integer",
711
+ "array",
712
+ "file"
713
+ ]
714
+ },
715
+ "format": {
716
+ "type": "string"
717
+ },
718
+ "items": {
719
+ "$ref": "#/definitions/primitivesItems"
720
+ },
721
+ "collectionFormat": {
722
+ "$ref": "#/definitions/collectionFormatWithMulti"
723
+ },
724
+ "default": {
725
+ "$ref": "#/definitions/default"
726
+ },
727
+ "maximum": {
728
+ "$ref": "#/definitions/maximum"
729
+ },
730
+ "exclusiveMaximum": {
731
+ "$ref": "#/definitions/exclusiveMaximum"
732
+ },
733
+ "minimum": {
734
+ "$ref": "#/definitions/minimum"
735
+ },
736
+ "exclusiveMinimum": {
737
+ "$ref": "#/definitions/exclusiveMinimum"
738
+ },
739
+ "maxLength": {
740
+ "$ref": "#/definitions/maxLength"
741
+ },
742
+ "minLength": {
743
+ "$ref": "#/definitions/minLength"
744
+ },
745
+ "pattern": {
746
+ "$ref": "#/definitions/pattern"
747
+ },
748
+ "maxItems": {
749
+ "$ref": "#/definitions/maxItems"
750
+ },
751
+ "minItems": {
752
+ "$ref": "#/definitions/minItems"
753
+ },
754
+ "uniqueItems": {
755
+ "$ref": "#/definitions/uniqueItems"
756
+ },
757
+ "enum": {
758
+ "$ref": "#/definitions/enum"
759
+ },
760
+ "multipleOf": {
761
+ "$ref": "#/definitions/multipleOf"
762
+ }
763
+ }
764
+ },
765
+ "pathParameterSubSchema": {
766
+ "additionalProperties": false,
767
+ "patternProperties": {
768
+ "^x-": {
769
+ "$ref": "#/definitions/vendorExtension"
770
+ }
771
+ },
772
+ "properties": {
773
+ "required": {
774
+ "type": "boolean",
775
+ "enum": [
776
+ true
777
+ ],
778
+ "description": "Determines whether or not this parameter is required or optional."
779
+ },
780
+ "in": {
781
+ "type": "string",
782
+ "description": "Determines the location of the parameter.",
783
+ "enum": [
784
+ "path"
785
+ ]
786
+ },
787
+ "description": {
788
+ "type": "string",
789
+ "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
790
+ },
791
+ "name": {
792
+ "type": "string",
793
+ "description": "The name of the parameter."
794
+ },
795
+ "type": {
796
+ "type": "string",
797
+ "enum": [
798
+ "string",
799
+ "number",
800
+ "boolean",
801
+ "integer",
802
+ "array"
803
+ ]
804
+ },
805
+ "format": {
806
+ "type": "string"
807
+ },
808
+ "items": {
809
+ "$ref": "#/definitions/primitivesItems"
810
+ },
811
+ "collectionFormat": {
812
+ "$ref": "#/definitions/collectionFormat"
813
+ },
814
+ "default": {
815
+ "$ref": "#/definitions/default"
816
+ },
817
+ "maximum": {
818
+ "$ref": "#/definitions/maximum"
819
+ },
820
+ "exclusiveMaximum": {
821
+ "$ref": "#/definitions/exclusiveMaximum"
822
+ },
823
+ "minimum": {
824
+ "$ref": "#/definitions/minimum"
825
+ },
826
+ "exclusiveMinimum": {
827
+ "$ref": "#/definitions/exclusiveMinimum"
828
+ },
829
+ "maxLength": {
830
+ "$ref": "#/definitions/maxLength"
831
+ },
832
+ "minLength": {
833
+ "$ref": "#/definitions/minLength"
834
+ },
835
+ "pattern": {
836
+ "$ref": "#/definitions/pattern"
837
+ },
838
+ "maxItems": {
839
+ "$ref": "#/definitions/maxItems"
840
+ },
841
+ "minItems": {
842
+ "$ref": "#/definitions/minItems"
843
+ },
844
+ "uniqueItems": {
845
+ "$ref": "#/definitions/uniqueItems"
846
+ },
847
+ "enum": {
848
+ "$ref": "#/definitions/enum"
849
+ },
850
+ "multipleOf": {
851
+ "$ref": "#/definitions/multipleOf"
852
+ }
853
+ }
854
+ },
855
+ "nonBodyParameter": {
856
+ "type": "object",
857
+ "required": [
858
+ "name",
859
+ "in",
860
+ "type"
861
+ ],
862
+ "oneOf": [
863
+ {
864
+ "$ref": "#/definitions/headerParameterSubSchema"
865
+ },
866
+ {
867
+ "$ref": "#/definitions/formDataParameterSubSchema"
868
+ },
869
+ {
870
+ "$ref": "#/definitions/queryParameterSubSchema"
871
+ },
872
+ {
873
+ "$ref": "#/definitions/pathParameterSubSchema"
874
+ }
875
+ ]
876
+ },
877
+ "parameter": {
878
+ "oneOf": [
879
+ {
880
+ "$ref": "#/definitions/bodyParameter"
881
+ },
882
+ {
883
+ "$ref": "#/definitions/nonBodyParameter"
884
+ }
885
+ ]
886
+ },
887
+ "schema": {
888
+ "type": "object",
889
+ "description": "A deterministic version of a JSON Schema object.",
890
+ "patternProperties": {
891
+ "^x-": {
892
+ "$ref": "#/definitions/vendorExtension"
893
+ }
894
+ },
895
+ "properties": {
896
+ "$ref": {
897
+ "type": "string"
898
+ },
899
+ "format": {
900
+ "type": "string"
901
+ },
902
+ "title": {
903
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
904
+ },
905
+ "description": {
906
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
907
+ },
908
+ "default": {
909
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
910
+ },
911
+ "multipleOf": {
912
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
913
+ },
914
+ "maximum": {
915
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
916
+ },
917
+ "exclusiveMaximum": {
918
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
919
+ },
920
+ "minimum": {
921
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
922
+ },
923
+ "exclusiveMinimum": {
924
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
925
+ },
926
+ "maxLength": {
927
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
928
+ },
929
+ "minLength": {
930
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
931
+ },
932
+ "pattern": {
933
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
934
+ },
935
+ "maxItems": {
936
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
937
+ },
938
+ "minItems": {
939
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
940
+ },
941
+ "uniqueItems": {
942
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
943
+ },
944
+ "maxProperties": {
945
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
946
+ },
947
+ "minProperties": {
948
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
949
+ },
950
+ "required": {
951
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
952
+ },
953
+ "enum": {
954
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
955
+ },
956
+ "additionalProperties": {
957
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/additionalProperties"
958
+ },
959
+ "type": {
960
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
961
+ },
962
+ "items": {
963
+ "anyOf": [
964
+ {
965
+ "$ref": "#/definitions/schema"
966
+ },
967
+ {
968
+ "type": "array",
969
+ "minItems": 1,
970
+ "items": {
971
+ "$ref": "#/definitions/schema"
972
+ }
973
+ }
974
+ ],
975
+ "default": {}
976
+ },
977
+ "allOf": {
978
+ "type": "array",
979
+ "minItems": 1,
980
+ "items": {
981
+ "$ref": "#/definitions/schema"
982
+ }
983
+ },
984
+ "properties": {
985
+ "type": "object",
986
+ "additionalProperties": {
987
+ "$ref": "#/definitions/schema"
988
+ },
989
+ "default": {}
990
+ },
991
+ "discriminator": {
992
+ "type": "string"
993
+ },
994
+ "readOnly": {
995
+ "type": "boolean",
996
+ "default": false
997
+ },
998
+ "xml": {
999
+ "$ref": "#/definitions/xml"
1000
+ },
1001
+ "externalDocs": {
1002
+ "$ref": "#/definitions/externalDocs"
1003
+ },
1004
+ "example": {}
1005
+ },
1006
+ "additionalProperties": false
1007
+ },
1008
+ "primitivesItems": {
1009
+ "type": "object",
1010
+ "additionalProperties": false,
1011
+ "properties": {
1012
+ "type": {
1013
+ "type": "string",
1014
+ "enum": [
1015
+ "string",
1016
+ "number",
1017
+ "integer",
1018
+ "boolean",
1019
+ "array"
1020
+ ]
1021
+ },
1022
+ "format": {
1023
+ "type": "string"
1024
+ },
1025
+ "items": {
1026
+ "$ref": "#/definitions/primitivesItems"
1027
+ },
1028
+ "collectionFormat": {
1029
+ "$ref": "#/definitions/collectionFormat"
1030
+ },
1031
+ "default": {
1032
+ "$ref": "#/definitions/default"
1033
+ },
1034
+ "maximum": {
1035
+ "$ref": "#/definitions/maximum"
1036
+ },
1037
+ "exclusiveMaximum": {
1038
+ "$ref": "#/definitions/exclusiveMaximum"
1039
+ },
1040
+ "minimum": {
1041
+ "$ref": "#/definitions/minimum"
1042
+ },
1043
+ "exclusiveMinimum": {
1044
+ "$ref": "#/definitions/exclusiveMinimum"
1045
+ },
1046
+ "maxLength": {
1047
+ "$ref": "#/definitions/maxLength"
1048
+ },
1049
+ "minLength": {
1050
+ "$ref": "#/definitions/minLength"
1051
+ },
1052
+ "pattern": {
1053
+ "$ref": "#/definitions/pattern"
1054
+ },
1055
+ "maxItems": {
1056
+ "$ref": "#/definitions/maxItems"
1057
+ },
1058
+ "minItems": {
1059
+ "$ref": "#/definitions/minItems"
1060
+ },
1061
+ "uniqueItems": {
1062
+ "$ref": "#/definitions/uniqueItems"
1063
+ },
1064
+ "enum": {
1065
+ "$ref": "#/definitions/enum"
1066
+ },
1067
+ "multipleOf": {
1068
+ "$ref": "#/definitions/multipleOf"
1069
+ }
1070
+ }
1071
+ },
1072
+ "security": {
1073
+ "type": "array",
1074
+ "items": {
1075
+ "$ref": "#/definitions/securityRequirement"
1076
+ },
1077
+ "uniqueItems": true
1078
+ },
1079
+ "securityRequirement": {
1080
+ "type": "object",
1081
+ "additionalProperties": {
1082
+ "type": "array",
1083
+ "items": {
1084
+ "type": "string"
1085
+ },
1086
+ "uniqueItems": true
1087
+ }
1088
+ },
1089
+ "xml": {
1090
+ "type": "object",
1091
+ "additionalProperties": false,
1092
+ "properties": {
1093
+ "name": {
1094
+ "type": "string"
1095
+ },
1096
+ "namespace": {
1097
+ "type": "string"
1098
+ },
1099
+ "prefix": {
1100
+ "type": "string"
1101
+ },
1102
+ "attribute": {
1103
+ "type": "boolean",
1104
+ "default": false
1105
+ },
1106
+ "wrapped": {
1107
+ "type": "boolean",
1108
+ "default": false
1109
+ }
1110
+ }
1111
+ },
1112
+ "tag": {
1113
+ "type": "object",
1114
+ "additionalProperties": false,
1115
+ "required": [
1116
+ "name"
1117
+ ],
1118
+ "properties": {
1119
+ "name": {
1120
+ "type": "string"
1121
+ },
1122
+ "description": {
1123
+ "type": "string"
1124
+ },
1125
+ "externalDocs": {
1126
+ "$ref": "#/definitions/externalDocs"
1127
+ }
1128
+ },
1129
+ "patternProperties": {
1130
+ "^x-": {
1131
+ "$ref": "#/definitions/vendorExtension"
1132
+ }
1133
+ }
1134
+ },
1135
+ "securityDefinitions": {
1136
+ "type": "object",
1137
+ "additionalProperties": {
1138
+ "oneOf": [
1139
+ {
1140
+ "$ref": "#/definitions/basicAuthenticationSecurity"
1141
+ },
1142
+ {
1143
+ "$ref": "#/definitions/apiKeySecurity"
1144
+ },
1145
+ {
1146
+ "$ref": "#/definitions/oauth2ImplicitSecurity"
1147
+ },
1148
+ {
1149
+ "$ref": "#/definitions/oauth2PasswordSecurity"
1150
+ },
1151
+ {
1152
+ "$ref": "#/definitions/oauth2ApplicationSecurity"
1153
+ },
1154
+ {
1155
+ "$ref": "#/definitions/oauth2AccessCodeSecurity"
1156
+ }
1157
+ ]
1158
+ }
1159
+ },
1160
+ "basicAuthenticationSecurity": {
1161
+ "type": "object",
1162
+ "additionalProperties": false,
1163
+ "required": [
1164
+ "type"
1165
+ ],
1166
+ "properties": {
1167
+ "type": {
1168
+ "type": "string",
1169
+ "enum": [
1170
+ "basic"
1171
+ ]
1172
+ },
1173
+ "description": {
1174
+ "type": "string"
1175
+ }
1176
+ },
1177
+ "patternProperties": {
1178
+ "^x-": {
1179
+ "$ref": "#/definitions/vendorExtension"
1180
+ }
1181
+ }
1182
+ },
1183
+ "apiKeySecurity": {
1184
+ "type": "object",
1185
+ "additionalProperties": false,
1186
+ "required": [
1187
+ "type",
1188
+ "name",
1189
+ "in"
1190
+ ],
1191
+ "properties": {
1192
+ "type": {
1193
+ "type": "string",
1194
+ "enum": [
1195
+ "apiKey"
1196
+ ]
1197
+ },
1198
+ "name": {
1199
+ "type": "string"
1200
+ },
1201
+ "in": {
1202
+ "type": "string",
1203
+ "enum": [
1204
+ "header",
1205
+ "query"
1206
+ ]
1207
+ },
1208
+ "description": {
1209
+ "type": "string"
1210
+ }
1211
+ },
1212
+ "patternProperties": {
1213
+ "^x-": {
1214
+ "$ref": "#/definitions/vendorExtension"
1215
+ }
1216
+ }
1217
+ },
1218
+ "oauth2ImplicitSecurity": {
1219
+ "type": "object",
1220
+ "additionalProperties": false,
1221
+ "required": [
1222
+ "type",
1223
+ "flow",
1224
+ "authorizationUrl"
1225
+ ],
1226
+ "properties": {
1227
+ "type": {
1228
+ "type": "string",
1229
+ "enum": [
1230
+ "oauth2"
1231
+ ]
1232
+ },
1233
+ "flow": {
1234
+ "type": "string",
1235
+ "enum": [
1236
+ "implicit"
1237
+ ]
1238
+ },
1239
+ "scopes": {
1240
+ "$ref": "#/definitions/oauth2Scopes"
1241
+ },
1242
+ "authorizationUrl": {
1243
+ "type": "string",
1244
+ "format": "uri"
1245
+ },
1246
+ "description": {
1247
+ "type": "string"
1248
+ }
1249
+ },
1250
+ "patternProperties": {
1251
+ "^x-": {
1252
+ "$ref": "#/definitions/vendorExtension"
1253
+ }
1254
+ }
1255
+ },
1256
+ "oauth2PasswordSecurity": {
1257
+ "type": "object",
1258
+ "additionalProperties": false,
1259
+ "required": [
1260
+ "type",
1261
+ "flow",
1262
+ "tokenUrl"
1263
+ ],
1264
+ "properties": {
1265
+ "type": {
1266
+ "type": "string",
1267
+ "enum": [
1268
+ "oauth2"
1269
+ ]
1270
+ },
1271
+ "flow": {
1272
+ "type": "string",
1273
+ "enum": [
1274
+ "password"
1275
+ ]
1276
+ },
1277
+ "scopes": {
1278
+ "$ref": "#/definitions/oauth2Scopes"
1279
+ },
1280
+ "tokenUrl": {
1281
+ "type": "string",
1282
+ "format": "uri"
1283
+ },
1284
+ "description": {
1285
+ "type": "string"
1286
+ }
1287
+ },
1288
+ "patternProperties": {
1289
+ "^x-": {
1290
+ "$ref": "#/definitions/vendorExtension"
1291
+ }
1292
+ }
1293
+ },
1294
+ "oauth2ApplicationSecurity": {
1295
+ "type": "object",
1296
+ "additionalProperties": false,
1297
+ "required": [
1298
+ "type",
1299
+ "flow",
1300
+ "tokenUrl"
1301
+ ],
1302
+ "properties": {
1303
+ "type": {
1304
+ "type": "string",
1305
+ "enum": [
1306
+ "oauth2"
1307
+ ]
1308
+ },
1309
+ "flow": {
1310
+ "type": "string",
1311
+ "enum": [
1312
+ "application"
1313
+ ]
1314
+ },
1315
+ "scopes": {
1316
+ "$ref": "#/definitions/oauth2Scopes"
1317
+ },
1318
+ "tokenUrl": {
1319
+ "type": "string",
1320
+ "format": "uri"
1321
+ },
1322
+ "description": {
1323
+ "type": "string"
1324
+ }
1325
+ },
1326
+ "patternProperties": {
1327
+ "^x-": {
1328
+ "$ref": "#/definitions/vendorExtension"
1329
+ }
1330
+ }
1331
+ },
1332
+ "oauth2AccessCodeSecurity": {
1333
+ "type": "object",
1334
+ "additionalProperties": false,
1335
+ "required": [
1336
+ "type",
1337
+ "flow",
1338
+ "authorizationUrl",
1339
+ "tokenUrl"
1340
+ ],
1341
+ "properties": {
1342
+ "type": {
1343
+ "type": "string",
1344
+ "enum": [
1345
+ "oauth2"
1346
+ ]
1347
+ },
1348
+ "flow": {
1349
+ "type": "string",
1350
+ "enum": [
1351
+ "accessCode"
1352
+ ]
1353
+ },
1354
+ "scopes": {
1355
+ "$ref": "#/definitions/oauth2Scopes"
1356
+ },
1357
+ "authorizationUrl": {
1358
+ "type": "string",
1359
+ "format": "uri"
1360
+ },
1361
+ "tokenUrl": {
1362
+ "type": "string",
1363
+ "format": "uri"
1364
+ },
1365
+ "description": {
1366
+ "type": "string"
1367
+ }
1368
+ },
1369
+ "patternProperties": {
1370
+ "^x-": {
1371
+ "$ref": "#/definitions/vendorExtension"
1372
+ }
1373
+ }
1374
+ },
1375
+ "oauth2Scopes": {
1376
+ "type": "object",
1377
+ "additionalProperties": {
1378
+ "type": "string"
1379
+ }
1380
+ },
1381
+ "mediaTypeList": {
1382
+ "type": "array",
1383
+ "items": {
1384
+ "$ref": "#/definitions/mimeType"
1385
+ },
1386
+ "uniqueItems": true
1387
+ },
1388
+ "parametersList": {
1389
+ "type": "array",
1390
+ "description": "The parameters needed to send a valid API call.",
1391
+ "additionalItems": false,
1392
+ "items": {
1393
+ "oneOf": [
1394
+ {
1395
+ "$ref": "#/definitions/parameter"
1396
+ },
1397
+ {
1398
+ "$ref": "#/definitions/jsonReference"
1399
+ }
1400
+ ]
1401
+ },
1402
+ "uniqueItems": true
1403
+ },
1404
+ "schemesList": {
1405
+ "type": "array",
1406
+ "description": "The transfer protocol of the API.",
1407
+ "items": {
1408
+ "type": "string",
1409
+ "enum": [
1410
+ "http",
1411
+ "https",
1412
+ "ws",
1413
+ "wss"
1414
+ ]
1415
+ },
1416
+ "uniqueItems": true
1417
+ },
1418
+ "collectionFormat": {
1419
+ "type": "string",
1420
+ "enum": [
1421
+ "csv",
1422
+ "ssv",
1423
+ "tsv",
1424
+ "pipes"
1425
+ ],
1426
+ "default": "csv"
1427
+ },
1428
+ "collectionFormatWithMulti": {
1429
+ "type": "string",
1430
+ "enum": [
1431
+ "csv",
1432
+ "ssv",
1433
+ "tsv",
1434
+ "pipes",
1435
+ "multi"
1436
+ ],
1437
+ "default": "csv"
1438
+ },
1439
+ "title": {
1440
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
1441
+ },
1442
+ "description": {
1443
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
1444
+ },
1445
+ "default": {
1446
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
1447
+ },
1448
+ "multipleOf": {
1449
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
1450
+ },
1451
+ "maximum": {
1452
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
1453
+ },
1454
+ "exclusiveMaximum": {
1455
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
1456
+ },
1457
+ "minimum": {
1458
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
1459
+ },
1460
+ "exclusiveMinimum": {
1461
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
1462
+ },
1463
+ "maxLength": {
1464
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
1465
+ },
1466
+ "minLength": {
1467
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
1468
+ },
1469
+ "pattern": {
1470
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
1471
+ },
1472
+ "maxItems": {
1473
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
1474
+ },
1475
+ "minItems": {
1476
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
1477
+ },
1478
+ "uniqueItems": {
1479
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
1480
+ },
1481
+ "enum": {
1482
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
1483
+ },
1484
+ "jsonReference": {
1485
+ "type": "object",
1486
+ "additionalProperties": false,
1487
+ "properties": {
1488
+ "$ref": {
1489
+ "type": "string"
1490
+ }
1491
+ }
1492
+ }
1493
+ }
1494
+ }