From 23e03fb97859c18eb1537f195c94974ef87bffbb Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 13:32:35 +0300 Subject: [PATCH 01/45] Changed swagger version from number to string --- schemas/v2.0/schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index e84fdd4447..d3ec84c64e 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -12,8 +12,8 @@ }, "properties": { "swagger": { - "type": "number", - "enum": [ 2.0 ], + "type": "string", + "enum": [ "2.0" ], "description": "The Swagger version of this document." }, "info": { From feced8d5cb5c535a02cfa5834a99e414ff7ca4f3 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 13:35:47 +0300 Subject: [PATCH 02/45] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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! From 70ad2826877ad15e41acad90d19c8b4fde63aa22 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 13:52:24 +0300 Subject: [PATCH 03/45] Fixed swagger version in samples --- examples/v2.0/json/petstore-expanded.json | 2 +- examples/v2.0/json/petstore-simple.json | 2 +- examples/v2.0/json/petstore-with-external-docs.json | 2 +- examples/v2.0/json/petstore.json | 2 +- fixtures/v2.0/json/resources/cascadingSchemes.json | 2 +- fixtures/v2.0/json/resources/commonParameters.json | 2 +- fixtures/v2.0/json/resources/multipleMimeTypes.json | 2 +- fixtures/v2.0/json/resources/resourceWithExamplePayload.json | 2 +- fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json | 2 +- fixtures/v2.0/json/resources/resourceWithRelativeHost.json | 2 +- fixtures/v2.0/json/resources/reusableParameters.json | 2 +- fixtures/v2.0/json/resources/securityExample.json | 2 +- fixtures/v2.0/json/resources/stringPathParamResource.json | 2 +- fixtures/v2.0/json/resources/taggedResource.json | 2 +- fixtures/v2.0/json/resources/vendorExtensionExamples.json | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) 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..6a30375d13 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", 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..d4bb966c80 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", 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..9166633da8 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", 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..51146eacde 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 }, 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 }, From 2823bbca0a5b4f1fd2fce0c529c5459375572d02 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 13:59:29 +0300 Subject: [PATCH 04/45] Disabled online petstore test while modifying the schema --- src/test/scala/ResourcesTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/scala/ResourcesTest.scala b/src/test/scala/ResourcesTest.scala index 5c624cafcd..b4777b4157 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) - } + }// } From 291dbd96a16ae1c76bb9ead50cfbfe003334b81f Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 14:04:02 +0300 Subject: [PATCH 05/45] Fixed yaml sample swagger version --- examples/v2.0/yaml/petstore-expanded.yaml | 2 +- examples/v2.0/yaml/petstore.yaml | 2 +- examples/v2.0/yaml/uber.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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..44c3f2d1bf 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 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 From 60c666cf354447e05128980ce5d55d3fe92e3a22 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 22 Sep 2014 14:08:02 +0300 Subject: [PATCH 06/45] Apparently, I can't even comment properly. --- src/test/scala/ResourcesTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/ResourcesTest.scala b/src/test/scala/ResourcesTest.scala index b4777b4157..9ca0dfc740 100644 --- a/src/test/scala/ResourcesTest.scala +++ b/src/test/scala/ResourcesTest.scala @@ -159,5 +159,5 @@ class ResourcesTest extends FlatSpec with ShouldMatchers with TestBase { if(report.isSuccess == false) println(report) report.isSuccess should be (true) - }// + }*/ } From 27310fb805abc55088d0292dd684fc8344483e60 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 20:34:34 +0300 Subject: [PATCH 07/45] Pushing partial schema updates --- schemas/v2.0/schema.json | 506 +++++++++++++++++++++++++-------------- 1 file changed, 329 insertions(+), 177 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index d3ec84c64e..abbe65338f 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-": { @@ -13,19 +16,18 @@ "properties": { "swagger": { "type": "string", - "enum": [ "2.0" ], + "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": "^((?!\\://).)*$", "description": "The fully qualified URI to the host of the API." }, "basePath": { @@ -34,78 +36,49 @@ "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/parametersDefinitions" + }, + "responses": { + "$ref": "#/definitions/responses" + }, + "security": { + "$ref": "#/definitions/security" }, - "responses": { "$ref": "#/definitions/responses" }, - "security": { "$ref": "#/definitions/security" }, "tags": { "type": "array", "items": { "$ref": "#/definitions/tag" } + }, + "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 +86,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." @@ -152,7 +125,9 @@ }, "license": { "type": "object", - "required": [ "name" ], + "required": [ + "name" + ], "additionalProperties": false, "properties": { "name": { @@ -168,6 +143,50 @@ } } }, + "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", + "description": "One or more JSON objects describing the schemas being consumed and produced by the API.", + "additionalProperties": { + "$ref": "#/definitions/schema" + } + }, + "parameterDefinitions": { + "type": "object", + "description": "One or more JSON representations for parameters", + "additionalProperties": { + "$ref": "#/definitions/parameter" + } + }, + "externalDocs": { + "type": "object", + "additionalProperties": false, + "description": "information about external documentation", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + } + }, "example": { "type": "object", "patternProperties": { @@ -182,7 +201,9 @@ }, "operation": { "type": "object", - "required": [ "responses" ], + "required": [ + "responses" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -194,7 +215,8 @@ "type": "array", "items": { "type": "string" - } + }, + "uniqueItems": true }, "summary": { "type": "string", @@ -212,51 +234,25 @@ "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" @@ -297,10 +293,7 @@ "$ref": "#/definitions/operation" }, "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameter" - } + "$ref": "#/definitions/parametersList" } } }, @@ -320,7 +313,9 @@ }, "response": { "type": "object", - "required": [ "description" ], + "required": [ + "description" + ], "properties": { "description": { "type": "string" @@ -344,7 +339,14 @@ "properties": { "type": { "type": "string", - "enum": [ "string", "number", "boolean", "integer", "array", "file" ] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] }, "format": { "type": "string" @@ -364,35 +366,77 @@ }, "parameter": { "type": "object", - "required": [ "name", "in" ], + "required": [ + "name", + "in" + ], + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + } + }, "oneOf": [ { - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" + "required": [ + "type" + ], + "oneOf": [ + { + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query", + "header", + "formData" + ] + } + } + }, + { + "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" + ] + } + } } - }, + ], "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" ] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] }, "format": { "type": "string" @@ -403,28 +447,26 @@ "collectionFormat": { "type": "string" } - }, - "additionalProperties": false + } }, { - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, + "required": [ + "schema" + ], "properties": { "name": { "type": "string", + "enum": [ + "body" + ], "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." + "enum": [ + "body" + ] }, "required": { "type": "boolean", @@ -433,10 +475,10 @@ "schema": { "$ref": "#/definitions/schema" } - }, - "additionalProperties": false + } } - ] + ], + "additionalProperties": false }, "schema": { "type": "object", @@ -447,53 +489,107 @@ } }, "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"}, + "$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" }, + { + "$ref": "#/definitions/schema" + }, { "type": "array", "minItems": 1, - "items": { "$ref": "#/definitions/schema" } + "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" }, + "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": { } + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} }, - "enum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" }, - "type": { "$ref": "http://json-schema.org/draft-04/schema#/properties/type" }, - "example": { - + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "example": {}, "allOf": { "type": "array", "minItems": 1, - "items": { "$ref": "#/definitions/schema" } + "items": { + "$ref": "#/definitions/schema" + } } } }, @@ -506,27 +602,83 @@ }, "xml": { "properties": { - "name": { "type": "string"}, - "namespace": { "type": "string" }, - "prefix": { "type": "string" }, - "attribute": { "type": "boolean" }, - "wrapped": { "type": "boolean" } + "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" } + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } }, "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" }, - "^/.*[^\/]$": { + "^/.*[^/]$": { "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" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "$ref": { + "type": "string" + } + } + } + ] + }, + "uniqueItems": true + }, + "schemesList": { + "type": "array", + "description": "The transfer protocol of the API.", + "items": { + "type": "string", + "enum": [ + "http", + "https", + "ws", + "wss" + ] + }, + "uniqueItems": true } } -} +} \ No newline at end of file From 56a77391cb58aa0b78a2822c6cde784d850b19d0 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 21:08:51 +0300 Subject: [PATCH 08/45] Update TestBase.scala --- src/test/scala/TestBase.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +} From 0cc482937658e6e6897a698c55d6b7766ffa1630 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 21:47:42 +0300 Subject: [PATCH 09/45] fixed parameter definitions reference --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index abbe65338f..68dee64ef9 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -53,7 +53,7 @@ "$ref": "#/definitions/definitions" }, "parameters": { - "$ref": "#/definitions/parametersDefinitions" + "$ref": "#/definitions/parameterDefinitions" }, "responses": { "$ref": "#/definitions/responses" From 052f43b5a8c26c61b78b25192fca8cd21c28bcda Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 21:52:23 +0300 Subject: [PATCH 10/45] fixed additional properties for parameter --- schemas/v2.0/schema.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 68dee64ef9..186fbfbf77 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -402,7 +402,8 @@ "formData" ] } - } + }, + "additionalProperties": false }, { "properties": { @@ -420,7 +421,8 @@ "path" ] } - } + }, + "additionalProperties": false } ], "properties": { @@ -453,6 +455,7 @@ "required": [ "schema" ], + "additionalProperties": false, "properties": { "name": { "type": "string", @@ -477,8 +480,7 @@ } } } - ], - "additionalProperties": false + ] }, "schema": { "type": "object", From 478465273ef38422ea5f0878234a8872c2f3616c Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 22:08:52 +0300 Subject: [PATCH 11/45] another attempt to fix parameters --- schemas/v2.0/schema.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 186fbfbf77..7551e9a5f5 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -402,8 +402,7 @@ "formData" ] } - }, - "additionalProperties": false + } }, { "properties": { @@ -421,8 +420,7 @@ "path" ] } - }, - "additionalProperties": false + } } ], "properties": { @@ -449,7 +447,8 @@ "collectionFormat": { "type": "string" } - } + }, + "additionalProperties": false }, { "required": [ From 6c84a766edc47b96942e4b3c50605f64ddfcc224 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 22:22:26 +0300 Subject: [PATCH 12/45] and another attempt --- schemas/v2.0/schema.json | 190 +++++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 89 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 7551e9a5f5..f31492644b 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -370,114 +370,126 @@ "name", "in" ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." - } - }, - "oneOf": [ + "allOf": [ + { + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + } + } + }, { - "required": [ - "type" - ], "oneOf": [ { - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query", - "header", - "formData" + "required": [ + "type" + ], + "allOf": [ + { + "oneOf": [ + { + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query", + "header", + "formData" + ] + } + } + }, + { + "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" + ] + } + } + } ] + }, + { + "properties": { + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "type": "object" + }, + "collectionFormat": { + "type": "string" + } + }, + "additionalProperties": false } - } + ] }, { + "required": [ + "schema" + ], + "additionalProperties": false, "properties": { - "required": { - "type": "boolean", + "name": { + "type": "string", "enum": [ - true + "body" ], - "description": "Determines whether or not this parameter is required or optional." + "description": "The name of the parameter." }, "in": { "type": "string", "description": "Determines the location of the parameter.", "enum": [ - "path" + "body" ] + }, + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional." + }, + "schema": { + "$ref": "#/definitions/schema" } } } - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "type": "object" - }, - "collectionFormat": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "required": [ - "schema" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "enum": [ - "body" - ], - "description": "The name of the parameter." - }, - "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." - }, - "schema": { - "$ref": "#/definitions/schema" - } - } + ] } ] }, From 171e4e9e248822bb06a10e71a92e7b088f902fcc Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 22:42:23 +0300 Subject: [PATCH 13/45] and another --- schemas/v2.0/schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index f31492644b..e019d9bbb5 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -370,7 +370,7 @@ "name", "in" ], - "allOf": [ + "anyOf": [ { "patternProperties": { "^x-": { @@ -390,7 +390,7 @@ "required": [ "type" ], - "allOf": [ + "anyOf": [ { "oneOf": [ { From 4061a2b152af592e508818af86df949e406c2c95 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 23 Sep 2014 22:59:18 +0300 Subject: [PATCH 14/45] hopefully a final fix --- schemas/v2.0/schema.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index e019d9bbb5..d64e767295 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -370,6 +370,7 @@ "name", "in" ], + "additionalProperties": false, "anyOf": [ { "patternProperties": { @@ -455,8 +456,7 @@ "collectionFormat": { "type": "string" } - }, - "additionalProperties": false + } } ] }, @@ -464,7 +464,6 @@ "required": [ "schema" ], - "additionalProperties": false, "properties": { "name": { "type": "string", From 29769fd84452fb9da5583ca900f977554fb3f564 Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 30 Sep 2014 22:57:55 +0300 Subject: [PATCH 15/45] changes to the parameter object --- schemas/v2.0/schema.json | 240 ++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 103 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index d64e767295..1d82e9b760 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -364,131 +364,165 @@ "additionalProperties": true, "additionalItems": true }, - "parameter": { + "bodyParameter": { "type": "object", "required": [ "name", - "in" + "in", + "schema" ], - "additionalProperties": false, - "anyOf": [ + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed." + }, + "name": { + "type": "string", + "enum": [ + "body" + ], + "description": "The name of the parameter." + }, + "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." + }, + "schema": { + "$ref": "#/definitions/schema" + } + }, + "additionalProperties": false + }, + "nonBodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "type" + ], + "oneOf": [ { + "additionalProperties": false, "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" } }, "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query", + "header", + "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" + ] + }, + "format": { + "type": "string" + }, + "items": { + "type": "object" + }, + "collectionFormat": { + "type": "string" } } }, { - "oneOf": [ - { - "required": [ - "type" + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "enum": [ + true ], - "anyOf": [ - { - "oneOf": [ - { - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query", - "header", - "formData" - ] - } - } - }, - { - "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" - ] - } - } - } - ] - }, - { - "properties": { - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "type": "object" - }, - "collectionFormat": { - "type": "string" - } - } - } + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "path" ] }, - { - "required": [ - "schema" - ], - "properties": { - "name": { - "type": "string", - "enum": [ - "body" - ], - "description": "The name of the parameter." - }, - "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." - }, - "schema": { - "$ref": "#/definitions/schema" - } - } + "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": { + "type": "object" + }, + "collectionFormat": { + "type": "string" } - ] + } + } + ] + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/bodyParameter" + }, + { + "$ref": "#/definitions/nonBodyParameter" } ] }, From e3ad0054f4d141995fec10bc5b84b52fd199fdae Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 30 Sep 2014 23:34:24 +0300 Subject: [PATCH 16/45] removed body param name constraint --- schemas/v2.0/schema.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 1d82e9b760..ddfa54258c 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -383,9 +383,6 @@ }, "name": { "type": "string", - "enum": [ - "body" - ], "description": "The name of the parameter." }, "in": { From ec2d0728f82468cb11ba318ad186086a0f9c66c3 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 14:08:28 +0300 Subject: [PATCH 17/45] even more changes --- schemas/v2.0/schema.json | 224 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 217 insertions(+), 7 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index ddfa54258c..28862eb087 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -56,7 +56,7 @@ "$ref": "#/definitions/parameterDefinitions" }, "responses": { - "$ref": "#/definitions/responses" + "$ref": "#/definitions/responseDefinitions" }, "security": { "$ref": "#/definitions/security" @@ -170,6 +170,13 @@ "$ref": "#/definitions/parameter" } }, + "responseDefinitions": { + "type": "object", + "description": "One or more JSON representations for parameters", + "additionalProperties": { + "$ref": "#/definitions/response" + } + }, "externalDocs": { "type": "object", "additionalProperties": false, @@ -304,13 +311,29 @@ "additionalProperties": false, "patternProperties": { "^([0-9]+)$|^(default)$": { - "$ref": "#/definitions/response" + "$ref": "#/definitions/responseValue" }, "^x-": { "$ref": "#/definitions/vendorExtension" } } }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "$ref": { + "type": "string" + } + } + } + ] + }, "response": { "type": "object", "required": [ @@ -446,17 +469,57 @@ "number", "boolean", "integer", - "array" + "array", + "file" ] }, "format": { "type": "string" }, "items": { - "type": "object" + "$ref": "#/definitions/primitivesItems" }, "collectionFormat": { - "type": "string" + "$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" } } }, @@ -504,10 +567,49 @@ "type": "string" }, "items": { - "type": "object" + "$ref": "#/definitions/primitivesItems" }, "collectionFormat": { - "type": "string" + "$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" } } } @@ -636,6 +738,70 @@ } } }, + "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": { "description": "defines security definitions" }, @@ -722,6 +888,50 @@ ] }, "uniqueItems": true + }, + "collectionFormat": { + "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" } } } \ No newline at end of file From dc991acd0f9dbe5a8ba831136dd126dfbe6c8ba8 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 14:33:19 +0300 Subject: [PATCH 18/45] added missing validation definitions --- schemas/v2.0/schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 28862eb087..997af0f774 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -932,6 +932,15 @@ }, "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" } } } \ No newline at end of file From 7facf9ff8344d5603888870218f8f9212a357b74 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 14:40:49 +0300 Subject: [PATCH 19/45] fixed headers, added enum def --- schemas/v2.0/schema.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 997af0f774..961b26e9d8 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -347,10 +347,7 @@ "$ref": "#/definitions/schema" }, "headers": { - "type": "array", - "items": { - "$ref": "#/definitions/serializableType" - } + "$ref": "#/definitions/headers" }, "examples": { "$ref": "#/definitions/example" @@ -358,6 +355,12 @@ }, "additionalProperties": false }, + "headers": { + "type": "object", + "additionalProperties": { + "$ref": "serializableType" + } + }, "serializableType": { "properties": { "type": { @@ -941,6 +944,9 @@ }, "uniqueItems": { "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" } } } \ No newline at end of file From 3317ffd2a9e0ad842e0097aafb7883b87eed5c28 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 14:49:21 +0300 Subject: [PATCH 20/45] fixed headers --- schemas/v2.0/schema.json | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 961b26e9d8..aaf610ba3d 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -358,31 +358,7 @@ "headers": { "type": "object", "additionalProperties": { - "$ref": "serializableType" - } - }, - "serializableType": { - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "type": "object" - }, - "collectionFormat": { - "type": "string" - } + "$ref": "#/definitions/primitivesItems" } }, "vendorExtension": { From dc856bf764c082572c23a65e4a7aaa95b2f72f62 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 15:01:56 +0300 Subject: [PATCH 21/45] fixed samples/fixtures to support proper headers format --- examples/v2.0/json/petstore.json | 4 ++-- .../v2.0/json/responses/stringResponseWithHeader.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/v2.0/json/petstore.json b/examples/v2.0/json/petstore.json index d4bb966c80..b1ab216098 100644 --- a/examples/v2.0/json/petstore.json +++ b/examples/v2.0/json/petstore.json @@ -31,11 +31,11 @@ "$ref": "#/definitions/Pet" } }, - "headers": [{ + "headers": { "x-expires": { "type": "string" } - }] + } }, "default": { "description": "unexpected error", 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 From 5db5bf00709db9ac541e36f75e972872e5efa67c Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 15:09:18 +0300 Subject: [PATCH 22/45] fixed yaml sample? --- examples/v2.0/yaml/petstore.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v2.0/yaml/petstore.yaml b/examples/v2.0/yaml/petstore.yaml index 44c3f2d1bf..d89a6f821f 100644 --- a/examples/v2.0/yaml/petstore.yaml +++ b/examples/v2.0/yaml/petstore.yaml @@ -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: From f861d6792376cd03189821f19d51196d8b11935d Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 15:23:39 +0300 Subject: [PATCH 23/45] trying a weird fix --- schemas/v2.0/schema.json | 1 - 1 file changed, 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index aaf610ba3d..5e24298fbc 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -325,7 +325,6 @@ }, { "type": "object", - "additionalProperties": false, "properties": { "$ref": { "type": "string" From f99da221c0f03059ce87c13665e19b9161261020 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 15:33:26 +0300 Subject: [PATCH 24/45] another fix attempt --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 5e24298fbc..c750d24d1e 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -325,6 +325,7 @@ }, { "type": "object", + "additionalProperties": false, "properties": { "$ref": { "type": "string" @@ -718,7 +719,6 @@ }, "primitivesItems": { "type": "object", - "additionalProperties": false, "properties": { "type": { "type": "string", From 0f3f00f1b4f8dfc9541845217e4f6849a7252e93 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 1 Oct 2014 15:41:24 +0300 Subject: [PATCH 25/45] proper fix --- schemas/v2.0/schema.json | 70 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index c750d24d1e..02a696443c 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -358,9 +358,76 @@ "headers": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/primitivesItems" + "$ref": "#/definitions/header" } }, + "header": { + "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" + }, + "description": { + "type": "string" + } + } + }, "vendorExtension": { "description": "Any property starting with x- is valid.", "additionalProperties": true, @@ -719,6 +786,7 @@ }, "primitivesItems": { "type": "object", + "additionalProperties": false, "properties": { "type": { "type": "string", From 3d44bb779821db5dad97036bd17d252c0b944fdc Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 7 Oct 2014 18:38:18 +0300 Subject: [PATCH 26/45] finished overview of existing definitions --- schemas/v2.0/schema.json | 125 +++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 02a696443c..cc25848edd 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -158,6 +158,7 @@ }, "definitions": { "type": "object", + "additionalProperties": false, "description": "One or more JSON objects describing the schemas being consumed and produced by the API.", "additionalProperties": { "$ref": "#/definitions/schema" @@ -165,6 +166,7 @@ }, "parameterDefinitions": { "type": "object", + "additionalProperties": false, "description": "One or more JSON representations for parameters", "additionalProperties": { "$ref": "#/definitions/parameter" @@ -172,6 +174,7 @@ }, "responseDefinitions": { "type": "object", + "additionalProperties": false, "description": "One or more JSON representations for parameters", "additionalProperties": { "$ref": "#/definitions/response" @@ -194,7 +197,7 @@ } } }, - "example": { + "examples": { "type": "object", "patternProperties": { "^[a-z0-9-]+/[a-z0-9\\-+]+$": {} @@ -324,13 +327,7 @@ "$ref": "#/definitions/response" }, { - "type": "object", - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } - } + "$ref": "#/definitions/jsonReference" } ] }, @@ -350,7 +347,7 @@ "$ref": "#/definitions/headers" }, "examples": { - "$ref": "#/definitions/example" + "$ref": "#/definitions/examples" } }, "additionalProperties": false @@ -362,7 +359,7 @@ } }, "header": { - "type": "object", + "type": "object", "additionalProperties": false, "properties": { "type": { @@ -427,7 +424,7 @@ "type": "string" } } - }, + }, "vendorExtension": { "description": "Any property starting with x- is valid.", "additionalProperties": true, @@ -719,27 +716,6 @@ "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" }, @@ -758,30 +734,55 @@ "required": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, "enum": { "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" }, "type": { "$ref": "http://json-schema.org/draft-04/schema#/properties/type" }, - "example": {}, + "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": { @@ -867,17 +868,29 @@ "type": "string" }, "attribute": { - "type": "boolean" + "type": "boolean", + "default": false }, "wrapped": { - "type": "boolean" + "type": "boolean", + "default": false } }, "additionalProperties": false }, "tag": { "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, "externalDocs": { "$ref": "#/definitions/externalDocs" } @@ -885,9 +898,6 @@ "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" - }, - "^/.*[^/]$": { - "type": "string" } } }, @@ -909,13 +919,7 @@ "$ref": "#/definitions/parameter" }, { - "type": "object", - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } - } + "$ref": "#/definitions/jsonReference" } ] }, @@ -990,6 +994,15 @@ }, "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 From 068d54ac89e40aefc696c14fd34aea1c8d74b0fa Mon Sep 17 00:00:00 2001 From: webron Date: Tue, 7 Oct 2014 22:04:23 +0300 Subject: [PATCH 27/45] fixed fixture for testing --- fixtures/v2.0/json/resources/taggedResource.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixtures/v2.0/json/resources/taggedResource.json b/fixtures/v2.0/json/resources/taggedResource.json index 51146eacde..19394c70d1 100644 --- a/fixtures/v2.0/json/resources/taggedResource.json +++ b/fixtures/v2.0/json/resources/taggedResource.json @@ -33,7 +33,7 @@ ], "tags": [ { - "foo": "bar" + "name": "pets" } ], "paths": { From f9093cf76ef843d3426687b53de9122095fa3880 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 8 Oct 2014 22:09:46 +0300 Subject: [PATCH 28/45] added securityDefinitions --- schemas/v2.0/schema.json | 234 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 225 insertions(+), 9 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index cc25848edd..3a3e7049db 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -61,6 +61,9 @@ "security": { "$ref": "#/definitions/security" }, + "securityDefinitions": { + "$ref": "#/definitions/securityDefinitions" + }, "tags": { "type": "array", "items": { @@ -158,27 +161,24 @@ }, "definitions": { "type": "object", - "additionalProperties": false, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API.", "additionalProperties": { "$ref": "#/definitions/schema" - } + }, + "description": "One or more JSON objects describing the schemas being consumed and produced by the API." }, "parameterDefinitions": { "type": "object", - "additionalProperties": false, - "description": "One or more JSON representations for parameters", "additionalProperties": { "$ref": "#/definitions/parameter" - } + }, + "description": "One or more JSON representations for parameters" }, "responseDefinitions": { "type": "object", - "additionalProperties": false, - "description": "One or more JSON representations for parameters", "additionalProperties": { "$ref": "#/definitions/response" - } + }, + "description": "One or more JSON representations for parameters" }, "externalDocs": { "type": "object", @@ -901,6 +901,222 @@ } } }, + "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" + } + } + }, + "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" + } + } + }, + "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" + } + } + }, + "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" + } + } + }, + "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" + } + } + }, + "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" + } + } + }, + "oauth2Scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "mediaTypeList": { "type": "array", "items": { From 74fcbc546a82aff547bcc199dffe7875fabf0f99 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 8 Oct 2014 22:46:43 +0300 Subject: [PATCH 29/45] added security definitions --- schemas/v2.0/schema.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 3a3e7049db..5c6304bf75 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -265,7 +265,7 @@ "default": false }, "security": { - "$ref": "#/definitions/securityRequirement" + "$ref": "#/definitions/security" } } }, @@ -850,11 +850,21 @@ } }, "security": { - "description": "defines security definitions" + "type": "array", + "items": { + "$ref": "securityRequirement" + }, + "uniqueItems": true }, "securityRequirement": { - "description": "defines a security requirement", - "type": "array" + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } }, "xml": { "properties": { From d39a9335fcca72d4cfcbe4ae963d4d1afbc8a441 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 8 Oct 2014 22:58:58 +0300 Subject: [PATCH 30/45] fixed securityRequirement reference --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 5c6304bf75..d54e013c23 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -852,7 +852,7 @@ "security": { "type": "array", "items": { - "$ref": "securityRequirement" + "$ref": "#/definitions/securityRequirement" }, "uniqueItems": true }, From b9c7f35670a5dd0241ae38b518b9928dc024e8a6 Mon Sep 17 00:00:00 2001 From: webron Date: Wed, 8 Oct 2014 23:14:55 +0300 Subject: [PATCH 31/45] fixed securityExample.json --- .../v2.0/json/resources/securityExample.json | 114 +++++++++++------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/fixtures/v2.0/json/resources/securityExample.json b/fixtures/v2.0/json/resources/securityExample.json index 9166633da8..e4c482c4db 100644 --- a/fixtures/v2.0/json/resources/securityExample.json +++ b/fixtures/v2.0/json/resources/securityExample.json @@ -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 From 6a31490a872fc6ab1f413cfca235298eaa9f163a Mon Sep 17 00:00:00 2001 From: webron Date: Thu, 9 Oct 2014 20:57:48 +0300 Subject: [PATCH 32/45] moved contact and license to their own objects --- schemas/v2.0/schema.json | 76 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index d54e013c23..c9a3fbd6e8 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -106,43 +106,49 @@ "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" } } }, From dbec4c1c52defdec659da6bd412789d486464348 Mon Sep 17 00:00:00 2001 From: webron Date: Thu, 9 Oct 2014 21:07:32 +0300 Subject: [PATCH 33/45] added a few more default values --- schemas/v2.0/schema.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index c9a3fbd6e8..71b9f668f8 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -466,7 +466,8 @@ }, "required": { "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." + "description": "Determines whether or not this parameter is required or optional.", + "default": false }, "schema": { "$ref": "#/definitions/schema" @@ -492,7 +493,8 @@ "properties": { "required": { "type": "boolean", - "description": "Determines whether or not this parameter is required or optional." + "description": "Determines whether or not this parameter is required or optional.", + "default": false }, "in": { "type": "string", From 8a4a41b48435f33a8e8266547942b6080321a6db Mon Sep 17 00:00:00 2001 From: webron Date: Thu, 9 Oct 2014 21:43:48 +0300 Subject: [PATCH 34/45] Fixed the limit of responses to at least one response. --- schemas/v2.0/schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 71b9f668f8..49a1268284 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -325,6 +325,15 @@ "^x-": { "$ref": "#/definitions/vendorExtension" } + }, + "not": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } } }, "responseValue": { From c3c445fbc1c1842b4817a9024d7e11b06dfdafea Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 11:49:13 +0300 Subject: [PATCH 35/45] added restrictions to the host regex --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 49a1268284..4558d7538b 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -27,7 +27,7 @@ "host": { "type": "string", "format": "uri", - "pattern": "^((?!\\://).)*$", + "pattern": "^[^{}/ :\\]+(?::\\d+)?$", "description": "The fully qualified URI to the host of the API." }, "basePath": { From ea8cbfa5f7650dbea0c69dbc8cf6770c51581e40 Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 12:04:47 +0300 Subject: [PATCH 36/45] fixed host regex escaping --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 4558d7538b..2540620024 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -27,7 +27,7 @@ "host": { "type": "string", "format": "uri", - "pattern": "^[^{}/ :\\]+(?::\\d+)?$", + "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", "description": "The fully qualified URI to the host of the API." }, "basePath": { From 5fffdfd85ff08819981316dcae99ebb7f7324465 Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 12:22:41 +0300 Subject: [PATCH 37/45] Fixed host/basepath in petstore-simple --- examples/v2.0/json/petstore-simple.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/v2.0/json/petstore-simple.json b/examples/v2.0/json/petstore-simple.json index 6a30375d13..0e44295aac 100644 --- a/examples/v2.0/json/petstore-simple.json +++ b/examples/v2.0/json/petstore-simple.json @@ -12,7 +12,8 @@ "name": "MIT" } }, - "host": "petstore.swagger.wordnik.com/api", + "host": "petstore.swagger.wordnik.com", + "basePath": "/api", "schemes": [ "http" ], From 17e37fba040471e93fb87c2d07af9c9f1dbc8fa0 Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 13:10:16 +0300 Subject: [PATCH 38/45] fixed path regex for paths object --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 2540620024..6f94802dcd 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -159,7 +159,7 @@ "^x-": { "$ref": "#/definitions/vendorExtension" }, - "^/.*[^/]$": { + "^/": { "$ref": "#/definitions/pathItem" } }, From b2300f92dc545a040f7d6b9d6d09604b718b9df4 Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 13:19:03 +0300 Subject: [PATCH 39/45] tightened responses name for responses --- schemas/v2.0/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 6f94802dcd..2edd3afb9e 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -319,7 +319,7 @@ "minProperties": 1, "additionalProperties": false, "patternProperties": { - "^([0-9]+)$|^(default)$": { + "^([0-9]{3})$|^(default)$": { "$ref": "#/definitions/responseValue" }, "^x-": { From 5dd79227804e91f36ddb3de9c75a15812121d9a6 Mon Sep 17 00:00:00 2001 From: webron Date: Fri, 10 Oct 2014 19:19:55 +0300 Subject: [PATCH 40/45] fine tuned collectionFormat's multi restrictions --- schemas/v2.0/schema.json | 461 ++++++++++++++++++++++++--------------- 1 file changed, 284 insertions(+), 177 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 2edd3afb9e..d974f4924e 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -484,6 +484,275 @@ }, "additionalProperties": false }, + "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", + "file" + ] + }, + "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" + } + } + }, + "formDataQueryParameterSubSchema": { + "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", + "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", + "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": [ @@ -493,185 +762,13 @@ ], "oneOf": [ { - "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", - "header", - "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/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" - } - } + "$ref": "#/definitions/headerParameterSubSchema" }, { - "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" - } - } + "$ref": "#/definitions/formDataQueryParameterSubSchema" + }, + { + "$ref": "#/definitions/pathParameterSubSchema" } ] }, @@ -1183,6 +1280,16 @@ "uniqueItems": true }, "collectionFormat": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], + "default": "csv" + }, + "collectionFormatWithMulti": { "type": "string", "enum": [ "csv", From 3873cab9b14158b8895d957655ad9d839a9daeea Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 13 Oct 2014 13:23:29 +0300 Subject: [PATCH 41/45] Fine-tuned parameter's file usage --- schemas/v2.0/schema.json | 98 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index d974f4924e..97960f12be 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -519,8 +519,7 @@ "number", "boolean", "integer", - "array", - "file" + "array" ] }, "format": { @@ -573,7 +572,95 @@ } } }, - "formDataQueryParameterSubSchema": { + "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": [ + "formData", + "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-": { @@ -765,7 +852,10 @@ "$ref": "#/definitions/headerParameterSubSchema" }, { - "$ref": "#/definitions/formDataQueryParameterSubSchema" + "$ref": "#/definitions/formDataParameterSubSchema" + }, + { + "$ref": "#/definitions/queryParameterSubSchema" }, { "$ref": "#/definitions/pathParameterSubSchema" From b5cefa237d256f0309679c0aa0ccc36010ff5be3 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 13 Oct 2014 13:32:43 +0300 Subject: [PATCH 42/45] fixed parameter type splitting --- schemas/v2.0/schema.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 97960f12be..6f7e6cbb1b 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -589,7 +589,6 @@ "type": "string", "description": "Determines the location of the parameter.", "enum": [ - "formData", "query" ] }, @@ -608,7 +607,8 @@ "number", "boolean", "integer", - "array" ] + "array" + ] }, "format": { "type": "string" @@ -677,8 +677,7 @@ "type": "string", "description": "Determines the location of the parameter.", "enum": [ - "formData", - "query" + "formData" ] }, "description": { From dd2c06dbaa2262daa613d7e109f8e4a9ba5da265 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 13 Oct 2014 13:55:49 +0300 Subject: [PATCH 43/45] fixed xml's type --- schemas/v2.0/schema.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 6f7e6cbb1b..8839b22fae 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -1070,6 +1070,8 @@ } }, "xml": { + "type": "object", + "additionalProperties": false, "properties": { "name": { "type": "string" @@ -1088,8 +1090,7 @@ "type": "boolean", "default": false } - }, - "additionalProperties": false + } }, "tag": { "type": "object", From 5cd36be0f57a35986ff7efafc170cea2944b2824 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 13 Oct 2014 14:05:10 +0300 Subject: [PATCH 44/45] added additional uniqueItem constraints --- schemas/v2.0/schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 8839b22fae..794d58e38b 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -68,7 +68,8 @@ "type": "array", "items": { "$ref": "#/definitions/tag" - } + }, + "uniqueItems": true }, "externalDocs": { "$ref": "#/definitions/externalDocs" From a70047b295abc3b43d7ed8aaacad133fab9980b6 Mon Sep 17 00:00:00 2001 From: webron Date: Mon, 13 Oct 2014 14:09:13 +0300 Subject: [PATCH 45/45] added vendor extensions to security defs --- schemas/v2.0/schema.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index 794d58e38b..9bdd087617 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -1157,6 +1157,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "apiKeySecurity": { @@ -1187,6 +1192,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "oauth2ImplicitSecurity": { @@ -1220,6 +1230,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "oauth2PasswordSecurity": { @@ -1253,6 +1268,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "oauth2ApplicationSecurity": { @@ -1286,6 +1306,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "oauth2AccessCodeSecurity": { @@ -1324,6 +1349,11 @@ "description": { "type": "string" } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } }, "oauth2Scopes": {