|
| 1 | +{ |
| 2 | + "title": "A JSON Schema for Swagger 2.0 API.", |
| 3 | + "$schema": "http://json-schema.org/draft-04/schema#", |
| 4 | + |
| 5 | + "type": "object", |
| 6 | + "required": [ "swagger", "info", "host", "basePath", "paths" ], |
| 7 | + |
| 8 | + "definitions": { |
| 9 | + "info": { |
| 10 | + "type": "object", |
| 11 | + "description": "General information about the API.", |
| 12 | + "required": [ "version", "title" ], |
| 13 | + "additionalProperties": false, |
| 14 | + "properties": { |
| 15 | + "version": { |
| 16 | + "type": "string", |
| 17 | + "description": "A semantic version number of the API." |
| 18 | + }, |
| 19 | + "title": { |
| 20 | + "type": "string", |
| 21 | + "description": "A unique and precise title of the API." |
| 22 | + }, |
| 23 | + "description": { |
| 24 | + "type": "string", |
| 25 | + "description": "A longer description of the API. Should be different from the title." |
| 26 | + }, |
| 27 | + "termsOfService": { |
| 28 | + "type": "string", |
| 29 | + "description": "The terms of service for the API." |
| 30 | + }, |
| 31 | + "contact": { |
| 32 | + "type": "object", |
| 33 | + "description": "Contact information for the owners of the API.", |
| 34 | + "required": [ "name" ], |
| 35 | + "additionalProperties": false, |
| 36 | + "properties": { |
| 37 | + "name": { |
| 38 | + "type": "string", |
| 39 | + "description": "The identifying name of the contact person/organization." |
| 40 | + }, |
| 41 | + "url": { |
| 42 | + "type": "string", |
| 43 | + "description": "The URL pointing to the contact information.", |
| 44 | + "format": "uri" |
| 45 | + }, |
| 46 | + "email": { |
| 47 | + "type": "string", |
| 48 | + "description": "The email address of the contact person/organization.", |
| 49 | + "format": "email" |
| 50 | + } |
| 51 | + } |
| 52 | + }, |
| 53 | + "license": { |
| 54 | + "type": "object", |
| 55 | + "required": [ "type" ], |
| 56 | + "additionalProperties": false, |
| 57 | + "properties": { |
| 58 | + "type": { |
| 59 | + "type": "string", |
| 60 | + "description": "The name of the type of license. It's encouraged to use an OSI compatible license." |
| 61 | + }, |
| 62 | + "url": { |
| 63 | + "type": "string", |
| 64 | + "description": "The URL pointing to the license.", |
| 65 | + "format": "uri" |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + }, |
| 71 | + "mimeType": { |
| 72 | + "type": "string", |
| 73 | + "pattern": "^[a-z0-9-]+/[a-z0-9-+]+$", |
| 74 | + "description": "The MIME type of the HTTP message." |
| 75 | + }, |
| 76 | + "operation": { |
| 77 | + "type": "object", |
| 78 | + "required": [ "responses" ], |
| 79 | + "additionalProperties": false, |
| 80 | + "properties": { |
| 81 | + "summary": { |
| 82 | + "type": "string", |
| 83 | + "description": "A brief summary of the operation." |
| 84 | + }, |
| 85 | + "description": { |
| 86 | + "type": "string", |
| 87 | + "description": "A longer description of the operation." |
| 88 | + }, |
| 89 | + "operationId": { |
| 90 | + "type": "string", |
| 91 | + "description": "A friendly name of the operation" |
| 92 | + }, |
| 93 | + "produces": { |
| 94 | + "type": "array", |
| 95 | + "description": "A list of MIME types the API can produce.", |
| 96 | + "additionalItems": false, |
| 97 | + "items": { |
| 98 | + "$ref": "#/definitions/mimeType" |
| 99 | + } |
| 100 | + }, |
| 101 | + "parameters": { |
| 102 | + "type": "array", |
| 103 | + "description": "The parameters needed to send a valid API call.", |
| 104 | + "minItems": 1, |
| 105 | + "additionalItems": false, |
| 106 | + "items": { |
| 107 | + "$ref": "#/definitions/parameter" |
| 108 | + } |
| 109 | + }, |
| 110 | + "responses": { |
| 111 | + "type": "object", |
| 112 | + "description": "Response objects names can either be any valid HTTP status code or 'default'.", |
| 113 | + "minProperties": 1, |
| 114 | + "additionalProperties": false, |
| 115 | + "patternProperties": { |
| 116 | + "^([0-9]+)$|^(default)$": { |
| 117 | + "$ref": "#/definitions/model" |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + }, |
| 123 | + "parameter": { |
| 124 | + "type": "object", |
| 125 | + "required": [ "name", "kind", "model" ], |
| 126 | + "additionalProperties": false, |
| 127 | + "properties": { |
| 128 | + "name": { |
| 129 | + "type": "string", |
| 130 | + "description": "The name of the parameter." |
| 131 | + }, |
| 132 | + "kind": { |
| 133 | + "type": "string", |
| 134 | + "description": "Determines the location of the parameter.", |
| 135 | + "enum": [ "query", "header", "path", "formData", "body" ], |
| 136 | + "default": "query" |
| 137 | + }, |
| 138 | + "description": { |
| 139 | + "type": "string", |
| 140 | + "description": "A brief description of the parameter. This could contain examples of use." |
| 141 | + }, |
| 142 | + "required": { |
| 143 | + "type": "boolean", |
| 144 | + "description": "Determines whether or not this parameter is required or optional." |
| 145 | + }, |
| 146 | + "model": { |
| 147 | + "$ref": "#/definitions/model" |
| 148 | + } |
| 149 | + } |
| 150 | + }, |
| 151 | + "model": { |
| 152 | + "type": "object", |
| 153 | + "description": "A deterministic version of a JSON Schema object.", |
| 154 | + "properties": { |
| 155 | + "$ref": { "type": "string" }, |
| 156 | + "format": { "type": "string" }, |
| 157 | + "title": { "$ref": "http://json-schema.org/draft-04/schema#/properties/title" }, |
| 158 | + "description": { "$ref": "http://json-schema.org/draft-04/schema#/properties/description" }, |
| 159 | + "default": { "$ref": "http://json-schema.org/draft-04/schema#/properties/default" }, |
| 160 | + "multipleOf": { "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" }, |
| 161 | + "maximum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" }, |
| 162 | + "exclusiveMaximum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" }, |
| 163 | + "minimum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" }, |
| 164 | + "exclusiveMinimum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMiminum" }, |
| 165 | + "maxLength": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, |
| 166 | + "minLength": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, |
| 167 | + "pattern": { "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" }, |
| 168 | + "items": { |
| 169 | + "anyOf": [ |
| 170 | + { "$ref": "#/definitions/model" }, |
| 171 | + { |
| 172 | + "type": "array", |
| 173 | + "minItems": 1, |
| 174 | + "items": { "$ref": "#/definitions/model" } |
| 175 | + } |
| 176 | + ], |
| 177 | + "default": { } |
| 178 | + }, |
| 179 | + "maxItems": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, |
| 180 | + "minItems": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, |
| 181 | + "uniqueItems": { "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" }, |
| 182 | + "maxProperties": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, |
| 183 | + "minProperties": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, |
| 184 | + "required": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" }, |
| 185 | + "definitions": { |
| 186 | + "type": "object", |
| 187 | + "additionalProperties": { "$ref": "#/definitions/model" }, |
| 188 | + "default": { } |
| 189 | + }, |
| 190 | + "properties": { |
| 191 | + "type": "object", |
| 192 | + "additionalProperties": { "$ref": "#/definitions/model" }, |
| 193 | + "default": { } |
| 194 | + }, |
| 195 | + "enum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" }, |
| 196 | + "type": { "$ref": "http://json-schema.org/draft-04/schema#/properties/type" }, |
| 197 | + "allOf": { |
| 198 | + "type": "array", |
| 199 | + "minItems": 1, |
| 200 | + "items": { "$ref": "#/definitions/model" } |
| 201 | + } |
| 202 | + } |
| 203 | + } |
| 204 | + }, |
| 205 | + |
| 206 | + "patternProperties": { |
| 207 | + "^_": { |
| 208 | + "description": "Any property starting with _ is valid.", |
| 209 | + "additionalProperties": true, |
| 210 | + "additionalItems": true |
| 211 | + } |
| 212 | + }, |
| 213 | + |
| 214 | + "properties": { |
| 215 | + "swagger": { |
| 216 | + "type": "number", |
| 217 | + "enum": [ 2.0 ], |
| 218 | + "description": "The Swagger version of this document." |
| 219 | + }, |
| 220 | + "info": { |
| 221 | + "$ref": "#/definitions/info" |
| 222 | + }, |
| 223 | + "host": { |
| 224 | + "type": "string", |
| 225 | + "format": "uri", |
| 226 | + "description": "The fully qualified URI to the host of the API." |
| 227 | + }, |
| 228 | + "basePath": { |
| 229 | + "type": "string", |
| 230 | + "pattern": "^/", |
| 231 | + "description": "The base path to the API. Example: '/api'." |
| 232 | + }, |
| 233 | + "schemes": { |
| 234 | + "type": "array", |
| 235 | + "description": "The transfer protocol of the API.", |
| 236 | + "items": { |
| 237 | + "type": "string", |
| 238 | + "enum": [ "http", "https", "ws", "wss" ] |
| 239 | + } |
| 240 | + }, |
| 241 | + "consumes": { |
| 242 | + "type": "array", |
| 243 | + "description": "A list of MIME types accepted by the API.", |
| 244 | + "items": { |
| 245 | + "$ref": "#/definitions/mimeType" |
| 246 | + } |
| 247 | + }, |
| 248 | + "produces": { |
| 249 | + "type": "array", |
| 250 | + "description": "A list of MIME types the API can produce.", |
| 251 | + "items": { |
| 252 | + "$ref": "#/definitions/mimeType" |
| 253 | + } |
| 254 | + }, |
| 255 | + "paths": { |
| 256 | + "type": "object", |
| 257 | + "description": "Relative paths to the individual endpoints. They should be relative to the 'basePath'.", |
| 258 | + "additionalProperties": { |
| 259 | + "type": "object", |
| 260 | + "minProperties": 1, |
| 261 | + "additionalProperties": false, |
| 262 | + "properties": { |
| 263 | + "get": { |
| 264 | + "$ref": "#/definitions/operation" |
| 265 | + }, |
| 266 | + "put": { |
| 267 | + "$ref": "#/definitions/operation" |
| 268 | + }, |
| 269 | + "post": { |
| 270 | + "$ref": "#/definitions/operation" |
| 271 | + }, |
| 272 | + "delete": { |
| 273 | + "$ref": "#/definitions/operation" |
| 274 | + }, |
| 275 | + "options": { |
| 276 | + "$ref": "#/definitions/operation" |
| 277 | + }, |
| 278 | + "head": { |
| 279 | + "$ref": "#/definitions/operation" |
| 280 | + }, |
| 281 | + "patch": { |
| 282 | + "$ref": "#/definitions/operation" |
| 283 | + } |
| 284 | + } |
| 285 | + } |
| 286 | + }, |
| 287 | + "models": { |
| 288 | + "type": "object", |
| 289 | + "description": "One or more JSON objects describing the models being consumed and produced by the API.", |
| 290 | + "additionalProperties": { |
| 291 | + "$ref": "#/definitions/model" |
| 292 | + } |
| 293 | + } |
| 294 | + } |
| 295 | +} |
0 commit comments