swagger-core 0.2.1 → 0.2.2

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