swagger-diff 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ module Swagger
4
4
  def initialize(spec)
5
5
  @spec = spec
6
6
  @parsed = parse_swagger(spec)
7
+ validate_swagger
7
8
  @endpoint_hash = parsed_to_hash(@parsed)
8
9
  end
9
10
 
@@ -44,16 +45,16 @@ module Swagger
44
45
  end
45
46
 
46
47
  def params_or_nil(endpoint)
47
- endpoint && endpoint.parameters || nil
48
+ endpoint && endpoint['parameters'] || nil
48
49
  end
49
50
 
50
51
  def parse_swagger(swagger)
51
52
  if swagger.is_a? Hash
52
- Swagger.build(swagger)
53
- elsif File.exist?(swagger)
54
- Swagger.load(swagger)
53
+ swagger
55
54
  else
56
- swagger = open(swagger).read if swagger[0..7] =~ %r{^https?://}
55
+ if File.exist?(swagger) || swagger[0..7] =~ %r{^https?://}
56
+ swagger = open(swagger).read
57
+ end
57
58
  begin
58
59
  JSON.parse(swagger)
59
60
  rescue JSON::ParserError
@@ -61,19 +62,27 @@ module Swagger
61
62
  YAML.load(swagger)
62
63
  rescue Psych::SyntaxError
63
64
  raise 'Only filenames or raw or parsed strings of JSON or YAML are supported.'
64
- else
65
- Swagger.build(swagger, format: :yaml)
66
65
  end
67
- else
68
- Swagger.build(swagger, format: :json)
69
66
  end
70
67
  end
71
68
  end
72
69
 
73
70
  def parsed_to_hash(parsed)
74
71
  ret = {}
75
- parsed.operations.each do |endpoint|
76
- ret["#{endpoint.verb} #{endpoint.path.gsub(/{.*?}/, '{}')}"] = endpoint
72
+ verbs = Set['get', 'put', 'post', 'delete', 'options', 'head', 'patch']
73
+ parsed['paths'].each do |path, items|
74
+ # TODO: this doesn't handle external definitions ($ref).
75
+ warn 'External definitions are not (yet) supported' if items.key?('$ref')
76
+ (verbs & items.keys).each do |verb|
77
+ if items['parameters']
78
+ if items[verb]['parameters']
79
+ items[verb]['parameters'].concat(items['parameters'])
80
+ else
81
+ items[verb]['parameters'] = items['parameters']
82
+ end
83
+ end
84
+ ret["#{verb} #{path.gsub(/{.*?}/, '{}')}"] = items[verb]
85
+ end
77
86
  end
78
87
  ret
79
88
  end
@@ -84,9 +93,19 @@ module Swagger
84
93
  # parameter definitions (i.e., all parameters, including nested
85
94
  # parameters, are included in a single set).
86
95
  def refs(ref, prefix = '')
96
+ defs = if ref[0..12] == '#/parameters/'
97
+ @parsed['parameters']
98
+ elsif ref[0..11] == '#/responses/'
99
+ @parsed['responses']
100
+ elsif ref[0..13] == '#/definitions/'
101
+ @parsed['definitions']
102
+ else
103
+ warn "Unsupported ref '#{ref}' (expected definitions, parameters, or responses)"
104
+ {}
105
+ end
87
106
  idx = ref.rindex('/')
88
107
  key = ref[idx + 1..-1]
89
- schema(@parsed.definitions[key], prefix)
108
+ schema(defs.fetch(key, {}), prefix)
90
109
  end
91
110
 
92
111
  def all_of!(definitions, prefix, ret)
@@ -101,26 +120,35 @@ module Swagger
101
120
  end
102
121
 
103
122
  def array?(definition)
104
- definition.type && definition.type == 'array' && definition.items
123
+ definition['type'] && definition['type'] == 'array' && definition['items']
105
124
  end
106
125
 
126
+ # rubocop:disable Metrics/AbcSize
127
+ # rubocop:disable Metrics/CyclomaticComplexity
107
128
  def schema(definition, prefix = '')
108
129
  ret = { required: Set.new, all: Set.new }
109
- if definition.allOf
110
- all_of!(definition.allOf, prefix, ret)
130
+ if definition['allOf']
131
+ all_of!(definition['allOf'], prefix, ret)
111
132
  elsif definition['$ref']
112
133
  merge_refs!(ret, refs(definition['$ref'], prefix))
113
- elsif definition.properties
134
+ elsif definition['properties']
114
135
  merge_refs!(ret,
115
- properties(definition.properties,
116
- definition.required, prefix))
136
+ properties(definition['properties'],
137
+ definition['required'], prefix))
117
138
  elsif array?(definition)
118
- merge_refs!(ret, schema(definition.items, "#{prefix}[]/"))
119
- elsif definition.type == 'object'
139
+ merge_refs!(ret, schema(definition['items'], "#{prefix}[]/"))
140
+ elsif definition['type'] == 'object'
120
141
  ret[:all].add(hash_property(definition, prefix))
142
+ elsif definition['in']
143
+ merge_refs!(ret,
144
+ properties_for_param(prefix, definition))
145
+ elsif definition['schema']
146
+ merge_refs!(ret, schema(definition['schema']))
121
147
  end
122
148
  ret
123
149
  end
150
+ # rubocop:enable Metrics/CyclomaticComplexity
151
+ # rubocop:enable Metrics/AbcSize
124
152
 
125
153
  def nested(ref, prefix, name, list = false)
126
154
  # Check for cycles by testing whether name was already added to
@@ -135,6 +163,15 @@ module Swagger
135
163
  end
136
164
  end
137
165
 
166
+ def properties_for_param(prefix, definition)
167
+ required = if definition['required']
168
+ [definition['name']]
169
+ else
170
+ []
171
+ end
172
+ properties_for_ref(prefix, definition['name'], definition, required)
173
+ end
174
+
138
175
  def properties_for_ref(prefix, name, schema, required, list = false)
139
176
  key = "#{prefix}#{name}"
140
177
  ret = { required: Set.new, all: Set.new }
@@ -142,7 +179,12 @@ module Swagger
142
179
  merge_refs!(ret, nested(schema['$ref'], prefix, name, list))
143
180
  else
144
181
  ret[:required].add(key) if required && required.include?(name)
145
- ret[:all].add("#{key} (in: body, type: #{schema.type}#{'[]' if list})")
182
+ loc = if schema['in']
183
+ schema['in']
184
+ else
185
+ 'body'
186
+ end
187
+ ret[:all].add("#{key} (in: #{loc}, type: #{schema['type']}#{'[]' if list})")
146
188
  end
147
189
  ret
148
190
  end
@@ -160,9 +202,9 @@ module Swagger
160
202
  else
161
203
  "#{prefix}#{name}"
162
204
  end
163
- type = if definition.additionalProperties &&
164
- definition.additionalProperties.type
165
- definition.additionalProperties.type
205
+ type = if definition['additionalProperties'] &&
206
+ definition['additionalProperties']['type']
207
+ definition['additionalProperties']['type']
166
208
  else
167
209
  '*'
168
210
  end
@@ -172,10 +214,10 @@ module Swagger
172
214
  def properties(properties, required, prefix = '')
173
215
  ret = { required: Set.new, all: Set.new }
174
216
  properties.each do |name, schema|
175
- if schema.type == 'array'
176
- merge_refs!(ret, properties_for_ref(prefix, name, schema.items, required, true))
177
- elsif schema.type == 'object'
178
- if schema.allOf
217
+ if schema['type'] == 'array'
218
+ merge_refs!(ret, properties_for_ref(prefix, name, schema['items'], required, true))
219
+ elsif schema['type'] == 'object'
220
+ if schema['allOf']
179
221
  # TODO: handle nested allOfs.
180
222
  else
181
223
  ret[:all].add(hash_property(schema, prefix, name))
@@ -191,11 +233,13 @@ module Swagger
191
233
  ret = { required: Set.new, all: Set.new }
192
234
  return ret if params.nil?
193
235
  params.each do |param|
194
- if param.in == 'body'
195
- merge_refs!(ret, schema(param.schema))
236
+ if param['in'] == 'body'
237
+ merge_refs!(ret, schema(param['schema']))
238
+ elsif param['$ref']
239
+ merge_refs!(ret, schema(param))
196
240
  else
197
- ret[:required].add(param.name) if param.required
198
- ret[:all].add("#{param.name} (in: #{param.in}, type: #{param.type})")
241
+ ret[:required].add(param['name']) if param['required']
242
+ ret[:all].add("#{param['name']} (in: #{param['in']}, type: #{param['type']})")
199
243
  end
200
244
  end
201
245
  ret
@@ -203,15 +247,43 @@ module Swagger
203
247
 
204
248
  def response_attributes_inner(endpoint)
205
249
  ret = {}
206
- endpoint.responses.each do |code, response|
207
- if response.schema
208
- ret[code] = schema(response.schema)[:all]
209
- else
210
- ret[code] = Set.new
211
- end
250
+ endpoint['responses'].each do |code, response|
251
+ ret[code] = if response['schema']
252
+ schema(response['schema'])[:all]
253
+ elsif response['$ref']
254
+ schema(response)[:all]
255
+ else
256
+ Set.new
257
+ end
212
258
  end
213
259
  ret
214
260
  end
261
+
262
+ def schema_for(type)
263
+ File.join(
264
+ File.expand_path(File.join('..', '..', '..', '..'), __FILE__),
265
+ 'schema', type, 'schema.json'
266
+ )
267
+ end
268
+
269
+ def validate_swagger
270
+ json_schema = File.open(schema_for('json')) do |json_schema_file|
271
+ JSON::Schema.new(
272
+ JSON.parse(json_schema_file.read),
273
+ Addressable::URI.parse('http://json-schema.org/draft-04/schema#')
274
+ )
275
+ end
276
+ JSON::Validator.add_schema(json_schema)
277
+ errors = JSON::Validator.fully_validate(schema_for('oai'), JSON.dump(@parsed))
278
+ unless errors.empty?
279
+ spec = if @spec.to_s.length > 80
280
+ "#{@spec.to_s[0..74]} ..."
281
+ else
282
+ @spec
283
+ end
284
+ warn "#{spec} is not a valid Swagger specification:\n\n#{errors.join("\n")}"
285
+ end
286
+ end
215
287
  end
216
288
  end
217
289
  end
@@ -1,5 +1,5 @@
1
1
  module Swagger
2
2
  module Diff
3
- VERSION = '1.0.5'
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2016 IETF Trust and the persons identified as authors of the code.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of Internet Society, IETF or IETF Trust, nor the names of
13
+ specific contributors, may be used to endorse or promote products derived
14
+ from this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,150 @@
1
+ {
2
+ "id": "http://json-schema.org/draft-04/schema#",
3
+ "$schema": "http://json-schema.org/draft-04/schema#",
4
+ "description": "Core schema meta-schema",
5
+ "definitions": {
6
+ "schemaArray": {
7
+ "type": "array",
8
+ "minItems": 1,
9
+ "items": { "$ref": "#" }
10
+ },
11
+ "positiveInteger": {
12
+ "type": "integer",
13
+ "minimum": 0
14
+ },
15
+ "positiveIntegerDefault0": {
16
+ "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
17
+ },
18
+ "simpleTypes": {
19
+ "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
20
+ },
21
+ "stringArray": {
22
+ "type": "array",
23
+ "items": { "type": "string" },
24
+ "minItems": 1,
25
+ "uniqueItems": true
26
+ }
27
+ },
28
+ "type": "object",
29
+ "properties": {
30
+ "id": {
31
+ "type": "string",
32
+ "format": "uri"
33
+ },
34
+ "$schema": {
35
+ "type": "string",
36
+ "format": "uri"
37
+ },
38
+ "title": {
39
+ "type": "string"
40
+ },
41
+ "description": {
42
+ "type": "string"
43
+ },
44
+ "default": {},
45
+ "multipleOf": {
46
+ "type": "number",
47
+ "minimum": 0,
48
+ "exclusiveMinimum": true
49
+ },
50
+ "maximum": {
51
+ "type": "number"
52
+ },
53
+ "exclusiveMaximum": {
54
+ "type": "boolean",
55
+ "default": false
56
+ },
57
+ "minimum": {
58
+ "type": "number"
59
+ },
60
+ "exclusiveMinimum": {
61
+ "type": "boolean",
62
+ "default": false
63
+ },
64
+ "maxLength": { "$ref": "#/definitions/positiveInteger" },
65
+ "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
66
+ "pattern": {
67
+ "type": "string",
68
+ "format": "regex"
69
+ },
70
+ "additionalItems": {
71
+ "anyOf": [
72
+ { "type": "boolean" },
73
+ { "$ref": "#" }
74
+ ],
75
+ "default": {}
76
+ },
77
+ "items": {
78
+ "anyOf": [
79
+ { "$ref": "#" },
80
+ { "$ref": "#/definitions/schemaArray" }
81
+ ],
82
+ "default": {}
83
+ },
84
+ "maxItems": { "$ref": "#/definitions/positiveInteger" },
85
+ "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
86
+ "uniqueItems": {
87
+ "type": "boolean",
88
+ "default": false
89
+ },
90
+ "maxProperties": { "$ref": "#/definitions/positiveInteger" },
91
+ "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
92
+ "required": { "$ref": "#/definitions/stringArray" },
93
+ "additionalProperties": {
94
+ "anyOf": [
95
+ { "type": "boolean" },
96
+ { "$ref": "#" }
97
+ ],
98
+ "default": {}
99
+ },
100
+ "definitions": {
101
+ "type": "object",
102
+ "additionalProperties": { "$ref": "#" },
103
+ "default": {}
104
+ },
105
+ "properties": {
106
+ "type": "object",
107
+ "additionalProperties": { "$ref": "#" },
108
+ "default": {}
109
+ },
110
+ "patternProperties": {
111
+ "type": "object",
112
+ "additionalProperties": { "$ref": "#" },
113
+ "default": {}
114
+ },
115
+ "dependencies": {
116
+ "type": "object",
117
+ "additionalProperties": {
118
+ "anyOf": [
119
+ { "$ref": "#" },
120
+ { "$ref": "#/definitions/stringArray" }
121
+ ]
122
+ }
123
+ },
124
+ "enum": {
125
+ "type": "array",
126
+ "minItems": 1,
127
+ "uniqueItems": true
128
+ },
129
+ "type": {
130
+ "anyOf": [
131
+ { "$ref": "#/definitions/simpleTypes" },
132
+ {
133
+ "type": "array",
134
+ "items": { "$ref": "#/definitions/simpleTypes" },
135
+ "minItems": 1,
136
+ "uniqueItems": true
137
+ }
138
+ ]
139
+ },
140
+ "allOf": { "$ref": "#/definitions/schemaArray" },
141
+ "anyOf": { "$ref": "#/definitions/schemaArray" },
142
+ "oneOf": { "$ref": "#/definitions/schemaArray" },
143
+ "not": { "$ref": "#" }
144
+ },
145
+ "dependencies": {
146
+ "exclusiveMaximum": [ "maximum" ],
147
+ "exclusiveMinimum": [ "minimum" ]
148
+ },
149
+ "default": {}
150
+ }
@@ -0,0 +1,11 @@
1
+ Copyright 2016 The Linux Foundation
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
@@ -0,0 +1,1607 @@
1
+ {
2
+ "title": "A JSON Schema for Swagger 2.0 API.",
3
+ "id": "http://swagger.io/v2/schema.json#",
4
+ "$schema": "http://json-schema.org/draft-04/schema#",
5
+ "type": "object",
6
+ "required": [
7
+ "swagger",
8
+ "info",
9
+ "paths"
10
+ ],
11
+ "additionalProperties": false,
12
+ "patternProperties": {
13
+ "^x-": {
14
+ "$ref": "#/definitions/vendorExtension"
15
+ }
16
+ },
17
+ "properties": {
18
+ "swagger": {
19
+ "type": "string",
20
+ "enum": [
21
+ "2.0"
22
+ ],
23
+ "description": "The Swagger version of this document."
24
+ },
25
+ "info": {
26
+ "$ref": "#/definitions/info"
27
+ },
28
+ "host": {
29
+ "type": "string",
30
+ "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
31
+ "description": "The host (name or ip) of the API. Example: 'swagger.io'"
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
+ "allOf": [
44
+ {
45
+ "$ref": "#/definitions/mediaTypeList"
46
+ }
47
+ ]
48
+ },
49
+ "produces": {
50
+ "description": "A list of MIME types the API can produce.",
51
+ "allOf": [
52
+ {
53
+ "$ref": "#/definitions/mediaTypeList"
54
+ }
55
+ ]
56
+ },
57
+ "paths": {
58
+ "$ref": "#/definitions/paths"
59
+ },
60
+ "definitions": {
61
+ "$ref": "#/definitions/definitions"
62
+ },
63
+ "parameters": {
64
+ "$ref": "#/definitions/parameterDefinitions"
65
+ },
66
+ "responses": {
67
+ "$ref": "#/definitions/responseDefinitions"
68
+ },
69
+ "security": {
70
+ "$ref": "#/definitions/security"
71
+ },
72
+ "securityDefinitions": {
73
+ "$ref": "#/definitions/securityDefinitions"
74
+ },
75
+ "tags": {
76
+ "type": "array",
77
+ "items": {
78
+ "$ref": "#/definitions/tag"
79
+ },
80
+ "uniqueItems": true
81
+ },
82
+ "externalDocs": {
83
+ "$ref": "#/definitions/externalDocs"
84
+ }
85
+ },
86
+ "definitions": {
87
+ "info": {
88
+ "type": "object",
89
+ "description": "General information about the API.",
90
+ "required": [
91
+ "version",
92
+ "title"
93
+ ],
94
+ "additionalProperties": false,
95
+ "patternProperties": {
96
+ "^x-": {
97
+ "$ref": "#/definitions/vendorExtension"
98
+ }
99
+ },
100
+ "properties": {
101
+ "title": {
102
+ "type": "string",
103
+ "description": "A unique and precise title of the API."
104
+ },
105
+ "version": {
106
+ "type": "string",
107
+ "description": "A semantic version number of the API."
108
+ },
109
+ "description": {
110
+ "type": "string",
111
+ "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
112
+ },
113
+ "termsOfService": {
114
+ "type": "string",
115
+ "description": "The terms of service for the API."
116
+ },
117
+ "contact": {
118
+ "$ref": "#/definitions/contact"
119
+ },
120
+ "license": {
121
+ "$ref": "#/definitions/license"
122
+ }
123
+ }
124
+ },
125
+ "contact": {
126
+ "type": "object",
127
+ "description": "Contact information for the owners of the API.",
128
+ "additionalProperties": false,
129
+ "properties": {
130
+ "name": {
131
+ "type": "string",
132
+ "description": "The identifying name of the contact person/organization."
133
+ },
134
+ "url": {
135
+ "type": "string",
136
+ "description": "The URL pointing to the contact information.",
137
+ "format": "uri"
138
+ },
139
+ "email": {
140
+ "type": "string",
141
+ "description": "The email address of the contact person/organization.",
142
+ "format": "email"
143
+ }
144
+ },
145
+ "patternProperties": {
146
+ "^x-": {
147
+ "$ref": "#/definitions/vendorExtension"
148
+ }
149
+ }
150
+ },
151
+ "license": {
152
+ "type": "object",
153
+ "required": [
154
+ "name"
155
+ ],
156
+ "additionalProperties": false,
157
+ "properties": {
158
+ "name": {
159
+ "type": "string",
160
+ "description": "The name of the license type. It's encouraged to use an OSI compatible license."
161
+ },
162
+ "url": {
163
+ "type": "string",
164
+ "description": "The URL pointing to the license.",
165
+ "format": "uri"
166
+ }
167
+ },
168
+ "patternProperties": {
169
+ "^x-": {
170
+ "$ref": "#/definitions/vendorExtension"
171
+ }
172
+ }
173
+ },
174
+ "paths": {
175
+ "type": "object",
176
+ "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
177
+ "patternProperties": {
178
+ "^x-": {
179
+ "$ref": "#/definitions/vendorExtension"
180
+ },
181
+ "^/": {
182
+ "$ref": "#/definitions/pathItem"
183
+ }
184
+ },
185
+ "additionalProperties": false
186
+ },
187
+ "definitions": {
188
+ "type": "object",
189
+ "additionalProperties": {
190
+ "$ref": "#/definitions/schema"
191
+ },
192
+ "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
193
+ },
194
+ "parameterDefinitions": {
195
+ "type": "object",
196
+ "additionalProperties": {
197
+ "$ref": "#/definitions/parameter"
198
+ },
199
+ "description": "One or more JSON representations for parameters"
200
+ },
201
+ "responseDefinitions": {
202
+ "type": "object",
203
+ "additionalProperties": {
204
+ "$ref": "#/definitions/response"
205
+ },
206
+ "description": "One or more JSON representations for parameters"
207
+ },
208
+ "externalDocs": {
209
+ "type": "object",
210
+ "additionalProperties": false,
211
+ "description": "information about external documentation",
212
+ "required": [
213
+ "url"
214
+ ],
215
+ "properties": {
216
+ "description": {
217
+ "type": "string"
218
+ },
219
+ "url": {
220
+ "type": "string",
221
+ "format": "uri"
222
+ }
223
+ },
224
+ "patternProperties": {
225
+ "^x-": {
226
+ "$ref": "#/definitions/vendorExtension"
227
+ }
228
+ }
229
+ },
230
+ "examples": {
231
+ "type": "object",
232
+ "additionalProperties": true
233
+ },
234
+ "mimeType": {
235
+ "type": "string",
236
+ "description": "The MIME type of the HTTP message."
237
+ },
238
+ "operation": {
239
+ "type": "object",
240
+ "required": [
241
+ "responses"
242
+ ],
243
+ "additionalProperties": false,
244
+ "patternProperties": {
245
+ "^x-": {
246
+ "$ref": "#/definitions/vendorExtension"
247
+ }
248
+ },
249
+ "properties": {
250
+ "tags": {
251
+ "type": "array",
252
+ "items": {
253
+ "type": "string"
254
+ },
255
+ "uniqueItems": true
256
+ },
257
+ "summary": {
258
+ "type": "string",
259
+ "description": "A brief summary of the operation."
260
+ },
261
+ "description": {
262
+ "type": "string",
263
+ "description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
264
+ },
265
+ "externalDocs": {
266
+ "$ref": "#/definitions/externalDocs"
267
+ },
268
+ "operationId": {
269
+ "type": "string",
270
+ "description": "A unique identifier of the operation."
271
+ },
272
+ "produces": {
273
+ "description": "A list of MIME types the API can produce.",
274
+ "allOf": [
275
+ {
276
+ "$ref": "#/definitions/mediaTypeList"
277
+ }
278
+ ]
279
+ },
280
+ "consumes": {
281
+ "description": "A list of MIME types the API can consume.",
282
+ "allOf": [
283
+ {
284
+ "$ref": "#/definitions/mediaTypeList"
285
+ }
286
+ ]
287
+ },
288
+ "parameters": {
289
+ "$ref": "#/definitions/parametersList"
290
+ },
291
+ "responses": {
292
+ "$ref": "#/definitions/responses"
293
+ },
294
+ "schemes": {
295
+ "$ref": "#/definitions/schemesList"
296
+ },
297
+ "deprecated": {
298
+ "type": "boolean",
299
+ "default": false
300
+ },
301
+ "security": {
302
+ "$ref": "#/definitions/security"
303
+ }
304
+ }
305
+ },
306
+ "pathItem": {
307
+ "type": "object",
308
+ "additionalProperties": false,
309
+ "patternProperties": {
310
+ "^x-": {
311
+ "$ref": "#/definitions/vendorExtension"
312
+ }
313
+ },
314
+ "properties": {
315
+ "$ref": {
316
+ "type": "string"
317
+ },
318
+ "get": {
319
+ "$ref": "#/definitions/operation"
320
+ },
321
+ "put": {
322
+ "$ref": "#/definitions/operation"
323
+ },
324
+ "post": {
325
+ "$ref": "#/definitions/operation"
326
+ },
327
+ "delete": {
328
+ "$ref": "#/definitions/operation"
329
+ },
330
+ "options": {
331
+ "$ref": "#/definitions/operation"
332
+ },
333
+ "head": {
334
+ "$ref": "#/definitions/operation"
335
+ },
336
+ "patch": {
337
+ "$ref": "#/definitions/operation"
338
+ },
339
+ "parameters": {
340
+ "$ref": "#/definitions/parametersList"
341
+ }
342
+ }
343
+ },
344
+ "responses": {
345
+ "type": "object",
346
+ "description": "Response objects names can either be any valid HTTP status code or 'default'.",
347
+ "minProperties": 1,
348
+ "additionalProperties": false,
349
+ "patternProperties": {
350
+ "^([0-9]{3})$|^(default)$": {
351
+ "$ref": "#/definitions/responseValue"
352
+ },
353
+ "^x-": {
354
+ "$ref": "#/definitions/vendorExtension"
355
+ }
356
+ },
357
+ "not": {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "patternProperties": {
361
+ "^x-": {
362
+ "$ref": "#/definitions/vendorExtension"
363
+ }
364
+ }
365
+ }
366
+ },
367
+ "responseValue": {
368
+ "oneOf": [
369
+ {
370
+ "$ref": "#/definitions/response"
371
+ },
372
+ {
373
+ "$ref": "#/definitions/jsonReference"
374
+ }
375
+ ]
376
+ },
377
+ "response": {
378
+ "type": "object",
379
+ "required": [
380
+ "description"
381
+ ],
382
+ "properties": {
383
+ "description": {
384
+ "type": "string"
385
+ },
386
+ "schema": {
387
+ "oneOf": [
388
+ {
389
+ "$ref": "#/definitions/schema"
390
+ },
391
+ {
392
+ "$ref": "#/definitions/fileSchema"
393
+ }
394
+ ]
395
+ },
396
+ "headers": {
397
+ "$ref": "#/definitions/headers"
398
+ },
399
+ "examples": {
400
+ "$ref": "#/definitions/examples"
401
+ }
402
+ },
403
+ "additionalProperties": false,
404
+ "patternProperties": {
405
+ "^x-": {
406
+ "$ref": "#/definitions/vendorExtension"
407
+ }
408
+ }
409
+ },
410
+ "headers": {
411
+ "type": "object",
412
+ "additionalProperties": {
413
+ "$ref": "#/definitions/header"
414
+ }
415
+ },
416
+ "header": {
417
+ "type": "object",
418
+ "additionalProperties": false,
419
+ "required": [
420
+ "type"
421
+ ],
422
+ "properties": {
423
+ "type": {
424
+ "type": "string",
425
+ "enum": [
426
+ "string",
427
+ "number",
428
+ "integer",
429
+ "boolean",
430
+ "array"
431
+ ]
432
+ },
433
+ "format": {
434
+ "type": "string"
435
+ },
436
+ "items": {
437
+ "$ref": "#/definitions/primitivesItems"
438
+ },
439
+ "collectionFormat": {
440
+ "$ref": "#/definitions/collectionFormat"
441
+ },
442
+ "default": {
443
+ "$ref": "#/definitions/default"
444
+ },
445
+ "maximum": {
446
+ "$ref": "#/definitions/maximum"
447
+ },
448
+ "exclusiveMaximum": {
449
+ "$ref": "#/definitions/exclusiveMaximum"
450
+ },
451
+ "minimum": {
452
+ "$ref": "#/definitions/minimum"
453
+ },
454
+ "exclusiveMinimum": {
455
+ "$ref": "#/definitions/exclusiveMinimum"
456
+ },
457
+ "maxLength": {
458
+ "$ref": "#/definitions/maxLength"
459
+ },
460
+ "minLength": {
461
+ "$ref": "#/definitions/minLength"
462
+ },
463
+ "pattern": {
464
+ "$ref": "#/definitions/pattern"
465
+ },
466
+ "maxItems": {
467
+ "$ref": "#/definitions/maxItems"
468
+ },
469
+ "minItems": {
470
+ "$ref": "#/definitions/minItems"
471
+ },
472
+ "uniqueItems": {
473
+ "$ref": "#/definitions/uniqueItems"
474
+ },
475
+ "enum": {
476
+ "$ref": "#/definitions/enum"
477
+ },
478
+ "multipleOf": {
479
+ "$ref": "#/definitions/multipleOf"
480
+ },
481
+ "description": {
482
+ "type": "string"
483
+ }
484
+ },
485
+ "patternProperties": {
486
+ "^x-": {
487
+ "$ref": "#/definitions/vendorExtension"
488
+ }
489
+ }
490
+ },
491
+ "vendorExtension": {
492
+ "description": "Any property starting with x- is valid.",
493
+ "additionalProperties": true,
494
+ "additionalItems": true
495
+ },
496
+ "bodyParameter": {
497
+ "type": "object",
498
+ "required": [
499
+ "name",
500
+ "in",
501
+ "schema"
502
+ ],
503
+ "patternProperties": {
504
+ "^x-": {
505
+ "$ref": "#/definitions/vendorExtension"
506
+ }
507
+ },
508
+ "properties": {
509
+ "description": {
510
+ "type": "string",
511
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
512
+ },
513
+ "name": {
514
+ "type": "string",
515
+ "description": "The name of the parameter."
516
+ },
517
+ "in": {
518
+ "type": "string",
519
+ "description": "Determines the location of the parameter.",
520
+ "enum": [
521
+ "body"
522
+ ]
523
+ },
524
+ "required": {
525
+ "type": "boolean",
526
+ "description": "Determines whether or not this parameter is required or optional.",
527
+ "default": false
528
+ },
529
+ "schema": {
530
+ "$ref": "#/definitions/schema"
531
+ }
532
+ },
533
+ "additionalProperties": false
534
+ },
535
+ "headerParameterSubSchema": {
536
+ "additionalProperties": false,
537
+ "patternProperties": {
538
+ "^x-": {
539
+ "$ref": "#/definitions/vendorExtension"
540
+ }
541
+ },
542
+ "properties": {
543
+ "required": {
544
+ "type": "boolean",
545
+ "description": "Determines whether or not this parameter is required or optional.",
546
+ "default": false
547
+ },
548
+ "in": {
549
+ "type": "string",
550
+ "description": "Determines the location of the parameter.",
551
+ "enum": [
552
+ "header"
553
+ ]
554
+ },
555
+ "description": {
556
+ "type": "string",
557
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
558
+ },
559
+ "name": {
560
+ "type": "string",
561
+ "description": "The name of the parameter."
562
+ },
563
+ "type": {
564
+ "type": "string",
565
+ "enum": [
566
+ "string",
567
+ "number",
568
+ "boolean",
569
+ "integer",
570
+ "array"
571
+ ]
572
+ },
573
+ "format": {
574
+ "type": "string"
575
+ },
576
+ "items": {
577
+ "$ref": "#/definitions/primitivesItems"
578
+ },
579
+ "collectionFormat": {
580
+ "$ref": "#/definitions/collectionFormat"
581
+ },
582
+ "default": {
583
+ "$ref": "#/definitions/default"
584
+ },
585
+ "maximum": {
586
+ "$ref": "#/definitions/maximum"
587
+ },
588
+ "exclusiveMaximum": {
589
+ "$ref": "#/definitions/exclusiveMaximum"
590
+ },
591
+ "minimum": {
592
+ "$ref": "#/definitions/minimum"
593
+ },
594
+ "exclusiveMinimum": {
595
+ "$ref": "#/definitions/exclusiveMinimum"
596
+ },
597
+ "maxLength": {
598
+ "$ref": "#/definitions/maxLength"
599
+ },
600
+ "minLength": {
601
+ "$ref": "#/definitions/minLength"
602
+ },
603
+ "pattern": {
604
+ "$ref": "#/definitions/pattern"
605
+ },
606
+ "maxItems": {
607
+ "$ref": "#/definitions/maxItems"
608
+ },
609
+ "minItems": {
610
+ "$ref": "#/definitions/minItems"
611
+ },
612
+ "uniqueItems": {
613
+ "$ref": "#/definitions/uniqueItems"
614
+ },
615
+ "enum": {
616
+ "$ref": "#/definitions/enum"
617
+ },
618
+ "multipleOf": {
619
+ "$ref": "#/definitions/multipleOf"
620
+ }
621
+ }
622
+ },
623
+ "queryParameterSubSchema": {
624
+ "additionalProperties": false,
625
+ "patternProperties": {
626
+ "^x-": {
627
+ "$ref": "#/definitions/vendorExtension"
628
+ }
629
+ },
630
+ "properties": {
631
+ "required": {
632
+ "type": "boolean",
633
+ "description": "Determines whether or not this parameter is required or optional.",
634
+ "default": false
635
+ },
636
+ "in": {
637
+ "type": "string",
638
+ "description": "Determines the location of the parameter.",
639
+ "enum": [
640
+ "query"
641
+ ]
642
+ },
643
+ "description": {
644
+ "type": "string",
645
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
646
+ },
647
+ "name": {
648
+ "type": "string",
649
+ "description": "The name of the parameter."
650
+ },
651
+ "allowEmptyValue": {
652
+ "type": "boolean",
653
+ "default": false,
654
+ "description": "allows sending a parameter by name only or with an empty value."
655
+ },
656
+ "type": {
657
+ "type": "string",
658
+ "enum": [
659
+ "string",
660
+ "number",
661
+ "boolean",
662
+ "integer",
663
+ "array"
664
+ ]
665
+ },
666
+ "format": {
667
+ "type": "string"
668
+ },
669
+ "items": {
670
+ "$ref": "#/definitions/primitivesItems"
671
+ },
672
+ "collectionFormat": {
673
+ "$ref": "#/definitions/collectionFormatWithMulti"
674
+ },
675
+ "default": {
676
+ "$ref": "#/definitions/default"
677
+ },
678
+ "maximum": {
679
+ "$ref": "#/definitions/maximum"
680
+ },
681
+ "exclusiveMaximum": {
682
+ "$ref": "#/definitions/exclusiveMaximum"
683
+ },
684
+ "minimum": {
685
+ "$ref": "#/definitions/minimum"
686
+ },
687
+ "exclusiveMinimum": {
688
+ "$ref": "#/definitions/exclusiveMinimum"
689
+ },
690
+ "maxLength": {
691
+ "$ref": "#/definitions/maxLength"
692
+ },
693
+ "minLength": {
694
+ "$ref": "#/definitions/minLength"
695
+ },
696
+ "pattern": {
697
+ "$ref": "#/definitions/pattern"
698
+ },
699
+ "maxItems": {
700
+ "$ref": "#/definitions/maxItems"
701
+ },
702
+ "minItems": {
703
+ "$ref": "#/definitions/minItems"
704
+ },
705
+ "uniqueItems": {
706
+ "$ref": "#/definitions/uniqueItems"
707
+ },
708
+ "enum": {
709
+ "$ref": "#/definitions/enum"
710
+ },
711
+ "multipleOf": {
712
+ "$ref": "#/definitions/multipleOf"
713
+ }
714
+ }
715
+ },
716
+ "formDataParameterSubSchema": {
717
+ "additionalProperties": false,
718
+ "patternProperties": {
719
+ "^x-": {
720
+ "$ref": "#/definitions/vendorExtension"
721
+ }
722
+ },
723
+ "properties": {
724
+ "required": {
725
+ "type": "boolean",
726
+ "description": "Determines whether or not this parameter is required or optional.",
727
+ "default": false
728
+ },
729
+ "in": {
730
+ "type": "string",
731
+ "description": "Determines the location of the parameter.",
732
+ "enum": [
733
+ "formData"
734
+ ]
735
+ },
736
+ "description": {
737
+ "type": "string",
738
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
739
+ },
740
+ "name": {
741
+ "type": "string",
742
+ "description": "The name of the parameter."
743
+ },
744
+ "allowEmptyValue": {
745
+ "type": "boolean",
746
+ "default": false,
747
+ "description": "allows sending a parameter by name only or with an empty value."
748
+ },
749
+ "type": {
750
+ "type": "string",
751
+ "enum": [
752
+ "string",
753
+ "number",
754
+ "boolean",
755
+ "integer",
756
+ "array",
757
+ "file"
758
+ ]
759
+ },
760
+ "format": {
761
+ "type": "string"
762
+ },
763
+ "items": {
764
+ "$ref": "#/definitions/primitivesItems"
765
+ },
766
+ "collectionFormat": {
767
+ "$ref": "#/definitions/collectionFormatWithMulti"
768
+ },
769
+ "default": {
770
+ "$ref": "#/definitions/default"
771
+ },
772
+ "maximum": {
773
+ "$ref": "#/definitions/maximum"
774
+ },
775
+ "exclusiveMaximum": {
776
+ "$ref": "#/definitions/exclusiveMaximum"
777
+ },
778
+ "minimum": {
779
+ "$ref": "#/definitions/minimum"
780
+ },
781
+ "exclusiveMinimum": {
782
+ "$ref": "#/definitions/exclusiveMinimum"
783
+ },
784
+ "maxLength": {
785
+ "$ref": "#/definitions/maxLength"
786
+ },
787
+ "minLength": {
788
+ "$ref": "#/definitions/minLength"
789
+ },
790
+ "pattern": {
791
+ "$ref": "#/definitions/pattern"
792
+ },
793
+ "maxItems": {
794
+ "$ref": "#/definitions/maxItems"
795
+ },
796
+ "minItems": {
797
+ "$ref": "#/definitions/minItems"
798
+ },
799
+ "uniqueItems": {
800
+ "$ref": "#/definitions/uniqueItems"
801
+ },
802
+ "enum": {
803
+ "$ref": "#/definitions/enum"
804
+ },
805
+ "multipleOf": {
806
+ "$ref": "#/definitions/multipleOf"
807
+ }
808
+ }
809
+ },
810
+ "pathParameterSubSchema": {
811
+ "additionalProperties": false,
812
+ "patternProperties": {
813
+ "^x-": {
814
+ "$ref": "#/definitions/vendorExtension"
815
+ }
816
+ },
817
+ "required": [
818
+ "required"
819
+ ],
820
+ "properties": {
821
+ "required": {
822
+ "type": "boolean",
823
+ "enum": [
824
+ true
825
+ ],
826
+ "description": "Determines whether or not this parameter is required or optional."
827
+ },
828
+ "in": {
829
+ "type": "string",
830
+ "description": "Determines the location of the parameter.",
831
+ "enum": [
832
+ "path"
833
+ ]
834
+ },
835
+ "description": {
836
+ "type": "string",
837
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
838
+ },
839
+ "name": {
840
+ "type": "string",
841
+ "description": "The name of the parameter."
842
+ },
843
+ "type": {
844
+ "type": "string",
845
+ "enum": [
846
+ "string",
847
+ "number",
848
+ "boolean",
849
+ "integer",
850
+ "array"
851
+ ]
852
+ },
853
+ "format": {
854
+ "type": "string"
855
+ },
856
+ "items": {
857
+ "$ref": "#/definitions/primitivesItems"
858
+ },
859
+ "collectionFormat": {
860
+ "$ref": "#/definitions/collectionFormat"
861
+ },
862
+ "default": {
863
+ "$ref": "#/definitions/default"
864
+ },
865
+ "maximum": {
866
+ "$ref": "#/definitions/maximum"
867
+ },
868
+ "exclusiveMaximum": {
869
+ "$ref": "#/definitions/exclusiveMaximum"
870
+ },
871
+ "minimum": {
872
+ "$ref": "#/definitions/minimum"
873
+ },
874
+ "exclusiveMinimum": {
875
+ "$ref": "#/definitions/exclusiveMinimum"
876
+ },
877
+ "maxLength": {
878
+ "$ref": "#/definitions/maxLength"
879
+ },
880
+ "minLength": {
881
+ "$ref": "#/definitions/minLength"
882
+ },
883
+ "pattern": {
884
+ "$ref": "#/definitions/pattern"
885
+ },
886
+ "maxItems": {
887
+ "$ref": "#/definitions/maxItems"
888
+ },
889
+ "minItems": {
890
+ "$ref": "#/definitions/minItems"
891
+ },
892
+ "uniqueItems": {
893
+ "$ref": "#/definitions/uniqueItems"
894
+ },
895
+ "enum": {
896
+ "$ref": "#/definitions/enum"
897
+ },
898
+ "multipleOf": {
899
+ "$ref": "#/definitions/multipleOf"
900
+ }
901
+ }
902
+ },
903
+ "nonBodyParameter": {
904
+ "type": "object",
905
+ "required": [
906
+ "name",
907
+ "in",
908
+ "type"
909
+ ],
910
+ "oneOf": [
911
+ {
912
+ "$ref": "#/definitions/headerParameterSubSchema"
913
+ },
914
+ {
915
+ "$ref": "#/definitions/formDataParameterSubSchema"
916
+ },
917
+ {
918
+ "$ref": "#/definitions/queryParameterSubSchema"
919
+ },
920
+ {
921
+ "$ref": "#/definitions/pathParameterSubSchema"
922
+ }
923
+ ]
924
+ },
925
+ "parameter": {
926
+ "oneOf": [
927
+ {
928
+ "$ref": "#/definitions/bodyParameter"
929
+ },
930
+ {
931
+ "$ref": "#/definitions/nonBodyParameter"
932
+ }
933
+ ]
934
+ },
935
+ "schema": {
936
+ "type": "object",
937
+ "description": "A deterministic version of a JSON Schema object.",
938
+ "patternProperties": {
939
+ "^x-": {
940
+ "$ref": "#/definitions/vendorExtension"
941
+ }
942
+ },
943
+ "properties": {
944
+ "$ref": {
945
+ "type": "string"
946
+ },
947
+ "format": {
948
+ "type": "string"
949
+ },
950
+ "title": {
951
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
952
+ },
953
+ "description": {
954
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
955
+ },
956
+ "default": {
957
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
958
+ },
959
+ "multipleOf": {
960
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
961
+ },
962
+ "maximum": {
963
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
964
+ },
965
+ "exclusiveMaximum": {
966
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
967
+ },
968
+ "minimum": {
969
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
970
+ },
971
+ "exclusiveMinimum": {
972
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
973
+ },
974
+ "maxLength": {
975
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
976
+ },
977
+ "minLength": {
978
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
979
+ },
980
+ "pattern": {
981
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
982
+ },
983
+ "maxItems": {
984
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
985
+ },
986
+ "minItems": {
987
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
988
+ },
989
+ "uniqueItems": {
990
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
991
+ },
992
+ "maxProperties": {
993
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
994
+ },
995
+ "minProperties": {
996
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
997
+ },
998
+ "required": {
999
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
1000
+ },
1001
+ "enum": {
1002
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
1003
+ },
1004
+ "additionalProperties": {
1005
+ "anyOf": [
1006
+ {
1007
+ "$ref": "#/definitions/schema"
1008
+ },
1009
+ {
1010
+ "type": "boolean"
1011
+ }
1012
+ ],
1013
+ "default": {}
1014
+ },
1015
+ "type": {
1016
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
1017
+ },
1018
+ "items": {
1019
+ "anyOf": [
1020
+ {
1021
+ "$ref": "#/definitions/schema"
1022
+ },
1023
+ {
1024
+ "type": "array",
1025
+ "minItems": 1,
1026
+ "items": {
1027
+ "$ref": "#/definitions/schema"
1028
+ }
1029
+ }
1030
+ ],
1031
+ "default": {}
1032
+ },
1033
+ "allOf": {
1034
+ "type": "array",
1035
+ "minItems": 1,
1036
+ "items": {
1037
+ "$ref": "#/definitions/schema"
1038
+ }
1039
+ },
1040
+ "properties": {
1041
+ "type": "object",
1042
+ "additionalProperties": {
1043
+ "$ref": "#/definitions/schema"
1044
+ },
1045
+ "default": {}
1046
+ },
1047
+ "discriminator": {
1048
+ "type": "string"
1049
+ },
1050
+ "readOnly": {
1051
+ "type": "boolean",
1052
+ "default": false
1053
+ },
1054
+ "xml": {
1055
+ "$ref": "#/definitions/xml"
1056
+ },
1057
+ "externalDocs": {
1058
+ "$ref": "#/definitions/externalDocs"
1059
+ },
1060
+ "example": {}
1061
+ },
1062
+ "additionalProperties": false
1063
+ },
1064
+ "fileSchema": {
1065
+ "type": "object",
1066
+ "description": "A deterministic version of a JSON Schema object.",
1067
+ "patternProperties": {
1068
+ "^x-": {
1069
+ "$ref": "#/definitions/vendorExtension"
1070
+ }
1071
+ },
1072
+ "required": [
1073
+ "type"
1074
+ ],
1075
+ "properties": {
1076
+ "format": {
1077
+ "type": "string"
1078
+ },
1079
+ "title": {
1080
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
1081
+ },
1082
+ "description": {
1083
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
1084
+ },
1085
+ "default": {
1086
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
1087
+ },
1088
+ "required": {
1089
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
1090
+ },
1091
+ "type": {
1092
+ "type": "string",
1093
+ "enum": [
1094
+ "file"
1095
+ ]
1096
+ },
1097
+ "readOnly": {
1098
+ "type": "boolean",
1099
+ "default": false
1100
+ },
1101
+ "externalDocs": {
1102
+ "$ref": "#/definitions/externalDocs"
1103
+ },
1104
+ "example": {}
1105
+ },
1106
+ "additionalProperties": false
1107
+ },
1108
+ "primitivesItems": {
1109
+ "type": "object",
1110
+ "additionalProperties": false,
1111
+ "properties": {
1112
+ "type": {
1113
+ "type": "string",
1114
+ "enum": [
1115
+ "string",
1116
+ "number",
1117
+ "integer",
1118
+ "boolean",
1119
+ "array"
1120
+ ]
1121
+ },
1122
+ "format": {
1123
+ "type": "string"
1124
+ },
1125
+ "items": {
1126
+ "$ref": "#/definitions/primitivesItems"
1127
+ },
1128
+ "collectionFormat": {
1129
+ "$ref": "#/definitions/collectionFormat"
1130
+ },
1131
+ "default": {
1132
+ "$ref": "#/definitions/default"
1133
+ },
1134
+ "maximum": {
1135
+ "$ref": "#/definitions/maximum"
1136
+ },
1137
+ "exclusiveMaximum": {
1138
+ "$ref": "#/definitions/exclusiveMaximum"
1139
+ },
1140
+ "minimum": {
1141
+ "$ref": "#/definitions/minimum"
1142
+ },
1143
+ "exclusiveMinimum": {
1144
+ "$ref": "#/definitions/exclusiveMinimum"
1145
+ },
1146
+ "maxLength": {
1147
+ "$ref": "#/definitions/maxLength"
1148
+ },
1149
+ "minLength": {
1150
+ "$ref": "#/definitions/minLength"
1151
+ },
1152
+ "pattern": {
1153
+ "$ref": "#/definitions/pattern"
1154
+ },
1155
+ "maxItems": {
1156
+ "$ref": "#/definitions/maxItems"
1157
+ },
1158
+ "minItems": {
1159
+ "$ref": "#/definitions/minItems"
1160
+ },
1161
+ "uniqueItems": {
1162
+ "$ref": "#/definitions/uniqueItems"
1163
+ },
1164
+ "enum": {
1165
+ "$ref": "#/definitions/enum"
1166
+ },
1167
+ "multipleOf": {
1168
+ "$ref": "#/definitions/multipleOf"
1169
+ }
1170
+ },
1171
+ "patternProperties": {
1172
+ "^x-": {
1173
+ "$ref": "#/definitions/vendorExtension"
1174
+ }
1175
+ }
1176
+ },
1177
+ "security": {
1178
+ "type": "array",
1179
+ "items": {
1180
+ "$ref": "#/definitions/securityRequirement"
1181
+ },
1182
+ "uniqueItems": true
1183
+ },
1184
+ "securityRequirement": {
1185
+ "type": "object",
1186
+ "additionalProperties": {
1187
+ "type": "array",
1188
+ "items": {
1189
+ "type": "string"
1190
+ },
1191
+ "uniqueItems": true
1192
+ }
1193
+ },
1194
+ "xml": {
1195
+ "type": "object",
1196
+ "additionalProperties": false,
1197
+ "properties": {
1198
+ "name": {
1199
+ "type": "string"
1200
+ },
1201
+ "namespace": {
1202
+ "type": "string"
1203
+ },
1204
+ "prefix": {
1205
+ "type": "string"
1206
+ },
1207
+ "attribute": {
1208
+ "type": "boolean",
1209
+ "default": false
1210
+ },
1211
+ "wrapped": {
1212
+ "type": "boolean",
1213
+ "default": false
1214
+ }
1215
+ },
1216
+ "patternProperties": {
1217
+ "^x-": {
1218
+ "$ref": "#/definitions/vendorExtension"
1219
+ }
1220
+ }
1221
+ },
1222
+ "tag": {
1223
+ "type": "object",
1224
+ "additionalProperties": false,
1225
+ "required": [
1226
+ "name"
1227
+ ],
1228
+ "properties": {
1229
+ "name": {
1230
+ "type": "string"
1231
+ },
1232
+ "description": {
1233
+ "type": "string"
1234
+ },
1235
+ "externalDocs": {
1236
+ "$ref": "#/definitions/externalDocs"
1237
+ }
1238
+ },
1239
+ "patternProperties": {
1240
+ "^x-": {
1241
+ "$ref": "#/definitions/vendorExtension"
1242
+ }
1243
+ }
1244
+ },
1245
+ "securityDefinitions": {
1246
+ "type": "object",
1247
+ "additionalProperties": {
1248
+ "oneOf": [
1249
+ {
1250
+ "$ref": "#/definitions/basicAuthenticationSecurity"
1251
+ },
1252
+ {
1253
+ "$ref": "#/definitions/apiKeySecurity"
1254
+ },
1255
+ {
1256
+ "$ref": "#/definitions/oauth2ImplicitSecurity"
1257
+ },
1258
+ {
1259
+ "$ref": "#/definitions/oauth2PasswordSecurity"
1260
+ },
1261
+ {
1262
+ "$ref": "#/definitions/oauth2ApplicationSecurity"
1263
+ },
1264
+ {
1265
+ "$ref": "#/definitions/oauth2AccessCodeSecurity"
1266
+ }
1267
+ ]
1268
+ }
1269
+ },
1270
+ "basicAuthenticationSecurity": {
1271
+ "type": "object",
1272
+ "additionalProperties": false,
1273
+ "required": [
1274
+ "type"
1275
+ ],
1276
+ "properties": {
1277
+ "type": {
1278
+ "type": "string",
1279
+ "enum": [
1280
+ "basic"
1281
+ ]
1282
+ },
1283
+ "description": {
1284
+ "type": "string"
1285
+ }
1286
+ },
1287
+ "patternProperties": {
1288
+ "^x-": {
1289
+ "$ref": "#/definitions/vendorExtension"
1290
+ }
1291
+ }
1292
+ },
1293
+ "apiKeySecurity": {
1294
+ "type": "object",
1295
+ "additionalProperties": false,
1296
+ "required": [
1297
+ "type",
1298
+ "name",
1299
+ "in"
1300
+ ],
1301
+ "properties": {
1302
+ "type": {
1303
+ "type": "string",
1304
+ "enum": [
1305
+ "apiKey"
1306
+ ]
1307
+ },
1308
+ "name": {
1309
+ "type": "string"
1310
+ },
1311
+ "in": {
1312
+ "type": "string",
1313
+ "enum": [
1314
+ "header",
1315
+ "query"
1316
+ ]
1317
+ },
1318
+ "description": {
1319
+ "type": "string"
1320
+ }
1321
+ },
1322
+ "patternProperties": {
1323
+ "^x-": {
1324
+ "$ref": "#/definitions/vendorExtension"
1325
+ }
1326
+ }
1327
+ },
1328
+ "oauth2ImplicitSecurity": {
1329
+ "type": "object",
1330
+ "additionalProperties": false,
1331
+ "required": [
1332
+ "type",
1333
+ "flow",
1334
+ "authorizationUrl"
1335
+ ],
1336
+ "properties": {
1337
+ "type": {
1338
+ "type": "string",
1339
+ "enum": [
1340
+ "oauth2"
1341
+ ]
1342
+ },
1343
+ "flow": {
1344
+ "type": "string",
1345
+ "enum": [
1346
+ "implicit"
1347
+ ]
1348
+ },
1349
+ "scopes": {
1350
+ "$ref": "#/definitions/oauth2Scopes"
1351
+ },
1352
+ "authorizationUrl": {
1353
+ "type": "string",
1354
+ "format": "uri"
1355
+ },
1356
+ "description": {
1357
+ "type": "string"
1358
+ }
1359
+ },
1360
+ "patternProperties": {
1361
+ "^x-": {
1362
+ "$ref": "#/definitions/vendorExtension"
1363
+ }
1364
+ }
1365
+ },
1366
+ "oauth2PasswordSecurity": {
1367
+ "type": "object",
1368
+ "additionalProperties": false,
1369
+ "required": [
1370
+ "type",
1371
+ "flow",
1372
+ "tokenUrl"
1373
+ ],
1374
+ "properties": {
1375
+ "type": {
1376
+ "type": "string",
1377
+ "enum": [
1378
+ "oauth2"
1379
+ ]
1380
+ },
1381
+ "flow": {
1382
+ "type": "string",
1383
+ "enum": [
1384
+ "password"
1385
+ ]
1386
+ },
1387
+ "scopes": {
1388
+ "$ref": "#/definitions/oauth2Scopes"
1389
+ },
1390
+ "tokenUrl": {
1391
+ "type": "string",
1392
+ "format": "uri"
1393
+ },
1394
+ "description": {
1395
+ "type": "string"
1396
+ }
1397
+ },
1398
+ "patternProperties": {
1399
+ "^x-": {
1400
+ "$ref": "#/definitions/vendorExtension"
1401
+ }
1402
+ }
1403
+ },
1404
+ "oauth2ApplicationSecurity": {
1405
+ "type": "object",
1406
+ "additionalProperties": false,
1407
+ "required": [
1408
+ "type",
1409
+ "flow",
1410
+ "tokenUrl"
1411
+ ],
1412
+ "properties": {
1413
+ "type": {
1414
+ "type": "string",
1415
+ "enum": [
1416
+ "oauth2"
1417
+ ]
1418
+ },
1419
+ "flow": {
1420
+ "type": "string",
1421
+ "enum": [
1422
+ "application"
1423
+ ]
1424
+ },
1425
+ "scopes": {
1426
+ "$ref": "#/definitions/oauth2Scopes"
1427
+ },
1428
+ "tokenUrl": {
1429
+ "type": "string",
1430
+ "format": "uri"
1431
+ },
1432
+ "description": {
1433
+ "type": "string"
1434
+ }
1435
+ },
1436
+ "patternProperties": {
1437
+ "^x-": {
1438
+ "$ref": "#/definitions/vendorExtension"
1439
+ }
1440
+ }
1441
+ },
1442
+ "oauth2AccessCodeSecurity": {
1443
+ "type": "object",
1444
+ "additionalProperties": false,
1445
+ "required": [
1446
+ "type",
1447
+ "flow",
1448
+ "authorizationUrl",
1449
+ "tokenUrl"
1450
+ ],
1451
+ "properties": {
1452
+ "type": {
1453
+ "type": "string",
1454
+ "enum": [
1455
+ "oauth2"
1456
+ ]
1457
+ },
1458
+ "flow": {
1459
+ "type": "string",
1460
+ "enum": [
1461
+ "accessCode"
1462
+ ]
1463
+ },
1464
+ "scopes": {
1465
+ "$ref": "#/definitions/oauth2Scopes"
1466
+ },
1467
+ "authorizationUrl": {
1468
+ "type": "string",
1469
+ "format": "uri"
1470
+ },
1471
+ "tokenUrl": {
1472
+ "type": "string",
1473
+ "format": "uri"
1474
+ },
1475
+ "description": {
1476
+ "type": "string"
1477
+ }
1478
+ },
1479
+ "patternProperties": {
1480
+ "^x-": {
1481
+ "$ref": "#/definitions/vendorExtension"
1482
+ }
1483
+ }
1484
+ },
1485
+ "oauth2Scopes": {
1486
+ "type": "object",
1487
+ "additionalProperties": {
1488
+ "type": "string"
1489
+ }
1490
+ },
1491
+ "mediaTypeList": {
1492
+ "type": "array",
1493
+ "items": {
1494
+ "$ref": "#/definitions/mimeType"
1495
+ },
1496
+ "uniqueItems": true
1497
+ },
1498
+ "parametersList": {
1499
+ "type": "array",
1500
+ "description": "The parameters needed to send a valid API call.",
1501
+ "additionalItems": false,
1502
+ "items": {
1503
+ "oneOf": [
1504
+ {
1505
+ "$ref": "#/definitions/parameter"
1506
+ },
1507
+ {
1508
+ "$ref": "#/definitions/jsonReference"
1509
+ }
1510
+ ]
1511
+ },
1512
+ "uniqueItems": true
1513
+ },
1514
+ "schemesList": {
1515
+ "type": "array",
1516
+ "description": "The transfer protocol of the API.",
1517
+ "items": {
1518
+ "type": "string",
1519
+ "enum": [
1520
+ "http",
1521
+ "https",
1522
+ "ws",
1523
+ "wss"
1524
+ ]
1525
+ },
1526
+ "uniqueItems": true
1527
+ },
1528
+ "collectionFormat": {
1529
+ "type": "string",
1530
+ "enum": [
1531
+ "csv",
1532
+ "ssv",
1533
+ "tsv",
1534
+ "pipes"
1535
+ ],
1536
+ "default": "csv"
1537
+ },
1538
+ "collectionFormatWithMulti": {
1539
+ "type": "string",
1540
+ "enum": [
1541
+ "csv",
1542
+ "ssv",
1543
+ "tsv",
1544
+ "pipes",
1545
+ "multi"
1546
+ ],
1547
+ "default": "csv"
1548
+ },
1549
+ "title": {
1550
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
1551
+ },
1552
+ "description": {
1553
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
1554
+ },
1555
+ "default": {
1556
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
1557
+ },
1558
+ "multipleOf": {
1559
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
1560
+ },
1561
+ "maximum": {
1562
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
1563
+ },
1564
+ "exclusiveMaximum": {
1565
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
1566
+ },
1567
+ "minimum": {
1568
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
1569
+ },
1570
+ "exclusiveMinimum": {
1571
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
1572
+ },
1573
+ "maxLength": {
1574
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
1575
+ },
1576
+ "minLength": {
1577
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
1578
+ },
1579
+ "pattern": {
1580
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
1581
+ },
1582
+ "maxItems": {
1583
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
1584
+ },
1585
+ "minItems": {
1586
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
1587
+ },
1588
+ "uniqueItems": {
1589
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
1590
+ },
1591
+ "enum": {
1592
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
1593
+ },
1594
+ "jsonReference": {
1595
+ "type": "object",
1596
+ "required": [
1597
+ "$ref"
1598
+ ],
1599
+ "additionalProperties": false,
1600
+ "properties": {
1601
+ "$ref": {
1602
+ "type": "string"
1603
+ }
1604
+ }
1605
+ }
1606
+ }
1607
+ }