diff --git a/README.md b/README.md index 61bc2e3bf4..87abb4fba7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # The Swagger Specification -[![Build Status](https://travis-ci.org/reverb/swagger-spec.svg?branch=master)](https://travis-ci.org/wordnik/swagger-spec) +[![Build Status](https://travis-ci.org/webron/swagger-spec.svg?branch=master)](https://travis-ci.org/webron/swagger-spec) ![](https://raw.github.com/wordnik/swagger-spec/master/swagger-logo.jpg) ## Welcome to the Swagger Project! diff --git a/examples/v2.0/json/petstore-expanded.json b/examples/v2.0/json/petstore-expanded.json index e57d348854..792c31eee3 100644 --- a/examples/v2.0/json/petstore-expanded.json +++ b/examples/v2.0/json/petstore-expanded.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", diff --git a/examples/v2.0/json/petstore-simple.json b/examples/v2.0/json/petstore-simple.json index 2d9dc4e29f..0e44295aac 100644 --- a/examples/v2.0/json/petstore-simple.json +++ b/examples/v2.0/json/petstore-simple.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", @@ -12,7 +12,8 @@ "name": "MIT" } }, - "host": "petstore.swagger.wordnik.com/api", + "host": "petstore.swagger.wordnik.com", + "basePath": "/api", "schemes": [ "http" ], diff --git a/examples/v2.0/json/petstore-with-external-docs.json b/examples/v2.0/json/petstore-with-external-docs.json index f1f3b51d10..b2105e76dc 100644 --- a/examples/v2.0/json/petstore-with-external-docs.json +++ b/examples/v2.0/json/petstore-with-external-docs.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", diff --git a/examples/v2.0/json/petstore.json b/examples/v2.0/json/petstore.json index 7a9f4a53db..b1ab216098 100644 --- a/examples/v2.0/json/petstore.json +++ b/examples/v2.0/json/petstore.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", @@ -31,11 +31,11 @@ "$ref": "#/definitions/Pet" } }, - "headers": [{ + "headers": { "x-expires": { "type": "string" } - }] + } }, "default": { "description": "unexpected error", diff --git a/examples/v2.0/yaml/petstore-expanded.yaml b/examples/v2.0/yaml/petstore-expanded.yaml index c3a9f7c1dd..df714c078e 100644 --- a/examples/v2.0/yaml/petstore-expanded.yaml +++ b/examples/v2.0/yaml/petstore-expanded.yaml @@ -1,4 +1,4 @@ -swagger: 2.0 +swagger: "2.0" info: version: 1.0.0 title: Swagger Petstore diff --git a/examples/v2.0/yaml/petstore.yaml b/examples/v2.0/yaml/petstore.yaml index 59b858a75a..d89a6f821f 100644 --- a/examples/v2.0/yaml/petstore.yaml +++ b/examples/v2.0/yaml/petstore.yaml @@ -1,4 +1,4 @@ -swagger: 2.0 +swagger: "2.0" info: version: 1.0.0 title: Swagger Petstore @@ -30,7 +30,7 @@ paths: 200: description: An paged array of pets headers: - - x-next: + x-next: type: string description: A link to the next page of responses schema: diff --git a/examples/v2.0/yaml/uber.yaml b/examples/v2.0/yaml/uber.yaml index 3e44e7922b..f72b37841d 100644 --- a/examples/v2.0/yaml/uber.yaml +++ b/examples/v2.0/yaml/uber.yaml @@ -1,6 +1,6 @@ # this is an example of the Uber API # as a demonstration of an API spec in YAML -swagger: 2 +swagger: "2.0" info: title: Uber API description: Move your app forward with the Uber API diff --git a/fixtures/v2.0/json/resources/cascadingSchemes.json b/fixtures/v2.0/json/resources/cascadingSchemes.json index 3d3e54c1ed..68c9702925 100644 --- a/fixtures/v2.0/json/resources/cascadingSchemes.json +++ b/fixtures/v2.0/json/resources/cascadingSchemes.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/commonParameters.json b/fixtures/v2.0/json/resources/commonParameters.json index c4185382b9..5a9a128415 100644 --- a/fixtures/v2.0/json/resources/commonParameters.json +++ b/fixtures/v2.0/json/resources/commonParameters.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/multipleMimeTypes.json b/fixtures/v2.0/json/resources/multipleMimeTypes.json index 791a3f89bc..fa014914df 100644 --- a/fixtures/v2.0/json/resources/multipleMimeTypes.json +++ b/fixtures/v2.0/json/resources/multipleMimeTypes.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/resourceWithExamplePayload.json b/fixtures/v2.0/json/resources/resourceWithExamplePayload.json index a275b1e4f3..90767b6a5d 100644 --- a/fixtures/v2.0/json/resources/resourceWithExamplePayload.json +++ b/fixtures/v2.0/json/resources/resourceWithExamplePayload.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json b/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json index 5aa82a4707..52f9ebd9cc 100644 --- a/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json +++ b/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/resourceWithRelativeHost.json b/fixtures/v2.0/json/resources/resourceWithRelativeHost.json index 8d91f03c94..2e16c3a395 100644 --- a/fixtures/v2.0/json/resources/resourceWithRelativeHost.json +++ b/fixtures/v2.0/json/resources/resourceWithRelativeHost.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/reusableParameters.json b/fixtures/v2.0/json/resources/reusableParameters.json index 77abe0ebf6..3547c419f7 100644 --- a/fixtures/v2.0/json/resources/reusableParameters.json +++ b/fixtures/v2.0/json/resources/reusableParameters.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/securityExample.json b/fixtures/v2.0/json/resources/securityExample.json index cc504d99f9..e4c482c4db 100644 --- a/fixtures/v2.0/json/resources/securityExample.json +++ b/fixtures/v2.0/json/resources/securityExample.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", @@ -28,13 +28,10 @@ ], "security": [ { - "githubAuth": { "$ref": "#/security/github/accessCode" } + "githubAccessCode": [ "user", "gist" ] }, { - "internalApiKey": { - "type": "header", - "name": "api_key" - } + "internalApiKey": [] } ], "paths": { @@ -58,12 +55,13 @@ "operationId": "getPetsById", "security": [ { - "githubAuth": { - "scopes": [ "user:read", "user:write" ] - } + "githubAuth":[ + "user:read", + "user:write" + ] }, { - "internalApiKey":{} + "internalApiKey": [] } ], "produces": [ @@ -90,43 +88,64 @@ } } }, - "security": { - "github": { + "securityDefinitions": { + "githubAccessCode": { "type": "oauth2", - "scopes": [ - { "user": "Grants read/write access to profile info only. Note that this scope includes user:email and user:follow." }, - { "user:email": "Grants read access to a user’s email addresses." }, - { "user:follow": "Grants access to follow or unfollow other users." }, - { "public_repo": "Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations." }, - { "repo": "Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations." }, - { "repo_deployment": "Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code." }, - { "repo:status": "Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code." }, - { "delete_repo": "Grants access to delete adminable repositories." }, - { "notifications": "Grants read access to a user’s notifications. repo also provides this access." }, - { "gist": "Grants write access to gists." }, - { "read:repo_hook": "Grants read and ping access to hooks in public or private repositories." }, - { "write:repo_hook": "Grants read, write, and ping access to hooks in public or private repositories." }, - { "admin:repo_hook": "Grants read, write, ping, and delete access to hooks in public or private repositories." }, - { "read:org": "Read-only access to organization, teams, and membership." }, - { "write:org": "Publicize and unpublicize organization membership." }, - { "admin:org": "Fully manage organization, teams, and memberships." }, - { "read:public_key": "List and view details for public keys." }, - { "write:public_key": "Create, list, and view details for public keys." }, - { "admin:public_key": "Fully manage public keys." } - ], - "accessCode": { - "authorize": { - "url": "https://github.com/login/oauth/authorize" - }, - "token": { - "url": "https://github.com/login/oauth/access_token" - } + "scopes": { + "user": "Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.", + "user:email": "Grants read access to a user’s email addresses.", + "user:follow": "Grants access to follow or unfollow other users.", + "public_repo": "Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.", + "repo": "Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.", + "repo_deployment": "Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.", + "repo:status": "Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.", + "delete_repo": "Grants access to delete adminable repositories.", + "notifications": "Grants read access to a user’s notifications. repo also provides this access.", + "gist": "Grants write access to gists.", + "read:repo_hook": "Grants read and ping access to hooks in public or private repositories.", + "write:repo_hook": "Grants read, write, and ping access to hooks in public or private repositories.", + "admin:repo_hook": "Grants read, write, ping, and delete access to hooks in public or private repositories.", + "read:org": "Read-only access to organization, teams, and membership.", + "write:org": "Publicize and unpublicize organization membership.", + "admin:org": "Fully manage organization, teams, and memberships.", + "read:public_key": "List and view details for public keys.", + "write:public_key": "Create, list, and view details for public keys.", + "admin:public_key": "Fully manage public keys." }, - "implicit": { - "login": { - "url": "http://petstore.swagger.wordnik.com/oauth/dialog" - } - } + "flow": "accessCode", + "authorizationUrl": "https://github.com/login/oauth/authorize", + "tokenUrl": "https://github.com/login/oauth/access_token" + }, + "petstoreImplicit": { + "type": "oauth2", + "scopes": { + "user": "Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.", + "user:email": "Grants read access to a user’s email addresses.", + "user:follow": "Grants access to follow or unfollow other users.", + "public_repo": "Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.", + "repo": "Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.", + "repo_deployment": "Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.", + "repo:status": "Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.", + "delete_repo": "Grants access to delete adminable repositories.", + "notifications": "Grants read access to a user’s notifications. repo also provides this access.", + "gist": "Grants write access to gists.", + "read:repo_hook": "Grants read and ping access to hooks in public or private repositories.", + "write:repo_hook": "Grants read, write, and ping access to hooks in public or private repositories.", + "admin:repo_hook": "Grants read, write, ping, and delete access to hooks in public or private repositories.", + "read:org": "Read-only access to organization, teams, and membership.", + "write:org": "Publicize and unpublicize organization membership.", + "admin:org": "Fully manage organization, teams, and memberships.", + "read:public_key": "List and view details for public keys.", + "write:public_key": "Create, list, and view details for public keys.", + "admin:public_key": "Fully manage public keys." + }, + "flow": "implicit", + "authorizationUrl": "http://petstore.swagger.wordnik.com/oauth/dialog" + }, + "internalApiKey": { + "type": "apiKey", + "in": "header", + "name": "api_key" } }, "definitions": { @@ -144,7 +163,10 @@ } }, "ErrorModel": { - "required": [ "code", "message" ], + "required": [ + "code", + "message" + ], "properties": { "code": { "type": "integer", @@ -156,4 +178,4 @@ } } } -} +} \ No newline at end of file diff --git a/fixtures/v2.0/json/resources/stringPathParamResource.json b/fixtures/v2.0/json/resources/stringPathParamResource.json index 4c03dfb51a..a438a08ea2 100644 --- a/fixtures/v2.0/json/resources/stringPathParamResource.json +++ b/fixtures/v2.0/json/resources/stringPathParamResource.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "version": "1.0.9-abcd", "title": "Swagger Sample API", diff --git a/fixtures/v2.0/json/resources/taggedResource.json b/fixtures/v2.0/json/resources/taggedResource.json index d0cb35fdcf..19394c70d1 100644 --- a/fixtures/v2.0/json/resources/taggedResource.json +++ b/fixtures/v2.0/json/resources/taggedResource.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "x-reverb": { "addAnythingYouWant": true }, @@ -33,7 +33,7 @@ ], "tags": [ { - "foo": "bar" + "name": "pets" } ], "paths": { diff --git a/fixtures/v2.0/json/resources/vendorExtensionExamples.json b/fixtures/v2.0/json/resources/vendorExtensionExamples.json index 70626f5d1e..267ce5399c 100644 --- a/fixtures/v2.0/json/resources/vendorExtensionExamples.json +++ b/fixtures/v2.0/json/resources/vendorExtensionExamples.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "x-reverb": { "addAnythingYouWant": true }, diff --git a/fixtures/v2.0/json/responses/stringResponseWithHeader.json b/fixtures/v2.0/json/responses/stringResponseWithHeader.json index 1b7f132d05..7bdae4d35d 100644 --- a/fixtures/v2.0/json/responses/stringResponseWithHeader.json +++ b/fixtures/v2.0/json/responses/stringResponseWithHeader.json @@ -3,8 +3,8 @@ "schema": { "type": "string" }, - "headers": [ - { "is-dog": {"type": "boolean"} }, - { "is-cat": {"type": "boolean"} } - ] + "headers": { + "is-dog": {"type": "boolean"}, + "is-cat": {"type": "boolean"} + } } \ No newline at end of file diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index e84fdd4447..9bdd087617 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -1,9 +1,12 @@ { "title": "A JSON Schema for Swagger 2.0 API.", "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ "swagger", "info", "paths" ], + "required": [ + "swagger", + "info", + "paths" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -12,20 +15,19 @@ }, "properties": { "swagger": { - "type": "number", - "enum": [ 2.0 ], + "type": "string", + "enum": [ + "2.0" + ], "description": "The Swagger version of this document." }, "info": { "$ref": "#/definitions/info" }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, "host": { "type": "string", "format": "uri", - "pattern": "^((?!\\:\/\/).)*$", + "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", "description": "The fully qualified URI to the host of the API." }, "basePath": { @@ -34,78 +36,53 @@ "description": "The base path to the API. Example: '/api'." }, "schemes": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ "http", "https", "ws", "wss" ] - } + "$ref": "#/definitions/schemesList" }, "consumes": { - "type": "array", "description": "A list of MIME types accepted by the API.", - "items": { - "$ref": "#/definitions/mimeType" - } + "$ref": "#/definitions/mediaTypeList" }, "produces": { - "type": "array", "description": "A list of MIME types the API can produce.", - "items": { - "$ref": "#/definitions/mimeType" - } + "$ref": "#/definitions/mediaTypeList" }, "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/.*[^\/]$": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false + "$ref": "#/definitions/paths" }, "definitions": { - "type": "object", - "description": "One or more JSON objects describing the schemas being consumed and produced by the API.", - "additionalProperties": { "$ref": "#/definitions/schema" } + "$ref": "#/definitions/definitions" }, "parameters": { - "type": "object", - "description": "One or more JSON representations for parameters", - "additionalProperties": { "$ref": "#/definitions/parameter" } + "$ref": "#/definitions/parameterDefinitions" + }, + "responses": { + "$ref": "#/definitions/responseDefinitions" + }, + "security": { + "$ref": "#/definitions/security" + }, + "securityDefinitions": { + "$ref": "#/definitions/securityDefinitions" }, - "responses": { "$ref": "#/definitions/responses" }, - "security": { "$ref": "#/definitions/security" }, "tags": { "type": "array", "items": { "$ref": "#/definitions/tag" - } + }, + "uniqueItems": true + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" } }, "definitions": { - "externalDocs": { - "type": "object", - "description": "information about external documentation", - "required": [ "url" ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - } - }, "info": { "type": "object", "description": "General information about the API.", - "required": [ "version", "title" ], + "required": [ + "version", + "title" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -113,14 +90,14 @@ } }, "properties": { - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, "title": { "type": "string", "description": "A unique and precise title of the API." }, + "version": { + "type": "string", + "description": "A semantic version number of the API." + }, "description": { "type": "string", "description": "A longer description of the API. Should be different from the title. Github-flavored markdown is allowed." @@ -130,45 +107,104 @@ "description": "The terms of service for the API." }, "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - } + "$ref": "#/definitions/contact" }, "license": { - "type": "object", - "required": [ "name" ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - } + "$ref": "#/definitions/license" + } + } + }, + "contact": { + "type": "object", + "description": "Contact information for the owners of the API.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The identifying name of the contact person/organization." + }, + "url": { + "type": "string", + "description": "The URL pointing to the contact information.", + "format": "uri" + }, + "email": { + "type": "string", + "description": "The email address of the contact person/organization.", + "format": "email" + } + } + }, + "license": { + "type": "object", + "required": [ + "name" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the license type. It's encouraged to use an OSI compatible license." + }, + "url": { + "type": "string", + "description": "The URL pointing to the license.", + "format": "uri" + } + } + }, + "paths": { + "type": "object", + "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + }, + "^/": { + "$ref": "#/definitions/pathItem" + } + }, + "additionalProperties": false + }, + "definitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "description": "One or more JSON objects describing the schemas being consumed and produced by the API." + }, + "parameterDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/parameter" + }, + "description": "One or more JSON representations for parameters" + }, + "responseDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response" + }, + "description": "One or more JSON representations for parameters" + }, + "externalDocs": { + "type": "object", + "additionalProperties": false, + "description": "information about external documentation", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" } } }, - "example": { + "examples": { "type": "object", "patternProperties": { "^[a-z0-9-]+/[a-z0-9\\-+]+$": {} @@ -182,7 +218,9 @@ }, "operation": { "type": "object", - "required": [ "responses" ], + "required": [ + "responses" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -194,7 +232,8 @@ "type": "array", "items": { "type": "string" - } + }, + "uniqueItems": true }, "summary": { "type": "string", @@ -212,54 +251,28 @@ "description": "A friendly name of the operation" }, "produces": { - "type": "array", "description": "A list of MIME types the API can produce.", - "additionalItems": false, - "items": { - "$ref": "#/definitions/mimeType" - } + "$ref": "#/definitions/mediaTypeList" }, "consumes": { - "type": "array", "description": "A list of MIME types the API can consume.", - "additionalItems": false, - "items": { - "$ref": "#/definitions/mimeType" - } + "$ref": "#/definitions/mediaTypeList" }, "parameters": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "minItems": 1, - "additionalItems": false, - "items": { - "oneOf": [ - { "$ref": "#/definitions/parameter" }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } - } - } - ] - } + "$ref": "#/definitions/parametersList" }, "responses": { "$ref": "#/definitions/responses" }, "schemes": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ "http", "https", "ws", "wss" ] - } + "$ref": "#/definitions/schemesList" + }, + "deprecated": { + "type": "boolean", + "default": false }, "security": { - "$ref": "#/definitions/securityRequirement" + "$ref": "#/definitions/security" } } }, @@ -297,10 +310,7 @@ "$ref": "#/definitions/operation" }, "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameter" - } + "$ref": "#/definitions/parametersList" } } }, @@ -310,17 +320,38 @@ "minProperties": 1, "additionalProperties": false, "patternProperties": { - "^([0-9]+)$|^(default)$": { - "$ref": "#/definitions/response" + "^([0-9]{3})$|^(default)$": { + "$ref": "#/definitions/responseValue" }, "^x-": { "$ref": "#/definitions/vendorExtension" } + }, + "not": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } } }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, "response": { "type": "object", - "required": [ "description" ], + "required": [ + "description" + ], "properties": { "description": { "type": "string" @@ -329,30 +360,83 @@ "$ref": "#/definitions/schema" }, "headers": { - "type": "array", - "items": { - "$ref": "#/definitions/serializableType" - } + "$ref": "#/definitions/headers" }, "examples": { - "$ref": "#/definitions/example" + "$ref": "#/definitions/examples" } }, "additionalProperties": false }, - "serializableType": { + "headers": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/header" + } + }, + "header": { + "type": "object", + "additionalProperties": false, "properties": { "type": { "type": "string", - "enum": [ "string", "number", "boolean", "integer", "array", "file" ] + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] }, "format": { "type": "string" }, "items": { - "type": "object" + "$ref": "#/definitions/primitivesItems" }, "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + }, + "description": { "type": "string" } } @@ -362,171 +446,1034 @@ "additionalProperties": true, "additionalItems": true }, - "parameter": { - "type": "object", - "required": [ "name", "in" ], - "oneOf": [ - { - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ "query", "header", "path", "formData" ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." - }, - "type": { - "type": "string", - "enum": [ "string", "number", "boolean", "integer", "array" ] - }, - "format": { - "type": "string" - }, - "items": { - "type": "object" - }, - "collectionFormat": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ "body" ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use." - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - } - ] - }, - "schema": { + "bodyParameter": { "type": "object", - "description": "A deterministic version of a JSON Schema object.", + "required": [ + "name", + "in", + "schema" + ], "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" } }, "properties": { - "$ref": { "type": "string" }, - "format": { "type": "string" }, - "title": { "$ref": "http://json-schema.org/draft-04/schema#/properties/title" }, - "description": { "$ref": "http://json-schema.org/draft-04/schema#/properties/description" }, - "default": { "$ref": "http://json-schema.org/draft-04/schema#/properties/default" }, - "multipleOf": { "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" }, - "maximum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" }, - "exclusiveMaximum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" }, - "minimum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" }, - "exclusiveMinimum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" }, - "maxLength": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, - "minLength": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, - "pattern": { "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" }, - "discriminator": { "type": "string" }, - "xml": { "$ref": "#/definitions/xml"}, - "items": { - "anyOf": [ - { "$ref": "#/definitions/schema" }, - { - "type": "array", - "minItems": 1, - "items": { "$ref": "#/definitions/schema" } - } - ], - "default": { } - }, - "maxItems": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, - "minItems": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, - "uniqueItems": { "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" }, - "maxProperties": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }, - "minProperties": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }, - "required": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" }, - "externalDocs": { "$ref": "#/definitions/externalDocs" }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#/definitions/schema" }, - "default": { } + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." }, - "enum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" }, - "type": { "$ref": "http://json-schema.org/draft-04/schema#/properties/type" }, - "example": { - + "name": { + "type": "string", + "description": "The name of the parameter." }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#/definitions/schema" } + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "body" + ] + }, + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "schema": { + "$ref": "#/definitions/schema" } - } - }, - "security": { - "description": "defines security definitions" - }, - "securityRequirement": { - "description": "defines a security requirement", - "type": "array" - }, - "xml": { - "properties": { - "name": { "type": "string"}, - "namespace": { "type": "string" }, - "prefix": { "type": "string" }, - "attribute": { "type": "boolean" }, - "wrapped": { "type": "boolean" } }, "additionalProperties": false }, - "tag": { - "type": "object", - "properties": { - "externalDocs": { "$ref": "#/definitions/externalDocs" } - }, + "headerParameterSubSchema": { + "additionalProperties": false, "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false }, - "^/.*[^\/]$": { + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "header" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "queryParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "formDataParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "formData" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "pathParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "enum": [ + true + ], + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "path" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "nonBodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "type" + ], + "oneOf": [ + { + "$ref": "#/definitions/headerParameterSubSchema" + }, + { + "$ref": "#/definitions/formDataParameterSubSchema" + }, + { + "$ref": "#/definitions/queryParameterSubSchema" + }, + { + "$ref": "#/definitions/pathParameterSubSchema" + } + ] + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/bodyParameter" + }, + { + "$ref": "#/definitions/nonBodyParameter" + } + ] + }, + "schema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "maxProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + } + ], + "default": {} + }, + "allOf": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} + }, + "discriminator": { + "type": "string" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/xml" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + } + }, + "primitivesItems": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + }, + "uniqueItems": true + }, + "securityRequirement": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "xml": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + } + }, + "tag": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "securityDefinitions": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/basicAuthenticationSecurity" + }, + { + "$ref": "#/definitions/apiKeySecurity" + }, + { + "$ref": "#/definitions/oauth2ImplicitSecurity" + }, + { + "$ref": "#/definitions/oauth2PasswordSecurity" + }, + { + "$ref": "#/definitions/oauth2ApplicationSecurity" + }, + { + "$ref": "#/definitions/oauth2AccessCodeSecurity" + } + ] + } + }, + "basicAuthenticationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "basic" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "apiKeySecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "name", + "in" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "apiKey" + ] + }, + "name": { + "type": "string" + }, + "in": { + "type": "string", + "enum": [ + "header", + "query" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ImplicitSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "implicit" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2PasswordSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "password" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ApplicationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "application" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2AccessCodeSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "accessCode" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2Scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mediaTypeList": { + "type": "array", + "items": { + "$ref": "#/definitions/mimeType" + }, + "uniqueItems": true + }, + "parametersList": { + "type": "array", + "description": "The parameters needed to send a valid API call.", + "minItems": 1, + "additionalItems": false, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/parameter" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "uniqueItems": true + }, + "schemesList": { + "type": "array", + "description": "The transfer protocol of the API.", + "items": { + "type": "string", + "enum": [ + "http", + "https", + "ws", + "wss" + ] + }, + "uniqueItems": true + }, + "collectionFormat": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], + "default": "csv" + }, + "collectionFormatWithMulti": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes", + "multi" + ], + "default": "csv" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "jsonReference": { + "type": "object", + "additionalProperties": false, + "properties": { + "$ref": { "type": "string" } } } } -} +} \ No newline at end of file diff --git a/src/test/scala/ResourcesTest.scala b/src/test/scala/ResourcesTest.scala index 5c624cafcd..9ca0dfc740 100644 --- a/src/test/scala/ResourcesTest.scala +++ b/src/test/scala/ResourcesTest.scala @@ -152,12 +152,12 @@ class ResourcesTest extends FlatSpec with ShouldMatchers with TestBase { report.isSuccess should be (true) } - it should "validate online petstore" in { + /* it should "validate online petstore" in { val json = Source.fromURL("http://petstore.swagger.wordnik.com/v2/swagger.json").getLines.filter(!_.startsWith("//")).mkString val data = JsonLoader.fromString(json) val report = jsonSchema.validate(data) if(report.isSuccess == false) println(report) report.isSuccess should be (true) - } + }*/ } diff --git a/src/test/scala/TestBase.scala b/src/test/scala/TestBase.scala index 65db1ca864..2bdb11f4c6 100644 --- a/src/test/scala/TestBase.scala +++ b/src/test/scala/TestBase.scala @@ -8,7 +8,7 @@ import scala.io.Source **/ trait TestBase { val mapper = new ObjectMapper - val host = "https://raw.githubusercontent.com/wordnik/swagger-spec/master/schemas/v2.0/schema.json" + val host = "https://raw.githubusercontent.com/webron/swagger-spec/master/schemas/v2.0/schema.json" // val host = "http://localhost:8000/schema.json" def readSchema(makeQualified: Boolean = true) = { @@ -23,4 +23,4 @@ trait TestBase { }.mkString mapper.readTree(lines) } -} \ No newline at end of file +}