From b5d64c9c43de7b5ce1dce0047fb601d31d521095 Mon Sep 17 00:00:00 2001 From: Yuriy Chernyshov Date: Tue, 6 Oct 2015 14:08:32 +0300 Subject: [PATCH 0001/1801] Fixed invalid urls --- schemas/v1.2/apiDeclaration.json | 2 +- schemas/v1.2/authorizationObject.json | 2 +- schemas/v1.2/dataType.json | 2 +- schemas/v1.2/dataTypeBase.json | 2 +- schemas/v1.2/infoObject.json | 2 +- schemas/v1.2/modelsObject.json | 2 +- schemas/v1.2/oauth2GrantType.json | 2 +- schemas/v1.2/operationObject.json | 2 +- schemas/v1.2/parameterObject.json | 2 +- schemas/v1.2/resourceListing.json | 2 +- schemas/v1.2/resourceObject.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/schemas/v1.2/apiDeclaration.json b/schemas/v1.2/apiDeclaration.json index e4d262a08e..79fb714947 100644 --- a/schemas/v1.2/apiDeclaration.json +++ b/schemas/v1.2/apiDeclaration.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/apiDeclaration.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/apiDeclaration.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "swaggerVersion", "basePath", "apis" ], diff --git a/schemas/v1.2/authorizationObject.json b/schemas/v1.2/authorizationObject.json index 70699cffce..5a82d9a449 100644 --- a/schemas/v1.2/authorizationObject.json +++ b/schemas/v1.2/authorizationObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/authorizationObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/authorizationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": { diff --git a/schemas/v1.2/dataType.json b/schemas/v1.2/dataType.json index 7e8989189f..a438a968d8 100644 --- a/schemas/v1.2/dataType.json +++ b/schemas/v1.2/dataType.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/dataType.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/dataType.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "Data type as described by the specification (version 1.2)", "type": "object", diff --git a/schemas/v1.2/dataTypeBase.json b/schemas/v1.2/dataTypeBase.json index 9b3c5ba5ac..dd8e09fd8d 100644 --- a/schemas/v1.2/dataTypeBase.json +++ b/schemas/v1.2/dataTypeBase.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/dataTypeBase.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/dataTypeBase.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "Data type fields (section 4.3.3)", "type": "object", diff --git a/schemas/v1.2/infoObject.json b/schemas/v1.2/infoObject.json index 279a53cf0f..d9a3208221 100644 --- a/schemas/v1.2/infoObject.json +++ b/schemas/v1.2/infoObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/infoObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/infoObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "info object (section 5.1.3)", "type": "object", diff --git a/schemas/v1.2/modelsObject.json b/schemas/v1.2/modelsObject.json index 325fb34862..2e9dee1db2 100644 --- a/schemas/v1.2/modelsObject.json +++ b/schemas/v1.2/modelsObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/modelsObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/modelsObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "id", "properties" ], diff --git a/schemas/v1.2/oauth2GrantType.json b/schemas/v1.2/oauth2GrantType.json index 7670ffc39f..00713e163a 100644 --- a/schemas/v1.2/oauth2GrantType.json +++ b/schemas/v1.2/oauth2GrantType.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/oauth2GrantType.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/oauth2GrantType.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "minProperties": 1, diff --git a/schemas/v1.2/operationObject.json b/schemas/v1.2/operationObject.json index 8680bbb8a3..2558d3feae 100644 --- a/schemas/v1.2/operationObject.json +++ b/schemas/v1.2/operationObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/operationObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/operationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "allOf": [ diff --git a/schemas/v1.2/parameterObject.json b/schemas/v1.2/parameterObject.json index 6aedcd6453..2c03744537 100644 --- a/schemas/v1.2/parameterObject.json +++ b/schemas/v1.2/parameterObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/parameterObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/parameterObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "allOf": [ diff --git a/schemas/v1.2/resourceListing.json b/schemas/v1.2/resourceListing.json index d043163eb7..3f2da1a180 100644 --- a/schemas/v1.2/resourceListing.json +++ b/schemas/v1.2/resourceListing.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/resourceListing.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/resourceListing.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "swaggerVersion", "apis" ], diff --git a/schemas/v1.2/resourceObject.json b/schemas/v1.2/resourceObject.json index c264a1c5f2..1f9a6a0b26 100644 --- a/schemas/v1.2/resourceObject.json +++ b/schemas/v1.2/resourceObject.json @@ -1,5 +1,5 @@ { - "id": "http://swagger-api.github.io/schemas/v1.2/resourceObject.json#", + "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/resourceObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "path" ], From 8100f14a7485a510ecd6bddb90984a7f5b124259 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 2 Feb 2016 14:46:20 -0800 Subject: [PATCH 0002/1801] removed old tests --- .travis.yml | 15 - build.sbt | 9 - guidelines/sample-server/README.md | 6 - guidelines/sample-server/files/models.json | 108 ------- .../sample-server/files/operations.json | 27 -- .../sample-server/files/parameters.json | 22 -- guidelines/sample-server/files/responses.json | 8 - guidelines/sample-server/files/swagger.json | 47 ---- guidelines/sample-server/package.json | 12 - guidelines/sample-server/server.js | 6 - gulpfile.js | 48 ---- package.json | 32 --- src/main/javascript/server.js | 14 - src/test/scala/GeneralTest.scala | 79 ------ src/test/scala/ModelTest.scala | 73 ----- src/test/scala/ModelsTest.scala | 55 ---- src/test/scala/OperationsTest.scala | 46 --- src/test/scala/ParameterTest.scala | 263 ------------------ src/test/scala/PropertyTest.scala | 136 --------- src/test/scala/ResourcesTest.scala | 154 ---------- src/test/scala/ResponseTest.scala | 91 ------ src/test/scala/ResponsesTest.scala | 44 --- src/test/scala/TestBase.scala | 26 -- test/validate.js | 139 --------- test/validate_spec.rb | 18 -- 25 files changed, 1478 deletions(-) delete mode 100644 .travis.yml delete mode 100644 build.sbt delete mode 100644 guidelines/sample-server/README.md delete mode 100644 guidelines/sample-server/files/models.json delete mode 100644 guidelines/sample-server/files/operations.json delete mode 100644 guidelines/sample-server/files/parameters.json delete mode 100644 guidelines/sample-server/files/responses.json delete mode 100644 guidelines/sample-server/files/swagger.json delete mode 100644 guidelines/sample-server/package.json delete mode 100644 guidelines/sample-server/server.js delete mode 100644 gulpfile.js delete mode 100644 package.json delete mode 100644 src/main/javascript/server.js delete mode 100644 src/test/scala/GeneralTest.scala delete mode 100644 src/test/scala/ModelTest.scala delete mode 100644 src/test/scala/ModelsTest.scala delete mode 100644 src/test/scala/OperationsTest.scala delete mode 100644 src/test/scala/ParameterTest.scala delete mode 100644 src/test/scala/PropertyTest.scala delete mode 100644 src/test/scala/ResourcesTest.scala delete mode 100644 src/test/scala/ResponseTest.scala delete mode 100644 src/test/scala/ResponsesTest.scala delete mode 100644 src/test/scala/TestBase.scala delete mode 100644 test/validate.js delete mode 100644 test/validate_spec.rb diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4aff41d513..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -sudo: false -language: scala -scala: - - 2.10.4 -script: - - npm install - - gulp lint - - sbt ++$TRAVIS_SCALA_VERSION test - - mocha -env: - - VALIDATORS=tv4 - - VALIDATORS=zschema -matrix: - allow_failures: - - env: VALIDATORS=tv4 diff --git a/build.sbt b/build.sbt deleted file mode 100644 index 0a1a11a1e3..0000000000 --- a/build.sbt +++ /dev/null @@ -1,9 +0,0 @@ -name := "schema-test" - -scalaVersion := "2.10.4" - -libraryDependencies ++= Seq( - "com.github.fge" % "json-schema-validator" % "2.2.5", - "junit" % "junit" % "4.8.1" % "test", - "org.scalatest" %% "scalatest" % "1.9.2" % "test" -) diff --git a/guidelines/sample-server/README.md b/guidelines/sample-server/README.md deleted file mode 100644 index c3f5c16f4d..0000000000 --- a/guidelines/sample-server/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### Running the sample server - -```bash -npm install -node server.js -``` diff --git a/guidelines/sample-server/files/models.json b/guidelines/sample-server/files/models.json deleted file mode 100644 index 4cb68ebf40..0000000000 --- a/guidelines/sample-server/files/models.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "Model": { - "type": "object", - "description": "A simple model", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "tag": { - "description": "a complex, shared property. Note the absolute reference", - "$ref": "https://my.company.com/definitions/models.json#/models/Tag" - } - } - }, - "Tag": { - "type": "object", - "description": "A tag entity in the system", - "properties": { - "name": { - "type": "string" - } - } - }, - "Health": { - "type": "object", - "description": "An object representing the health of a server", - "required": [ - "liveThreadCount", - "peakThreadCount", - "startedThreadCount", - "daemonThreadCount", - "jvmMemory" - ], - "properties": { - "liveThreadCount": { - "type": "integer", - "format": "int32" - }, - "peakThreadCount": { - "type": "integer", - "format": "int32" - }, - "startedThreadCount": { - "type": "integer", - "format": "int32" - }, - "daemonThreadCount": { - "type": "integer", - "format": "int32" - }, - "jvmMemory": { - "$ref": "http://localhost:8000/models.json#/JVMMemory" - } - } - }, - "JVMMemory": { - "type": "object", - "required": [ - "allocated", - "max", - "free", - "used", - "percentUsed" - ], - "properties": { - "allocated": { - "type": "integer", - "format": "int64" - }, - "max": { - "type": "integer", - "format": "int64" - }, - "free": { - "type": "integer", - "format": "int64" - }, - "used": { - "type": "integer", - "format": "int64" - }, - "percentUsed": { - "type": "number", - "format": "double" - } - } - }, - "ErrorMessage": { - "type": "object", - "description": "A shared model for error message", - "required" : ["errorCode","reason"], - "properties": { - "errorCode": { - "type": "integer", - "format": "int64" - }, - "reason": { - "description": "the reason for this error", - "type": "string" - }, - "description": { - "description": "an optional longer description of this error message", - "type": "string" - } - } - } -} diff --git a/guidelines/sample-server/files/operations.json b/guidelines/sample-server/files/operations.json deleted file mode 100644 index 5d646682de..0000000000 --- a/guidelines/sample-server/files/operations.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "health": { - "get": { - "tags": [ - "admin" - ], - "summary": "Returns server health information", - "operationId": "getHealth", - "produces": [ - "application/json" - ], - "parameters": [], - "responses": { - "200": { - "description": "Health information from the server", - "schema": { - "$ref": "http://localhost:8000/models.json#/Health" - } - }, - "404": { - "$ref": "http://localhost:8000/responses.json#/NotFoundError" - } - } - } - } -} - diff --git a/guidelines/sample-server/files/parameters.json b/guidelines/sample-server/files/parameters.json deleted file mode 100644 index bbaa056585..0000000000 --- a/guidelines/sample-server/files/parameters.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "query" : { - "skip": { - "name": "skip", - "in": "query", - "description": "Results to skip when paginating through a result set", - "required": false, - "minimum": 0, - "type": "integer", - "format": "int32" - }, - "limit": { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return", - "required": false, - "minimum": 0, - "type": "integer", - "format": "int32" - } - } -} \ No newline at end of file diff --git a/guidelines/sample-server/files/responses.json b/guidelines/sample-server/files/responses.json deleted file mode 100644 index 95ece33eb3..0000000000 --- a/guidelines/sample-server/files/responses.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "NotFoundError": { - "description": "Entity not found", - "schema": { - "$ref": "http://localhost:8000/models.json#/ErrorMessage" - } - } -} \ No newline at end of file diff --git a/guidelines/sample-server/files/swagger.json b/guidelines/sample-server/files/swagger.json deleted file mode 100644 index e7f4c08992..0000000000 --- a/guidelines/sample-server/files/swagger.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "Sample server to demonstrate object reuse", - "version": "1.0.0", - "title": "Swagger sample" - }, - "paths": { - "/health": { - "$ref": "http://localhost:8000/operations.json#/health" - }, - "/users": { - "get": { - "tags": [ - "users" - ], - "summary": "Returns users in the system", - "operationId": "getUsers", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "http://localhost:8000/parameters.json#/query/skip" - }, - { - "$ref": "http://localhost:8000/parameters.json#/query/limit" - } - ], - "responses": { - "200": { - "description": "Users in the system", - "schema": { - "type": "array", - "items": { - "$ref": "http://localhost:8000/models.json#/Health" - } - } - }, - "404": { - "$ref": "http://localhost:8000/responses.json#/NotFoundError" - } - } - } - } - } -} diff --git a/guidelines/sample-server/package.json b/guidelines/sample-server/package.json deleted file mode 100644 index fdb98a1a14..0000000000 --- a/guidelines/sample-server/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "0.0.1", - "author": { - "name": "Tony Tam", - "email": "fehguy@gmail.com", - "url": "https://github.com/fehguy" - }, - "dependencies": { - "cors": "^2.5.3", - "http-server": "0.8.0" - } -} diff --git a/guidelines/sample-server/server.js b/guidelines/sample-server/server.js deleted file mode 100644 index b70eba0e21..0000000000 --- a/guidelines/sample-server/server.js +++ /dev/null @@ -1,6 +0,0 @@ -var fs = require('fs'); -var createServer = require('http-server').createServer; - -var server = createServer({ root: 'files', cors: true }); - -server.listen(8000); diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 261b0b6286..0000000000 --- a/gulpfile.js +++ /dev/null @@ -1,48 +0,0 @@ -var gulp = require('gulp'); - -var jsonlint = require("gulp-jsonlint"); -var gulpyaml = require('gulp-yaml'); -var ext_replace = require('gulp-ext-replace'); -var map = require('map-stream'); -var YAML = require('json2yaml'); -var gutil = require('gulp-util'); - -var exitCode = 0; - -var json_paths = { - examples: 'examples/**/*.json', - models: 'fixtures/v2.0/json/models/**/*.json', - resources: 'fixtures/v2.0/json/resources/**/*.json', - responses: 'fixtures/v2.0/json/responses/**/*.json' - // What are the other files in fixtures/v2.0/json/*.json -}; - -gulp.task('lint', function() { - return gulp.src(['./**/*.json', '!./node_modules/**/*.json']) - .pipe(jsonlint()) - .pipe(jsonlint.reporter()); - - // YAML linting/formatting? -}); - -gulp.task('yaml2json', function(){ - gulp.src('./fixtures/v2.0/yaml/**.yaml') - .pipe(gulpyaml({ pretty: true })) - .pipe(gulp.dest('./fixtures/v2.0/json')); - - gulp.src(json_paths.examples) - .pipe(gulpyaml({ pretty: true })) - .pipe(gulp.dest('examples/')); -}); - -gulp.task('json2yaml', function(){ - return gulp.src('./fixtures/v2.0/json/**/*.json') - .pipe(map(function(file, cb) { - data = JSON.parse(file.contents); - file.contents = new Buffer(String(YAML.stringify(data))); - cb(null, file); - })) - .pipe(ext_replace('.yaml')) - .pipe(gulp.dest('fixtures/v2.0/yaml')); -}); - diff --git a/package.json b/package.json deleted file mode 100644 index 4fa476b77a..0000000000 --- a/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "swagger-validator", - "version": "0.0.1", - "description": "validates a file", - "author": { - "name": "Tony Tam", - "email": "fehguy@gmail.com", - "url": "http://swagger.io" - }, - "license": "Apache", - "readmeFilename": "README.md", - "dependencies": { - "tv4": "~1.1.x", - "chai": "1.9.x" - }, - "devDependencies": { - "glob": "^4.0.5", - "gulp": "~3.8.x", - "gulp-ext-replace": "^0.1.0", - "gulp-jsonlint": "0.0.3", - "gulp-util": "^3.0.0", - "gulp-yaml": "0.0.3", - "js-yaml": "^3.1.0", - "json2yaml": "^1.0.3", - "jsonschema": "^1.0.0", - "map-stream": "^0.1.0", - "mocha": "^1.21.3", - "q": "^1.0.1", - "request": "^2.39.0", - "z-schema": "^2.4.9" - } -} diff --git a/src/main/javascript/server.js b/src/main/javascript/server.js deleted file mode 100644 index 1f067b80b0..0000000000 --- a/src/main/javascript/server.js +++ /dev/null @@ -1,14 +0,0 @@ -var fs = require('fs'), - http = require('http'); - -http.createServer(function (req, res) { - fs.readFile("./schemas/v2.0" + req.url, function (err,data) { - if (err) { - res.writeHead(404); - res.end(JSON.stringify(err)); - return; - } - res.writeHead(200); - res.end(data); - }); -}).listen(8000); \ No newline at end of file diff --git a/src/test/scala/GeneralTest.scala b/src/test/scala/GeneralTest.scala deleted file mode 100644 index 2f3925364f..0000000000 --- a/src/test/scala/GeneralTest.scala +++ /dev/null @@ -1,79 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class InfoTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("info")) - - // Info Object Tests - Positive - - it should "validate a basic info object" in { - val json = Source.fromFile("fixtures/v2.0/json/general/basicInfoObject.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a minimal info object" in { - val json = Source.fromFile("fixtures/v2.0/json/general/minimalInfoObject.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - // Info Object (+ License Object) Tests - Negative - - it should "not validate an info object with missing required fields" in { - val json = Source.fromFile("fixtures/v2.0/json/general/negative/negativeInfoObject.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == true) - println(report) - report.isSuccess should be (false) - } -} - -@RunWith(classOf[JUnitRunner]) -class ExternalDocsTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("externalDocs")) - - // externalDocs - Positive - - it should "validate an externalDocs object" in { - val json = Source.fromFile("fixtures/v2.0/json/general/externalDocs.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - // externalDocs - Negative - - it should "not validate an externalDocs with missing required fields" in { - val json = Source.fromFile("fixtures/v2.0/json/general/negative/negativeExternalDocs.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == true) - println(report) - report.isSuccess should be (false) - } -} diff --git a/src/test/scala/ModelTest.scala b/src/test/scala/ModelTest.scala deleted file mode 100644 index 94d179dcf7..0000000000 --- a/src/test/scala/ModelTest.scala +++ /dev/null @@ -1,73 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ModelTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("schema")) - - it should "validate a model with string property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithStringProperty.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a model with multiple properties" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithMultipleProperties.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a model with an int32 map" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithInt32Map.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a model with an int64 map" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithInt64Map.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a model with an date-time map" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithDateTimeMap.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a model with xml properties" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithXmlAttributes.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/ModelsTest.scala b/src/test/scala/ModelsTest.scala deleted file mode 100644 index 9b505d6e47..0000000000 --- a/src/test/scala/ModelsTest.scala +++ /dev/null @@ -1,55 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ModelsTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("definitions")) - - it should "validate a models hash" in { - val json = Source.fromFile("fixtures/v2.0/json/models/models.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate multiple models" in { - val json = Source.fromFile("fixtures/v2.0/json/models/multipleModels.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate models with examples" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithExamples.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate models with composition" in { - val json = Source.fromFile("fixtures/v2.0/json/models/modelWithComposition.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/OperationsTest.scala b/src/test/scala/OperationsTest.scala deleted file mode 100644 index 9ed604247b..0000000000 --- a/src/test/scala/OperationsTest.scala +++ /dev/null @@ -1,46 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class OperationsTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("operation")) - - it should "validate a resource with string path param" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/operations/stringPathParamResource.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a resource with string path param and boolean query param" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/operations/stringPathAndBoolQueryParamResource.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a resource with tags in the operation" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/operations/operationWithTags.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/ParameterTest.scala b/src/test/scala/ParameterTest.scala deleted file mode 100644 index 9b60c23f5c..0000000000 --- a/src/test/scala/ParameterTest.scala +++ /dev/null @@ -1,263 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ParameterTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("parameter")) - - it should "validate a string query parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/queryInt64Parameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an int64 array query parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/queryInt64ArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string header parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/headerStringParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string array header parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/headerStringArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a int64 array header parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/headerInt64ArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string path parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/pathStringParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a int64 path parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/pathInt64Parameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string array path parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/pathStringArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an int64 body parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyInt64Parameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string body parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyStringParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string array body parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyStringArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a complex body parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyComplexParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a complex body array parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyComplexArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a complex body with inline schema parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/bodyComplexInlineParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an int64 form data parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/formDataInt64Parameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string array form data parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/formDataStringArrayParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - // Negative tests - - it should "fail to validate a complex form data parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/formDataComplexParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate form data parameter with schema" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/formDataSchemaParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate a complex query parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/queryComplexParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate query parameter with schema" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/querySchemaParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate a header data parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/headerComplexParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate header parameter with schema" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/headerSchemaParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate a complex path parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/pathComplexParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate path parameter with schema" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/pathSchemaParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate body parameter with type file" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/bodyFileParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate header parameter with type file" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/headerFileParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate path parameter with type file" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/pathFileParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate query parameter with type file" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/queryFileParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate body parameter non schema type" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/bodyNonSchemaParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail to validate non-required path parameter" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/parameters/negative/pathNonRequiredStringParameter.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } -} diff --git a/src/test/scala/PropertyTest.scala b/src/test/scala/PropertyTest.scala deleted file mode 100644 index 3de63b119b..0000000000 --- a/src/test/scala/PropertyTest.scala +++ /dev/null @@ -1,136 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class PropertyTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("schema")) - - it should "validate a simple string property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleStringProperty.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a simple int32 property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleInt32Property.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a simple int64 property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleInt64Property.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a simple date-time property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleDateTimeProperty.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a simple boolean property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleBooleanProperty.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a simple byte property" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/simpleByteProperty.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with string" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithStringArray.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with int32" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithInt32Array.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with int64" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithInt64Array.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with boolean" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithBooleanArray.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with byte" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithByteArray.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with date-time" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithDateTimeArray.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an array property with complex type" in { - val json = Source.fromFile("fixtures/v2.0/json/models/properties/propertyWithComplexArray.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/ResourcesTest.scala b/src/test/scala/ResourcesTest.scala deleted file mode 100644 index a2dededbae..0000000000 --- a/src/test/scala/ResourcesTest.scala +++ /dev/null @@ -1,154 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ResourcesTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema) - - it should "validate a resource with string path param" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/stringPathParamResource.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with common params" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/commonParameters.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with vendor extensions" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/vendorExtensionExamples.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a resource with example payload" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/resourceWithExamplePayload.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) - } - - it should "validate a resource with cascading schemes" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/cascadingSchemes.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) - } - - it should "validate a spec with relative host" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/resourceWithRelativeHost.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with linked resources" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with multiple mime types" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/multipleMimeTypes.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with security info" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/securityExample.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with tag info" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/taggedResource.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a spec with reusable parameters" in { - val json = Source.fromFile("fixtures/v2.0/json/resources/reusableParameters.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate the swagger petstore" in { - val json = Source.fromFile("examples/v2.0/json/petstore.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate the swagger petstore with external docs" in { - val json = Source.fromFile("examples/v2.0/json/petstore-with-external-docs.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate mads sample 1" in { - val json = Source.fromFile("examples/v2.0/json/petstore-simple.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) - } - - it should "validate mads sample 2" in { - val json = Source.fromFile("examples/v2.0/json/petstore-expanded.json").getLines.filter(!_.startsWith("//")).mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/ResponseTest.scala b/src/test/scala/ResponseTest.scala deleted file mode 100644 index 8f73858bb3..0000000000 --- a/src/test/scala/ResponseTest.scala +++ /dev/null @@ -1,91 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ResponseTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("response")) - - it should "validate a string response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/stringResponse.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an int32 response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/int32Response.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an int64 response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/int64Response.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate an date-time response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/dateTimeResponse.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a void response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/voidResponse.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string array response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/stringArrayResponse.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a complex array response" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/complexArrayResponse.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - it should "validate a string response with header" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/stringResponseWithHeader.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } -} diff --git a/src/test/scala/ResponsesTest.scala b/src/test/scala/ResponsesTest.scala deleted file mode 100644 index ae7ce65240..0000000000 --- a/src/test/scala/ResponsesTest.scala +++ /dev/null @@ -1,44 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.github.fge.jsonschema.core.exceptions.ProcessingException -import com.github.fge.jsonschema.main.{ JsonSchema, JsonSchemaFactory} -import com.github.fge.jsonschema.core.report.ProcessingReport -import com.github.fge.jackson.JsonLoader - -import scala.io.Source - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import org.scalatest.FlatSpec -import org.scalatest.matchers.ShouldMatchers - -@RunWith(classOf[JUnitRunner]) -class ResponsesTest extends FlatSpec with ShouldMatchers with TestBase { - val schema = readSchema(true) - val factory = JsonSchemaFactory.byDefault() - val jsonSchema = factory.getJsonSchema(schema.get("definitions").get("responses")) - - it should "validate multiple responses" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/multipleResponses.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - if(report.isSuccess == false) - println(report) - report.isSuccess should be (true) - } - - // Negative tests - - it should "fail validation on no responses" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/negative/noResponses.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } - - it should "fail validation on no responses with vendor extension" in { - val json = Source.fromFile("fixtures/v2.0/json/responses/negative/noResponsesWithVendorExtension.json").mkString - val data = JsonLoader.fromString(json) - val report = jsonSchema.validate(data) - report.isSuccess should be (false) - } -} diff --git a/src/test/scala/TestBase.scala b/src/test/scala/TestBase.scala deleted file mode 100644 index 0c4c08bf1c..0000000000 --- a/src/test/scala/TestBase.scala +++ /dev/null @@ -1,26 +0,0 @@ -import com.fasterxml.jackson.databind.ObjectMapper - -import scala.io.Source - -/** - * makes the schemas absolute so the java json-schema validator can locate - * references correctly - **/ -trait TestBase { - val mapper = new ObjectMapper - val host = "http://swagger.io/v2/schema.json" - // val host = "http://localhost:8000/schema.json" - - def readSchema(makeQualified: Boolean = true) = { - val json = Source.fromFile("schemas/v2.0/schema.json").getLines - val lines = { - if(makeQualified) { - for(line <- json) yield { - line.replace("\"#/definitions", "\"" + host + "#/definitions") - } - } - else json - }.mkString - mapper.readTree(lines) - } -} diff --git a/test/validate.js b/test/validate.js deleted file mode 100644 index 243442d3e0..0000000000 --- a/test/validate.js +++ /dev/null @@ -1,139 +0,0 @@ -var Q = require('q'); -var glob = require('glob'); -var tv4 = require('tv4'); -var ZSchema = require('z-schema'); -var fs = require('fs'); -var assert = require('chai').assert; -var yaml = require('js-yaml'); -var request = require("request") - -var schema = JSON.parse(fs.readFileSync("./schemas/v2.0/schema.json", 'utf8')); -var validators = (process.env.VALIDATORS || "tv4,zschema").split(",") - -var validationMethods = { - tv4: { - setup: function() { - var deferred = Q.defer(); - request({ - url: "http://json-schema.org/draft-04/schema", - json: true - }, function (error, response, body) { - if (!error && response.statusCode === 200) { - tv4.addSchema("http://json-schema.org/draft-04/schema", body); - deferred.resolve(); - } else { - deferred.reject(new Error("Request failed")); - } - }) - return deferred.promise; - }, - validate: function(schema, data) { - var result = tv4.validateMultiple(data, schema, true, true); - assert(result.missing.length == 0, "Missing schemas: " + result.missing) - if (result.errors.length > 0) { - for (i in result.errors) { - // Remove stack trace so results are readable - delete result.errors[i].stack; - } - } - assert(result.valid == true, "Validation failed: " + JSON.stringify(result, null, "\t")); - }, - }, - zschema: { - setup: function() { - var deferred = Q.defer() - request({ - url: "http://json-schema.org/draft-04/schema" - }, function (error, response, body) { - if (!error && response.statusCode === 200) { - ZSchema.setRemoteReference("http://json-schema.org/draft-04/schema", body); - deferred.resolve(); - } else { - deferred.reject(new Error("Request failed")); - } - }) - return deferred.promise; - }, - validate: function(schema, data) { - var validator = new ZSchema({ sync: true }); - var valid = validator.validate(data, schema); - if (!valid) { - var error = validator.getLastError(); - throw new Error("ZSchema failed: " + JSON.stringify(error, null, "\t")); - } - assert(valid == true) - } - } -} - -var setupValidators = function(done) { - var setupPromises = [] - validators.forEach(function(validator) { - setupPromises.push(validationMethods[validator].setup()) - }); - return Q.all(setupPromises).then(function() { - done(); - }) -} - -var createYAMLTest = function(file, validator) { - if (validators.indexOf(validator) == -1) - return; - - it("should validate " + file + " with " + validator, function() { - var data = yaml.safeLoad(fs.readFileSync(file, 'utf8')); - validationMethods[validator].validate(schema, data); - }) -} - -var createJSONTest = function(file, validator) { - if (validators.indexOf(validator) == -1) - return; - - it("should validate " + file + " with " + validator, function() { - var data = JSON.parse(fs.readFileSync(file, 'utf8')); - validationMethods[validator].validate(schema, data); - }) -} - -describe('JSON Samples', function() { - before(function(done) { - setupValidators(done); - }) - exclusions = ["./examples/v2.0/json/petstore-separate/common/Error.json", - "./examples/v2.0/json/petstore-separate/spec/NewPet.json", - "./examples/v2.0/json/petstore-separate/spec/Pet.json", - "./examples/v2.0/json/petstore-separate/spec/parameters.json"] - - files = glob.sync("./examples/**/*.json") - validators.forEach(function(validator) { - files.forEach(function(file) { - if (exclusions.indexOf(file) == -1) { - createJSONTest(file, validator); - } else { - //TODO: validate separate schema files in exclusion list - } - }) - }) -}) - -describe('YAML Samples', function() { - before(function(done) { - setupValidators(done); - }) - exclusions = ["./examples/v2.0/yaml/petstore-separate/common/Error.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/Pet.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/parameters.yaml"] - - files = glob.sync("./examples/**/*.yaml") - validators.forEach(function(validator) { - files.forEach(function(file) { - if (exclusions.indexOf(file) == -1) { - createYAMLTest(file, validator); - } else { - //TODO: validate separate schema files in exclusion list - } - }) - }) -}) diff --git a/test/validate_spec.rb b/test/validate_spec.rb deleted file mode 100644 index cf3666d071..0000000000 --- a/test/validate_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'json-schema' -require 'json' -require 'yaml' - -schema = JSON.parse(File.read('schemas/v2.0/schema.json')) -Dir['examples/**/*.json'].each do |file| - puts "Validating: #{file}" - data = File.read file - # require 'pry'; binding.pry - puts JSON::Validator.fully_validate(schema, data, :validate_schema => true) -end - -Dir['examples/**/*.yaml'].each do |file| - puts "Validating: #{file}" - data = YAML.load(File.read file) - # require 'pry'; binding.pry - puts JSON::Validator.fully_validate(schema, data, :validate_schema => true) -end From 252ef375fc0d487f68afb7cacf026327573bcdf6 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 2 Feb 2016 15:11:27 -0800 Subject: [PATCH 0003/1801] added files --- CONTRIBUTORS.md | 6 +++++ DEVELOPMENT.md | 50 ++++++++++++++++++++++++++++++++++++++++++ README.md | 56 ++++++++++------------------------------------- swagger-logo.jpg | Bin 12768 -> 0 bytes 4 files changed, 67 insertions(+), 45 deletions(-) create mode 100644 CONTRIBUTORS.md create mode 100644 DEVELOPMENT.md delete mode 100644 swagger-logo.jpg diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000000..9a8821a446 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +Darrel Miller (@darrelmiller) +Jason Harmon (@jasonh-n-austin) +Jeremy Whitlock (@whitlockjc) +Marsh Gardiner (@earth2marsh) +Ron Ratovsky (@webron) +Tony Tam (@fehguy) \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000000..cea8473f8c --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,50 @@ +## Objective of this Document + +Establish guidelines which build a transparent, open mechanism for deciding how to change the specification. The TCB will initially follow these processes when merging changes from external contributors or from the TCB itself, and adjust them as it makes sense. + +## OAI Specification Driving factors + +The spec should be use-case driven. We can write support for hypothetical use cases as we see fit, but they should be backed by realistic scenarios + +## Specification change criteria + +The specification _will change_ from the 2.0 version. We should typically do so when any of the following criteria are met: + + - Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear + - Consistency. A portion of the specification is not consistent with the rest, or the industry standard terminology + - Necessary functionality. We are missing functionality because of a certain design of the specification + - Forward-looking designs. As usage of APIs evolves to new protocols, formats, patterns, we should always be considering what the next important functionality should be + - Impact. A change will provide impact on a large number of use cases. We should not be forced to accommodate every use case. We should strive to make the _common_ and _important_ use cases both well supported and common in the definition of the OAI Spec. We cannot be edge-case driven. + + +## Tracking Process + + - Use GitHub for all spec designs, use cases, etc. + - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.md for example). + - The `master` branch shall remain the current, released OpenAPI Specification (i.e. 2.0). We will work in an OpenAPI.next branch, which shall be described and linked to on the **default** README.md on master + - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal + - New features should be done in feature branches which, upon approval, be merged into the OpenAPI.next branch. + - Use labels for the workflow of specification changes. For example, this may be labeled as `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, `needs approval`. These labels must be assigned by project committers + - An issue will be opened for each feature change. Embedded in the issue OR ideally linked in a file via PR, a document should be supplied for use cases for the change + - A PR will be used to describe the _proposed_ solution, and linked to the original issue + - Not all committers will contribute to ever single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel + - When the OpenApi.next spec is complete and approved for release, the branch will be merged to master. + +## Approving Changes + +For each change in the specification we should _always_ consider the following: + + - Migration. Is this a construct that has a path from the existing 2.0 specification? If so, how complicated is it to migrate to the proposed change? + - Tooling. Strive to support code generation, software interfaces, spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered if the change should be approved. + - Visualization. Can the specification change be graphically visualized somehow in a UI or other? + +Spec changes should be approved by a majority of the committers. This can be done by commenting on the issue itself ("Approved by @fehguy" for example). Once voting criteria is met, any committer can merge the PR. (**TODO: we will want to formalize what voting criteria actually is). + +No change should be approved until there is documentation for it, supplied in an accompanying PR. + +## Transparency + +We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, etc. These must be anonymized, discussed in a private repository, or offline + + - Offline Discussions should live in issues. + - Realtime discussions should be in a public chat such as IRC or Slack \ No newline at end of file diff --git a/README.md b/README.md index 8a3a9b8c93..62305fc617 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,21 @@ -# The OpenAPI Specification (fka The Swagger Specification) +# The OpenAPI Specification -[![Build Status](https://travis-ci.org/swagger-api/swagger-spec.svg?branch=master)](https://travis-ci.org/swagger-api/swagger-spec) +This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). -![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) +The current, released version of the OpenAPI Specification is 2.0, through donation of the Swagger Specification to the OAI by SmartBear Software. If you are interested in the release specification, please see the [master branch](https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) of this project. -The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service. +Development of the next version of the OpenAPI Specification is being guided by the [OAI Technical Contributors Board](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/CONTRIBUTORS.md). This group of committers will be bring their API expertise, incorporating feedback from the community, and expanding the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the OpenAPI Specification, this branch will be merged to master. -Use cases for machine-readable API interfaces include interactive documentation, code generation for documentation, client, and server, as well as automated test cases. OpenAPI-enabled APIs expose JSON files that correctly adhere to the OpenAPI Specification, documented in this repository. These files can either be produced and served statically, or be generated dynamically from your application. +You can see the current process for development inside the OpenAPI Specification [here](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md). -Without going into a long history of interfaces to Web Services, this is not the first attempt to do so. We can learn from CORBA, WSDL and WADL. These specifications had good intentions but were limited by proprietary vendor-specific implementations, being bound to a specific programming language, and goals which were too open-ended. In the end, they failed to gain traction. +## Participation -OpenAPI does not require you to rewrite your existing API. It does not require binding any software to a service--the service being described may not even be yours. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI--this specification is not intended to cover every possible use-case of a REST-ful API. OpenAPI does not define a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. +The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. It encourages participation from individuals and companies alike. If you wish to participate in the evolution of the OpenAPI Specification, please consider the following: -This GitHub project is the starting point for OpenAPI. -Here you will find the information you need about the OpenAPI Specification, a simple static sample of what it looks like, -and some general information regarding the project. - - -## Current Version - 2.0 - -The current version of the OpenAPI specification is 2.0 - and you can find it [here](versions/2.0.md). - -### [OpenAPI 2.0 Specification](versions/2.0.md) - -This repository contains the existing Swagger 1.2 specification as well as proposals for the 2.0 version. - -## Structure - -Each section should contain v1.2 and v2.0 folders to avoid confusion between the versions. - -Please keep in mind that the other projects under OpenAPI use an independent version system. -As such, don't confuse the version of the OpenAPI Specification they support and the version of that given library. - -## The Wiki - -Check out the [wiki](https://github.com/OAI/OpenAPI-Specification/wiki) for additional and relevant information about the project. - -This includes: -- Static sample tutorial. -- List of known deployments. -- Revision history. - -## See it in Action - -If you just want to see it work, check out the [pet store sample](http://petstore.swagger.io/). - -## Tools and Libraries - -Looking to see how you can create your own OpenAPI definition, present it or otherwise use it? Check out our [list of tools](http://swagger.io/open-source-integrations/) over at [http://swagger.io](http://swagger.io/open-source-integrations/). - -(Yes, there used to be a really long list here, we just moved it to the main website) +* Review the [current specification](). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so it's clear how the spec is evolving. +* Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. +* Create an issue to describe a concern and/or a pull request to provide a solution. If providing a pull request, please ensure you are adding comments regarding the **Approving Changes** section of the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) guideline. ## License diff --git a/swagger-logo.jpg b/swagger-logo.jpg deleted file mode 100644 index 561caf24f3f2e438bb44d9d55104975dd570b5c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12768 zcmZX(V~{7nuP!|1j_u#rwr$(?j&0kvZQHhOduC_H*4_WP_dVxSy91aE>1_%fUPEtZd>EAB)Zwf(y{98?T*hheX&|@rxg%u=)g#ikVc4n5=ra(X% z&@~!vDyVafe>cYIx{689NNG6FvXhQ!!uuPKvy*^DM8QP`68&K?5fv2@p{NG@i4;jF z3c-*NRZx+@QrOQ|_Ihr*KlZYm%ucT|FLN_1D*x6Z0L^YKkB=*Wp#T{kG%UcIg$8o( zY=bw{0fE?q;wpens%Xg+2jt|Sz1EGbApzO&<0fw4U-eaf?IEQ5d>L5)3Ao-G6YODX zVMgQZH|3yX;lTnS^99%oSs$~}1u|N(SOcQ#Y>)i++I?_7K1b(#FE}_c2e=-9=8?*m z&w+r>`}!RR+_ivs-~-Treo436DR2PM95SqyfGha`@Ba#RDIOXmYIVSm9`X6M$@cdf zQmLHVW2{*A?|Xe|>*qbdz=0eQ2~|q+W&P%-H!N_t{dsqZKcFUL*xUy0jq3lYW+558 zr-y%OX!s&V2<$sYfRAQ&`wp^X6ua&F+*wQeZT$v07Q%t^Ik0Sj`6W$Gu{wBx5F2a% z%I)i3KI7{B*+@7)cS!#n#pv)!{DQ#L@*0!`nxpfx{|dm!;^!b6zN>?q2oUo-S#W^& zvw4nV`}&A6WVE02>q!&)I@4_kkURA|?)4od^Q+fyf6(_LGKTw!MZtQf?)BTa!T9~G zj*oKl+Gc0nyrl2J;4Q82~_p{}jN?AEY&IM*}4iq}Y~< ze3Fh1`2Z;jA1^-7_wUyb1m&>$1fw0aY+MYCyoZ?tvOe2yg$JUB?{kDTy7>`D2Y*>x z1_E+8CBRaJ@kh7hfUEr`Mo|no>IL&(#nRGo{=B(U*kWht2NmmwX$Rs*gg6v{pa4nF@6% zFsi_-3bN;GD?mPCVh866E6;;GVr>clkifvG0}%uT#|f8_AfTj!QH4ftZv=71at2k5G#f)OGN-H3 zpihOQ3|<=8G^kk9u;F=Od!cQG`b6f8)GjS7LC;ezW-N9rg)EgUpv~(RbVZ}{e=5Qe&Ym$03;cR+z}6F?_AE$-&s zncOek^=^sWNj>n~Uv6{Ht`Brij?S2mqK>&|+~Vva@^bX^_|y60e&~Jzfg}ag0TKZD zeA)dRKvsT$LAgP~zR!Ru6a7Xut~ed}O9FeyaBz0WV({+}vf#VH%fatKkHMV5DIyS} zRU$9ZN>RP=Ly;9xP*GUXE|E0~BUJTCq)FMyZp^au5RFESmUU@|!uDMEWcQF)X6WeP zPLc3otO#Jq;NnP=e3J;1K2#woRVsC_6m6OD9$*ZCl<0?M>kg_WlTl28J7T5mgJ7k6Maq5mg#Bj}j?GCPgVZGlh>* zn(~7(PZeL8utK8>SMfsSt)Q|LyGE<1GoP&Rv_`Fxt#Y=~w#--OD*-}lNP$@NsCATG zR&_>WhHEBHi%E-6OTGEDWu*D5nciaV9O^>BWzvPr1>B{_Wy+cSY1~t#2d2l;$IwUr zOZwdj0vTceLLH6|a}q}khYhI!6|2RyPwG6C6Vgn=YF& z(Hi8%cjb*z5QuN*n9815+UF;2Hm zhEDf(m5%BT?5@*JxxdL<9d>6Z?6z%yHZ!;CuBZ>vmla*Iu6wr`&vN%-ujoJMTRH6? z4diX+&hhxp6*o4K<+$32kGa@Wl3>b(S;H%)!aq8uj*lh&1*mnWdFpoEZ~ zOUFx&OTDp8AE1aRZCclMN8sw7I>U)s4gt$7JG~(#$|C|)3-C{v&nNb z|Gm6Y-f^u#yPz3Sgb zASZ!NA+Lk&gA+tmg{MnIWli#a^zbzJbc{3=v?sK@YMrj5FVjm+@8(vscR5o$ZHnkB zY-+Y@yDEYe6dZA!1b*Mw;AybB7%TK@x`(~V9v9-K?kC5lVN)+v%axV2w|bnKG3BvU zdhM4EF8i5xEvMKSnfF@Ho6}eOp4(4u?A>C*+nfax~r6*Yd z?BrQHnUHqZ?JFCFD~sz?TUs7j-d)G=TRBN?cWwwfJHMrEwQb_8^)I2$(=Q$`ar@dH zcAGw)Uq0|P_}m}o9}jxyf@)jEx#Dd3SG~Qfw0k~IQC7%hd8v3~dZ>D0d@6lpzkYws zfMSEv25knp01;zD^%*BpGHM3?Q8)G$_U`Ofc>>yqy)y@%M!LHE`y>BY!a& z2U-^Hquo?Rt|8Z1k*kv5$Y9Ao$#BcX&CQ#k?+tgq@p+xo-q{Rf_v@^5AAVkgFNFlS zb?wg3iP728mGqhW>c0zq3J-~Y#qmyYrZ9o!)FpGg6Q+XBTy z0QEC}?h^kj`nSy^R)ZR2NT6$pWD9y0lFVy7l23!UCjVu%h3OL$K%xAV8r>jcI$cEK zsixa%@~johNhfJbB~NI_&#xsQIv##rD*?_NR7Tom0o5`&8x1d#Gf$#n(JYJIL#+mMadY%Zk^k=dwGi z0*{Zk`K;IOtM}Cod=at%5;jC4q%!y-L|cSI{9Tk(Brm)Jbqk#x{f81MjU>IgbrK(-rmO(CS9}}w2t3HRkLd#zmcut z^yu3a71ee1_vRPZS0DFJk4|^BgJ_3pjN8U;x_duLZ5n)9P(0$UdtX7X!(4Tn#i8Sv zJEilMpPe7!pJku>2sH4v-QRsI9yZ=@FUQLkUhJD^y4_j%p6@S2ZmPuV2xR!OFLQml znD5LCU0vWa$!Y9+QS_2^7v1e12M&u)8t=$Q=5X`)>zsW!d$8|SygT*D`1d9dtg)=F+k5C+%K+8#bPPkN9Uhrk0Z#+1TogATcqtPZG zr*J0wm3J#%t5vDaElI3CE;B8cp3h&=H_ud$bc11?ArEq$ zY+J5d{P7fUGVq!&+W(F}m`^jb8%!fwEn--}Wn63sb>Kc4LV+hkC)1U+-Fk4o$?~b9 z3|ILC4rLh>oF2#v>&4ZR$m3vge;jByjlP_28f%g-HYLseH3dHoJr2i*mXnt4R}W~q zRZ*O{h&-%Jyef$?x6Qlec`3Fo{*)cL1fLe2l}=3AOtY!%t`$)$)0^p4Q&ZOVI`e#q zIp|z_dVrgXxsuhMN!K1mUse0N73fCcRB8me+_?kWlXt(rJTzIGD&7-E-o^it z@44|o@kIq18l)zV7p9Zff#4PG9_tz7!T;hbh*#EIET^EasJ}!8T1Hg%GHcRJnOoz# z#kI!F-*EfA^Fli4^%o&Iu5rpSZ+IVST`S{#u|ezEN|bhYvYdHH#Kv_9xE%d&ynOJ?{<$yct}0JVeMXq)gOTDSc%8FcBF!(MZX} z(iV$MGaENvJ0VXQQ`x(Cx!7BhRR1YoEBW0PPFj|g*3bsx+9d~T2e`-e%QI*y)KrXg z^o>ljRD4=#28EW$4NSvRi&Im3{d}`>b7Di9LjhMbJ2-oS4y3l5yJLHON7EIFr@pIT zho7gOLJSO*)duFwvimwP)y&+B-4A==mhYgy*%=#o6R3A4#J+dGdp z=Yh%X&$7j?#`i;D!(c<YwoK&b3c$&JoV^_MYuh?Q)xOe)2b>{1Oag+ayxRb4>M&*#^bNJk!BuT!S(Od?SNnN}@`{ zE)AWHvkjyTOHFAGLmdw~Dm!f2`)-r(Gw*6|Q|`1M?4VR&xRMr*$qEb%8*gC~ zycHo~BA95@X#Ua?lHKVw>QPB*$wLq?(Q6Z7P}J25)ZJ<|NK$HZs*FgfD#qyN6c6N2 z6ps|ht|lz4EIBPBuyL4Z*e)CL7)P=uv9vWqZ91$sPFJpYPMgidPU(#e%-t0$S3MBn zPPN)v{)Ou@b8GU-^dxmxS0=aA>5cW}{0<5z&d(VzC6qSQI?zONQY2eQX&7z~er1o4 zlhpNcerCH?m+9~oAguWtzj%NnZW60Exj#q4B{(@bVKzI#J(8oY2vA=4-0XBOWjU$7 z?FhIZI)kGlqUY_+_8PgW^oDDE9*GHk&mJw$dTu+`zOa+uv$2-H+4j(XCoHu3bXZFI z+^n|A8%df$CK%9;~bJ6YAUHTh!rX7&5L;~%5{ zsT%xl3&ILzs7EjfU{XMEf;uw5GW+#P$T|)W6R=qDz<|OK;g2{7r7QwPgs~9m9z{Y3 zm*6l?J4jT>=4Q&?hGM*Pg2dgalDl#f6O_6IvWE6E6gItlQri81+yvWKV*;wjW z?bvib1EU$~EA>9vJ()#?Qu(s~RIO8_(IiqO)FpNX&y&})vd47HxXAL%z-gdm%4YFx z1KC%So09g#m&M%bc3p~R9~&u`J4>$fx3jigvi;)^)g9*juosp)xsu&0&3ohr_^Ud2 zH-ZxUF2N$+C>lQU0{#dZ9sx6U8J-_u0;8q=eOS-3k1^$QMUSN#q!+?g2|w?py*0zq zsk>Y1+e9sH)OIh=*{6C4p(xJCnDm6X)?7!*S9N*szDGpSy{4*f%Ll9D%;J-_3l?0i z?BvX_wo{Fb+x_MzSMp83M-PHDL5R!Mi~S?r%gZk{1XH-NI0zmDO!?e$?;Z}D+fpO= zKEyVTj{%>zi^%KC{?4h!DkD8}@=2oY4G zO~e}mxiPQ||7tP0qF05#4B`*SvY{L4SLZkBca4zoyGMmRJut?7bYA-L1S~ zdpLZM0^no)NeeOVu!7KrgvEqM;mL$c!=}}yhiFt%VWazr&l^d(B9{4Hx(%7ambh>$cNFCq;u zm6HIUsF*Y|$(L4@z+b&zQC=}z(p>NCQ@r55*`JR6GN)f+h=H}oZz zGAdju!A$CuDf%3XK4oc@9TQm7wS)AL1rICtIa^EDQ44A-^Eb8&hG&$gqsP@FO-X+t z*eB=<8zf(#D?f6-MPaM{63W{|W7$61&|0@!Lr4?Z&T&F-*9VO5`eetm=IXtzdi-v|WCD-z5)Mr|c~=uLNzaUj#>W#qB+wK;Z^ZOL29rt!flN22Q}Q z2~906nhh;aM?5;#-C+5=kL*9aHPMD3fV9Ec7~N~a{Z{ZFhfjoBWNr5G$aV%GAmA)Z z6%A(%Ss5;4I~zJf6FVbQI(HlUe}!uxARc$Ff2576vmwCU#@g12%bl0#zcjf1(f?u7 z69N89#o3CNNJCZuAZ+Jo3SgyUp<^K8g8={lJdP%2TuLHh{}2A}#7ku1>}=0PPw(dD zM(4&%XXj{6&&bKiNzcGU&%{LgPlMLU!`9i*oz~Wg`2QOD|LlmEIvG1!+B;j?*#iD! z*U-q$#hI6g=s%ABd;H&fnz~#5k0)EF{}>S zh*;W~+B*I7!N<*fv-J1+1AkU!ckoCuaE0-C8X2pxVLBfMj?6GW7%aV{S~r9QTaXilBL?C>6)ohmI!v;Z5seoA_S zF;A{erm+LWO&0?-!)ZSIRMb=?R;KT?Ha4v4>07N<)*i)wIF_m^D=U)jEcMj`@yimv zhF`6%YMRzGRI|`Z)4~@+hB9>omQqZIc%q7df}k9eY($9lRowU{?Dk6m{0p5)C0A6p zu3x38uS!xp%V^(v3oR=x&(F_12?-E$0cKEe$0#Wu09hQ_uocwq&RFjgM;BAm8U=v#RUXB8tq)LxiSqvY38A zX$ztl3n@95L3u({tn2!A^JD)S+p0!OVC9Sd7=) z%8VJYdV7ZooxhikQftl=Vo+%*o;X%;xz#RSkB0)k+|Jb3|C_3Dv>JjB&bpO0UQ2oHU0>5DE;dgAX9oJE!-&zr^7mj>m+rn};27$Pnr* zxMG;QNQ$ab&#KHk?7ox0L|Cs}q(^>JD4eJI^#NAV(Nq#5jgy)o2D^S59P+Dhvq?cG zikh*v9XzF-&eOQEFi=kgfOZ&roMkSjtEp>wo{3h}DOjRkOhPdhB}&H1udbz8VY;YE zgi6Z{nBasRIeLm$Tvh}VKqkC&P-oErL?|Xa6i7cFLRaLQ%1Y*NcXc2dDzB ziu%c&8)+SR(gSs*RhQJ!f5XC>PRTIlF=m#EAo0yu4s}3B>z#vo9TIC0RhN@WZxbFv z79;ywcqsMr8p1v>0f9y*Vrk{nn`xWRRjaUZX)qK{+go`(wuQ!$gVxnmj*4w$aO*QZ zHQz7`!G$KwBUU{s<_qSL(Kbj}y06R87BW&QSg0-xiyHu;3VIN7oF(b=pcDa#BQgnZ zo;bI3Jdn5oYteL2260wNBQ0S+N91BVBFCm>aHB%bq%o(9=FPUxVkfK#;tCm$#Rip0WBJu=VYKy@f zWH1qC#wjn^8q8x6py}ODk$C2@5@V|Ww_T9-cD?n`SD0A`;w4I4TniA{TU(NrmIWG= zqqA@ulv)Tlh#nW&`yv_uNQ50Ywn&*ctsUB`MeB1iA+GHR*O^L5*seD~qq??b<#yx!L%;W6xU$wM_b_<4VUEDxq1Kf- z3*Xo;9g7-H(LO}~xqp9hveQACA_NWwLZ1co6eXevtT)-w_C^R14-7He9KyBCMZX=ppkfx8$Iv_`c%`rF)u=b8z#Qa|{+1FVBpw8qYvTH-)u zny8#B_XQ+f9A2}=jp~EU_G|nD-=C*iItH+3gh$4W2wsZ@8($r+1_S9IP>ZTjgf(vS z$3Ej|?$_RDgZ`VyR>f^|Tx(JTGGqJ)OkrN#>&3~GD#C%#7Ln-%2GVATf_hzQJ%Ny; z?0cyuF{&I_5wb*PDeap6+ptex7IUahm}KY2WCcNPrk_ud=3lB>P{sB_xfeT0c~ z1=sr(X>kIt_l4+;9-p5bZZTJ)>RqNDub)=0*}Cr3R%`2Kk9Q1a0i^&u*(9r{_faiR zXQr`ql-bB|IUy29RT^roGBgz`+FXC@dpttSh>?<` z$5I=yzl*&tu1?JYBy@wg2$64w{^(Py^QteZ=G+_E;xkg=M~U$pSQ>lL8N*_qP^AjI ztS;oa)e}GEOCbPwib}rS^MOXGL3rC$(-Re&LO%Nq%&aYa8a6DoD5VpY3we({bSIM} z{WM?>hE-r$B{yN5SB4w6e!DVrW+TmeV~kr0s0gEMg5pZ3tm#%Ct*a2NmHr8%*7kR> zE3E)W8E0ZEIj}!%ptAxH2?MnFI`+sR#fCV!JO?&~QSV|EbI&~Wa;Bw7=S^#>mKB%M zrKSW~puXnGR0NCAu+CUoev1znVr;stTat)~(ZXbBG4*8_dL;!cQbl zq!@+?i7B>i-#zHW1g{w+1eWDWgyU#XoLd*G*>ur8?>dtpDgmH9T@1=BLHLmG5s^NNdNDbS z6zWlU!R7p6vKgTd6%F=ZO(#fn6s1|XK1&rjqK26iZk!zoBi)$DV;P`iXlo*eg%Y`T;N|HmsOfZuYch!NJ?%A$nrpWPBM9tZSzg17g~n$xqanj# z-g1w?;_$4QE!VjyUVIkZ>ew;(tcQ+OkP1w;o+D9VbqCCpo zyh;SZDQqQUAx%vXHOYl7Pi;xasI*HQy9{%JV4$;eVaJg`fJqX;G{eA5ceQ)}IV>4^ zA$TpfL7i8=QH#yvXG+{5oY+|$jR-lxP+yg^&?uSE0pzbfHj#A-CoUvaIJ z+~19?6vd1(;m+K3kM9J zdHuTm=DwBBed7OiwYD$qZg~H8 z<9Xbt_gPGg_Tjd>@mySk|8n7DX5@8Vvio{B7r(Ydl-qjN=lQO;F{_e$QAYUM)%E%d zad=(S#>CyTTAQ0oD!m)}Gn` zr2rJ$9VuXxxU<-G%!nouxZsvt^+7B?=O^G-SGLVA7M0*JPt$1`*P(|<# zXY3Qp^y9NX?`w!Wf4AS^u2v71R<`@axnXgQr(6}s$&fe#+DwH`wxH&!@ zx~&4D8OtaFlikn$dBf;;bcOFyO&*U=<7#=2`{SEk zk3EAiMm*?csORzY%Vo;wMby~OQ$}5Daq1DAgAHN&96v?YnPk&6HaXuvJ$-$C&o=ALY+5VyK2K48ZiiEz#P#(q zCH+{Q`bt!EiFtE4BLgfG5u#({3Bg&4iQozKYM7xZGI)vi2B=Axwv=Q{%m~xlFM}Cp zmDkv}r7M4CZMvprq#Lb{YXY=KciEEhUwB8xS|`*^+3Qt|U&gu1BH0-^pui^tj5ANO zEHbb*i>T3^dXjb48QDN><58yRbvZmvN)Y6{DbnZ|qT`%1lfz7an3y=|xXT7?4=UnMym=8_ z%nJ@PD2*EE@XZM!0>SaxhNRVX<8|?n@2==rfP4N0{KN34;O(qnb#GPWt!u3@OK2z* zWj*Z2gRMk#iBtrU^gFNTUvh?$wj=42SMxW6Q&9e zoRh$^ceg)~Rw4!`i;9Mem;viD{MO7&5yB4ms#ZYo$Q1xP*9#FM8_MiY$j_0H@8Qu# z69%)_*=rmOTY48m;dh6hxA2E@kf1qD<<}W#MJ&F~8j{ za+0sJ);aWG)WmoNibhU6bh+~nT!`aYcj!EmDvQ(MYqmR;>+Bv}Fz!#SN^5#&cq4cW za_I{TGcH7*ao8Em&y}iDfTfWEB;593Ny-4Qi9{u|g@-yuLSR+}=Fu@Z8}XHIrF8MN z+r9bRuXw}RN2XuXd_ShHs{GtrTJK+(fBt~!PKzi(&^IUHdw_MqVutj)TsTs4Kq-I=WX2VWiAHTRu}wNc;-DPE!k@vGXkq*y zUhu$3@V9<#&*je8d-yu~>CwngR)*O&^|aX1e!*}5TIH4vk((Olw$-Qy*14gRgO}~I z+MDZfS<}@ll4z1l(Bpkrte_Tm(11<=gDF7LJ41njRPR+DFJsdD+H{hfmkCEjfWZ|> zJU9rvIt+$N0L5D#`-qU8?{`Tm(2k1f7|VSPiz-o0+$}kYwFTR!UGEoQ4%Yk?0a+M` zu+L&vj$cSGS56F}(t*~j&+*px^O!@AU`lS!J7x}*5EX_3ECT^Ue82qIUP(0KbYbHp z$&q{BKRik?f|oO0n~LMDImm{8RIlV{FbNGsUre<*^zT7&eosJgyY^jMK4;@isc2Ty zJ-(1w9^hh6jt^j7D*8pl0Y)HY$KUq&-iE+?z}&KOot?q$@w(mQq0@A(!RsJCodUMv zPgk3G&VsTu_s8=(L6Mq2TnEn_rX4`IeFqbf#+Q%}HH^pQIA_AFyd;bz1F+?sW@?`=JYOW+@Y!CZoms;6?`Kz);s3>68v+uq>& z93^59v<(=-tLW&BD)B>Uj6s=2(*ap18c98n+1q1!q&mIcjpClB5EeE*kSp9A2+Gj2 z*^{;#mJxSMrXmN_4N3!7ig;S-7y z#Z`gbP6>YiyYP!S)>R?)%%Zf}X|CKXf%|qSShh+H`7JdT15_dMuwnLG1YQloZYp zo{xb{$Zi|C`z@KP-4%=mQ2i={}zyowzn! z(5G$~AB2h}R2nN1Qf@NU?HW&h13xwjsRcB<@sR}`NzVI4o05_)Ac1jw1M@0c7F`CE zzf{Aui&B=A0w%%B0FRjeIK%|$ejkf9)MxE2vOt1`5Z|s)XV3vBXs9A1$Jk8DH77N& z=+sK+xy9l`^bm<20<^83iChrD&tiIVT^VC`_56&7t2+=xj7Uro&l;NT4)qDFh|p|d zQ2$U4d)RG8rQi>tecSc8{56Ht@3panu*B43boC>2{z4h8LVc2aX;)BAq*G^0@Mqo6 zdiyhNh+4W9j8kggG|f`N=KxGm{tSReJ&?WI*r0IGP@v~@Z+{p>b-74{vYPPzSiMgo>jWuYfbbE%v;pi05Fsmf1}o}i>QJMy z**}pOx}4IDn~>6KoK1ySsf=Qw&;*b3^I!4hatg( zOg8Wd?Qgk>Tydg?u%YJh)42OmD-#b73r{BVVshLdX?^aZZQQxtVF3c6UQ+5gMnzqh zAHyQbq?Tk$?bd+GY; z{3y_Lz=pG2o0(-+pZ!$3j_ci zm?0V8cJuKkNJut(h!R~2aUwmI+A-cVu$F;Hq3-1?Y)cKu+k2+WQfBb9LWEd3}Jf(Lu=6~u?v5XllsO!hp)&^BaP{NNa(Q&M9{LffbK zJN?Rx;dhBpm=A Date: Tue, 2 Feb 2016 15:13:19 -0800 Subject: [PATCH 0004/1801] fixed formatting --- CONTRIBUTORS.md | 12 ++++++------ DEVELOPMENT.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9a8821a446..899c249a94 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,6 +1,6 @@ -Darrel Miller (@darrelmiller) -Jason Harmon (@jasonh-n-austin) -Jeremy Whitlock (@whitlockjc) -Marsh Gardiner (@earth2marsh) -Ron Ratovsky (@webron) -Tony Tam (@fehguy) \ No newline at end of file +* Darrel Miller (@darrelmiller) +* Jason Harmon (@jasonh-n-austin) +* Jeremy Whitlock (@whitlockjc) +* Marsh Gardiner (@earth2marsh) +* Ron Ratovsky (@webron) +* Tony Tam (@fehguy) \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index cea8473f8c..2a0e574521 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,4 +1,4 @@ -## Objective of this Document +## Development Guidelines Establish guidelines which build a transparent, open mechanism for deciding how to change the specification. The TCB will initially follow these processes when merging changes from external contributors or from the TCB itself, and adjust them as it makes sense. From 96eaa6265720a53d8025ed1edc062a3e16f9ac61 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 2 Feb 2016 15:14:38 -0800 Subject: [PATCH 0005/1801] fixed formatting --- CONTRIBUTORS.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 899c249a94..6043c58832 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,6 +1,6 @@ -* Darrel Miller (@darrelmiller) -* Jason Harmon (@jasonh-n-austin) -* Jeremy Whitlock (@whitlockjc) -* Marsh Gardiner (@earth2marsh) -* Ron Ratovsky (@webron) -* Tony Tam (@fehguy) \ No newline at end of file +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jason Harmon [@jasonh-n-austin](https://github.com/jasonh-n-austin) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Ron Ratovsky [@webron](https://github.com/webron) +* Tony Tam [@fehguy](https://github.com/fehguy) \ No newline at end of file From 6d2c5cdf0e2d125c7ed640fc5d82e98ef982e121 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 2 Feb 2016 15:26:28 -0800 Subject: [PATCH 0006/1801] docs --- DEVELOPMENT.md | 15 ++++++++------- README.md | 6 ++++-- versions/3.0.md | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 versions/3.0.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2a0e574521..01bbd8fa38 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,14 +1,14 @@ ## Development Guidelines -Establish guidelines which build a transparent, open mechanism for deciding how to change the specification. The TCB will initially follow these processes when merging changes from external contributors or from the TCB itself, and adjust them as it makes sense. +This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Contributor Board will initially follow these processes when merging changes from external contributors or from the TCB itself. This guideline document will be adjusted as it makes sense. ## OAI Specification Driving factors -The spec should be use-case driven. We can write support for hypothetical use cases as we see fit, but they should be backed by realistic scenarios +The OpenAPI Specification should be use-case driven. We can write support for hypothetical use cases as we see fit, but they should be backed by realistic scenarios -## Specification change criteria +## Specification Change Criteria -The specification _will change_ from the 2.0 version. We should typically do so when any of the following criteria are met: +The specification _will change_ from the original 2.0 version. We should typically do so when any of the following criteria are met: - Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear - Consistency. A portion of the specification is not consistent with the rest, or the industry standard terminology @@ -25,7 +25,7 @@ The specification _will change_ from the 2.0 version. We should typically do so - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal - New features should be done in feature branches which, upon approval, be merged into the OpenAPI.next branch. - Use labels for the workflow of specification changes. For example, this may be labeled as `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, `needs approval`. These labels must be assigned by project committers - - An issue will be opened for each feature change. Embedded in the issue OR ideally linked in a file via PR, a document should be supplied for use cases for the change + - An issue will be opened for each feature change. Embedded in the issue OR ideally linked in a file via pull-request (PR), a document should be supplied for use cases for the change - A PR will be used to describe the _proposed_ solution, and linked to the original issue - Not all committers will contribute to ever single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel - When the OpenApi.next spec is complete and approved for release, the branch will be merged to master. @@ -46,5 +46,6 @@ No change should be approved until there is documentation for it, supplied in an We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, etc. These must be anonymized, discussed in a private repository, or offline - - Offline Discussions should live in issues. - - Realtime discussions should be in a public chat such as IRC or Slack \ No newline at end of file + - Asynchronous discussions should live in the GitHub issues for this project + - Realtime discussions should be in a public chat such as IRC or Slack + diff --git a/README.md b/README.md index 62305fc617..b9247a6781 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,14 @@ You can see the current process for development inside the OpenAPI Specification ## Participation -The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. It encourages participation from individuals and companies alike. If you wish to participate in the evolution of the OpenAPI Specification, please consider the following: +The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. The OAI encourages participation from individuals and companies alike. If you wish to participate in the evolution of the OpenAPI Specification, please consider the following: * Review the [current specification](). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so it's clear how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. -* Create an issue to describe a concern and/or a pull request to provide a solution. If providing a pull request, please ensure you are adding comments regarding the **Approving Changes** section of the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) guideline. +* Create an issue to describe a new concern along with, if possible, a proposed solution. + +Be aware that all feedback cannot be accommodated and there may be solid arguments to/from a change being appropriate for the specification. ## License diff --git a/versions/3.0.md b/versions/3.0.md new file mode 100644 index 0000000000..481444e11f --- /dev/null +++ b/versions/3.0.md @@ -0,0 +1,5 @@ +# OpenAPI Specification + +#### Version 3.0 + +(coming soon) \ No newline at end of file From 0665b8d5d729a1770472ad712509bd16fdd32520 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 2 Feb 2016 15:29:58 -0800 Subject: [PATCH 0007/1801] wordning --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9247a6781..5f73ca88dc 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ The OpenAPI Specification is a community driven, open project hosted by the Linu * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern along with, if possible, a proposed solution. -Be aware that all feedback cannot be accommodated and there may be solid arguments to/from a change being appropriate for the specification. +Be aware that not all feedback can be accommodated and there may be solid arguments to/from a change being appropriate for the specification. ## License From c9764861e5e00322eba359279ed77f50444a829c Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 2 Mar 2016 16:17:56 +0200 Subject: [PATCH 0008/1801] Clenup JS test. Resolve external $ref during tests. --- .travis.yml | 9 +-- package.json | 28 +++----- test/validate.js | 163 +++++++++++++---------------------------------- 3 files changed, 54 insertions(+), 146 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4aff41d513..ceb7fef10c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,5 @@ scala: - 2.10.4 script: - npm install - - gulp lint + - npm test - sbt ++$TRAVIS_SCALA_VERSION test - - mocha -env: - - VALIDATORS=tv4 - - VALIDATORS=zschema -matrix: - allow_failures: - - env: VALIDATORS=tv4 diff --git a/package.json b/package.json index 4fa476b77a..b182b8483b 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,24 @@ { - "name": "swagger-validator", - "version": "0.0.1", - "description": "validates a file", - "author": { - "name": "Tony Tam", - "email": "fehguy@gmail.com", - "url": "http://swagger.io" - }, - "license": "Apache", - "readmeFilename": "README.md", - "dependencies": { - "tv4": "~1.1.x", - "chai": "1.9.x" + "private": true, + "scripts": { + "test": "gulp lint && mocha" }, + "dependencies": {}, "devDependencies": { - "glob": "^4.0.5", + "chai": "^3.5.0", + "glob": "^7.0.0", "gulp": "~3.8.x", "gulp-ext-replace": "^0.1.0", "gulp-jsonlint": "0.0.3", "gulp-util": "^3.0.0", "gulp-yaml": "0.0.3", "js-yaml": "^3.1.0", + "json-schema-ref-parser": "^2.2.0", "json2yaml": "^1.0.3", "jsonschema": "^1.0.0", + "lodash": "^4.5.1", "map-stream": "^0.1.0", - "mocha": "^1.21.3", - "q": "^1.0.1", - "request": "^2.39.0", - "z-schema": "^2.4.9" + "mocha": "^2.4.5", + "z-schema": "^3.16.1" } } diff --git a/test/validate.js b/test/validate.js index 243442d3e0..849f68a176 100644 --- a/test/validate.js +++ b/test/validate.js @@ -1,139 +1,62 @@ -var Q = require('q'); -var glob = require('glob'); -var tv4 = require('tv4'); -var ZSchema = require('z-schema'); var fs = require('fs'); -var assert = require('chai').assert; +var path = require('path'); + +var _ = require('lodash'); +var glob = require('glob'); var yaml = require('js-yaml'); -var request = require("request") +var ZSchema = require('z-schema'); +var expect = require('chai').expect; +var RefParser = require('json-schema-ref-parser'); -var schema = JSON.parse(fs.readFileSync("./schemas/v2.0/schema.json", 'utf8')); -var validators = (process.env.VALIDATORS || "tv4,zschema").split(",") +var schema = require('../schemas/v2.0/schema.json'); -var validationMethods = { - tv4: { - setup: function() { - var deferred = Q.defer(); - request({ - url: "http://json-schema.org/draft-04/schema", - json: true - }, function (error, response, body) { - if (!error && response.statusCode === 200) { - tv4.addSchema("http://json-schema.org/draft-04/schema", body); - deferred.resolve(); - } else { - deferred.reject(new Error("Request failed")); - } - }) - return deferred.promise; - }, - validate: function(schema, data) { - var result = tv4.validateMultiple(data, schema, true, true); - assert(result.missing.length == 0, "Missing schemas: " + result.missing) - if (result.errors.length > 0) { - for (i in result.errors) { - // Remove stack trace so results are readable - delete result.errors[i].stack; - } - } - assert(result.valid == true, "Validation failed: " + JSON.stringify(result, null, "\t")); - }, - }, - zschema: { - setup: function() { - var deferred = Q.defer() - request({ - url: "http://json-schema.org/draft-04/schema" - }, function (error, response, body) { - if (!error && response.statusCode === 200) { - ZSchema.setRemoteReference("http://json-schema.org/draft-04/schema", body); - deferred.resolve(); - } else { - deferred.reject(new Error("Request failed")); - } - }) - return deferred.promise; - }, - validate: function(schema, data) { - var validator = new ZSchema({ sync: true }); - var valid = validator.validate(data, schema); - if (!valid) { - var error = validator.getLastError(); - throw new Error("ZSchema failed: " + JSON.stringify(error, null, "\t")); - } - assert(valid == true) - } - } +function validate(data) { + var validator = new ZSchema(); + validator.validate(data, schema); + var error = validator.getLastError(); + error = JSON.stringify(error, null, 2); + expect(error).to.deep.equal('null'); } -var setupValidators = function(done) { - var setupPromises = [] - validators.forEach(function(validator) { - setupPromises.push(validationMethods[validator].setup()) - }); - return Q.all(setupPromises).then(function() { - done(); - }) +function readFile(file, isYaml) { + var ext = path.extname(file); + var data = fs.readFileSync(file, 'utf8'); + + expect(ext).to.be.oneOf(['.json', '.yaml']); + if (ext === '.yaml') + return yaml.safeLoad(data); + else if (ext === '.json') + return JSON.parse(data); } -var createYAMLTest = function(file, validator) { - if (validators.indexOf(validator) == -1) - return; +function validateFiles(pattern) { + files = glob.sync(pattern) + files.forEach(function(file) { + it("should validate " + file, function() { + var swagger = readFile(file); - it("should validate " + file + " with " + validator, function() { - var data = yaml.safeLoad(fs.readFileSync(file, 'utf8')); - validationMethods[validator].validate(schema, data); - }) -} + expect(swagger).to.be.an('object'); + if (_.isUndefined(swagger.swagger)) + return; -var createJSONTest = function(file, validator) { - if (validators.indexOf(validator) == -1) - return; + validate(swagger); - it("should validate " + file + " with " + validator, function() { - var data = JSON.parse(fs.readFileSync(file, 'utf8')); - validationMethods[validator].validate(schema, data); + return RefParser.dereference(file, { + $refs: { + internal: false // Don't dereference internal $refs, only external + } + }) + .then(function(resolveSwagger) { + validate(resolveSwagger); + }); + }) }) } describe('JSON Samples', function() { - before(function(done) { - setupValidators(done); - }) - exclusions = ["./examples/v2.0/json/petstore-separate/common/Error.json", - "./examples/v2.0/json/petstore-separate/spec/NewPet.json", - "./examples/v2.0/json/petstore-separate/spec/Pet.json", - "./examples/v2.0/json/petstore-separate/spec/parameters.json"] - - files = glob.sync("./examples/**/*.json") - validators.forEach(function(validator) { - files.forEach(function(file) { - if (exclusions.indexOf(file) == -1) { - createJSONTest(file, validator); - } else { - //TODO: validate separate schema files in exclusion list - } - }) - }) + validateFiles('./examples/**/*.json') }) describe('YAML Samples', function() { - before(function(done) { - setupValidators(done); - }) - exclusions = ["./examples/v2.0/yaml/petstore-separate/common/Error.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/Pet.yaml", - "./examples/v2.0/yaml/petstore-separate/spec/parameters.yaml"] - - files = glob.sync("./examples/**/*.yaml") - validators.forEach(function(validator) { - files.forEach(function(file) { - if (exclusions.indexOf(file) == -1) { - createYAMLTest(file, validator); - } else { - //TODO: validate separate schema files in exclusion list - } - }) - }) + validateFiles('./examples/**/*.yaml') }) From 9d7cf5c97a6a21b16f59ada65e18b90ac7fc14ca Mon Sep 17 00:00:00 2001 From: Stephan Jaensch Date: Tue, 8 Mar 2016 20:54:40 +0100 Subject: [PATCH 0009/1801] Convert response codes in YAML specs to be strings According to the spec, response codes should be of type string. This is the case in the JSON examples, but not in the YAML ones, causing issues with consumers that are implemented according to spec. Let's fix the examples so they don't set a bad... example. --- examples/v2.0/yaml/api-with-examples.yaml | 8 ++++---- examples/v2.0/yaml/petstore-expanded.yaml | 8 ++++---- examples/v2.0/yaml/petstore-minimal.yaml | 2 +- examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml | 2 +- .../v2.0/yaml/petstore-separate/spec/parameters.yaml | 2 +- examples/v2.0/yaml/petstore-separate/spec/swagger.yaml | 10 +++++----- examples/v2.0/yaml/petstore-simple.yaml | 8 ++++---- examples/v2.0/yaml/petstore-with-external-docs.yaml | 8 ++++---- examples/v2.0/yaml/petstore.yaml | 6 +++--- examples/v2.0/yaml/uber.yaml | 10 +++++----- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/v2.0/yaml/api-with-examples.yaml b/examples/v2.0/yaml/api-with-examples.yaml index 136a3df806..2f4a1ccf10 100644 --- a/examples/v2.0/yaml/api-with-examples.yaml +++ b/examples/v2.0/yaml/api-with-examples.yaml @@ -10,7 +10,7 @@ paths: produces: - application/json responses: - 200: + "200": description: |- 200 300 response examples: @@ -41,7 +41,7 @@ paths: } ] } - 300: + "300": description: |- 200 300 response examples: @@ -79,7 +79,7 @@ paths: produces: - application/json responses: - 200: + "200": description: |- 200 203 response examples: @@ -122,7 +122,7 @@ paths: ] } } - 203: + "203": description: |- 200 203 response examples: diff --git a/examples/v2.0/yaml/petstore-expanded.yaml b/examples/v2.0/yaml/petstore-expanded.yaml index e450633a5e..a5fee3ad9a 100644 --- a/examples/v2.0/yaml/petstore-expanded.yaml +++ b/examples/v2.0/yaml/petstore-expanded.yaml @@ -44,7 +44,7 @@ paths: type: integer format: int32 responses: - 200: + "200": description: pet response schema: type: array @@ -65,7 +65,7 @@ paths: schema: $ref: '#/definitions/NewPet' responses: - 200: + "200": description: pet response schema: $ref: '#/definitions/Pet' @@ -85,7 +85,7 @@ paths: type: integer format: int64 responses: - 200: + "200": description: pet response schema: $ref: '#/definitions/Pet' @@ -104,7 +104,7 @@ paths: type: integer format: int64 responses: - 204: + "204": description: pet deleted default: description: unexpected error diff --git a/examples/v2.0/yaml/petstore-minimal.yaml b/examples/v2.0/yaml/petstore-minimal.yaml index 170e3ac3dc..c3e06e9152 100644 --- a/examples/v2.0/yaml/petstore-minimal.yaml +++ b/examples/v2.0/yaml/petstore-minimal.yaml @@ -24,7 +24,7 @@ produces: - "application/json" responses: - 200: + "200": description: "A list of pets." schema: type: "array" diff --git a/examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml b/examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml index 531e8df34b..35e67449c5 100644 --- a/examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml +++ b/examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml @@ -6,4 +6,4 @@ allOf: properties: description: type: integer - format: int64 \ No newline at end of file + format: int64 diff --git a/examples/v2.0/yaml/petstore-separate/spec/parameters.yaml b/examples/v2.0/yaml/petstore-separate/spec/parameters.yaml index a95e16b4d1..18736aebd0 100644 --- a/examples/v2.0/yaml/petstore-separate/spec/parameters.yaml +++ b/examples/v2.0/yaml/petstore-separate/spec/parameters.yaml @@ -13,4 +13,4 @@ limitsParam: description: maximum number of results to return required: false type: integer - format: int32 \ No newline at end of file + format: int32 diff --git a/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml b/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml index 6f4a50692d..850527ebf6 100644 --- a/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml +++ b/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml @@ -32,7 +32,7 @@ paths: - $ref: 'parameters.yaml#/tagsParam' - $ref: 'parameters.yaml#/limitsParam' responses: - 200: + "200": description: pet response schema: type: array @@ -53,7 +53,7 @@ paths: schema: $ref: 'NewPet.yaml' responses: - 200: + "200": description: pet response schema: $ref: 'Pet.yaml' @@ -73,7 +73,7 @@ paths: type: integer format: int64 responses: - 200: + "200": description: pet response schema: $ref: 'Pet.yaml' @@ -92,9 +92,9 @@ paths: type: integer format: int64 responses: - 204: + "204": description: pet deleted default: description: unexpected error schema: - $ref: '../common/Error.yaml' \ No newline at end of file + $ref: '../common/Error.yaml' diff --git a/examples/v2.0/yaml/petstore-simple.yaml b/examples/v2.0/yaml/petstore-simple.yaml index 78145d4653..d5fa07b428 100644 --- a/examples/v2.0/yaml/petstore-simple.yaml +++ b/examples/v2.0/yaml/petstore-simple.yaml @@ -45,7 +45,7 @@ type: "integer" format: "int32" responses: - 200: + "200": description: "pet response" schema: type: "array" @@ -69,7 +69,7 @@ schema: $ref: "#/definitions/NewPet" responses: - 200: + "200": description: "pet response" schema: $ref: "#/definitions/Pet" @@ -95,7 +95,7 @@ type: "integer" format: "int64" responses: - 200: + "200": description: "pet response" schema: $ref: "#/definitions/Pet" @@ -115,7 +115,7 @@ type: "integer" format: "int64" responses: - 204: + "204": description: "pet deleted" default: description: "unexpected error" diff --git a/examples/v2.0/yaml/petstore-with-external-docs.yaml b/examples/v2.0/yaml/petstore-with-external-docs.yaml index cd6ddc7357..3db47ff362 100644 --- a/examples/v2.0/yaml/petstore-with-external-docs.yaml +++ b/examples/v2.0/yaml/petstore-with-external-docs.yaml @@ -54,7 +54,7 @@ type: "integer" format: "int32" responses: - 200: + "200": description: "pet response" schema: type: "array" @@ -78,7 +78,7 @@ schema: $ref: "#/definitions/NewPet" responses: - 200: + "200": description: "pet response" schema: $ref: "#/definitions/Pet" @@ -104,7 +104,7 @@ type: "integer" format: "int64" responses: - 200: + "200": description: "pet response" schema: $ref: "#/definitions/Pet" @@ -124,7 +124,7 @@ type: "integer" format: "int64" responses: - 204: + "204": description: "pet deleted" default: description: "unexpected error" diff --git a/examples/v2.0/yaml/petstore.yaml b/examples/v2.0/yaml/petstore.yaml index bc3fc4111a..790948cb93 100644 --- a/examples/v2.0/yaml/petstore.yaml +++ b/examples/v2.0/yaml/petstore.yaml @@ -27,7 +27,7 @@ paths: type: integer format: int32 responses: - 200: + "200": description: An paged array of pets headers: x-next: @@ -45,7 +45,7 @@ paths: tags: - pets responses: - 201: + "201": description: Null response default: description: unexpected error @@ -64,7 +64,7 @@ paths: description: The id of the pet to retrieve type: string responses: - 200: + "200": description: Expected response to a valid request schema: $ref: '#/definitions/Pets' diff --git a/examples/v2.0/yaml/uber.yaml b/examples/v2.0/yaml/uber.yaml index 40fed224eb..3556cf5e87 100644 --- a/examples/v2.0/yaml/uber.yaml +++ b/examples/v2.0/yaml/uber.yaml @@ -42,7 +42,7 @@ paths: tags: - Products responses: - 200: + "200": description: An array of products schema: type: array @@ -84,7 +84,7 @@ paths: tags: - Estimates responses: - 200: + "200": description: An array of price estimates by product schema: type: array @@ -123,7 +123,7 @@ paths: tags: - Estimates responses: - 200: + "200": description: An array of products schema: type: array @@ -140,7 +140,7 @@ paths: tags: - User responses: - 200: + "200": description: Profile information for a user schema: $ref: '#/definitions/Profile' @@ -166,7 +166,7 @@ paths: tags: - User responses: - 200: + "200": description: History information for the given user schema: $ref: '#/definitions/Activities' From 97025a921fc1cd5026f989eab01a0f21575ec972 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 14:19:18 -0700 Subject: [PATCH 0010/1801] committed 2.0 version --- versions/3.0.md | 2297 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 2295 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 481444e11f..67f77b4c9f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,5 +1,2298 @@ # OpenAPI Specification +## (fka Swagger RESTful API Documentation Specification) -#### Version 3.0 +#### Version 2.0 -(coming soon) \ No newline at end of file +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). + +The Swagger specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). + +## Introductions + +Swagger™ is a project used to describe and document RESTful APIs. + +The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. + +## Revision History + +Version | Date | Notes +--- | --- | --- +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification + +## Definitions + +##### Path Templating +Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. + +##### Mime Types +Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). + +Some examples of possible mime type definitions: +``` + text/plain; charset=utf-8 + application/json + application/vnd.github+json + application/vnd.github.v3+json + application/vnd.github.v3.raw+json + application/vnd.github.v3.text+json + application/vnd.github.v3.html+json + application/vnd.github.v3.full+json + application/vnd.github.v3.diff + application/vnd.github.v3.patch +``` +##### HTTP Status Codes +The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). + +## Specification + +### Format + +The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to +represent a Swagger specification file. + +For example, if a field is said to have an array value, the JSON array representation will be used: + +```js +{ + "field" : [...] +} +``` + +While the API is described using JSON it does not impose a JSON input/output to the API itself. + +All field names in the specification are **case sensitive**. + +The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name. + +### File Structure + +The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. + +By convention, the Swagger specification file is named `swagger.json`. + +### Data Types + +Primitive data types in the Swagger Specification are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. + +An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file. + +Primitives have an optional modifier property `format`. Swagger uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the Swagger Specification are: + + +Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments +----------- | ------ | -------- | -------- +integer | `integer` | `int32` | signed 32 bits +long | `integer` | `int64` | signed 64 bits +float | `number` | `float` | | +double | `number` | `double` | | +string | `string` | | | +byte | `string` | `byte` | base64 encoded characters +binary | `string` | `binary` | any sequence of octets +boolean | `boolean` | | | +date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +password | `string` | `password` | Used to hint UIs the input needs to be obscured. + +### Schema + +#### Swagger Object + +This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +swagger | `string` | **Required.** Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. +info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. +host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). +basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#swaggerHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). +schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself. +consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. +definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. +parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. +responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. +securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. +tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +#### Info Object + +The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +title | `string` | **Required.** The title of the application. +description | `string` | A short description of the application. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +termsOfService | `string` | The Terms of Service for the API. +contact | [Contact Object](#contactObject) | The contact information for the exposed API. +license | [License Object](#licenseObject) | The license information for the exposed API. +version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Info Object Example: + +```js +{ + "title": "Swagger Sample App", + "description": "This is a sample server Petstore server.", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "http://www.swagger.io/support", + "email": "support@swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0.1" +} +``` + +```yaml +title: Swagger Sample App +description: This is a sample server Petstore server. +termsOfService: http://swagger.io/terms/ +contact: + name: API Support + url: http://www.swagger.io/support + email: support@swagger.io +license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +version: 1.0.1 +``` + +#### Contact Object + +Contact information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | The identifying name of the contact person/organization. +url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. +email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Contact Object Example: + +```js +{ + "name": "API Support", + "url": "http://www.swagger.io/support", + "email": "support@swagger.io" +} +``` + +```yaml +name: API Support +url: http://www.swagger.io/support +email: support@swagger.io +``` + +#### License Object + +License information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | **Required.** The license name used for the API. +url | `string` | A URL to the license used for the API. MUST be in the format of a URL. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### License Object Example: + +```js +{ + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" +} +``` + +```yaml +name: Apache 2.0 +url: http://www.apache.org/licenses/LICENSE-2.0.html +``` + +#### Paths Object + +Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL. +The Paths may be empty, due to [ACL constraints](#securityFiltering). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Paths Object Example + +```js +{ + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "A list of pets.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/pet" + } + } + } + } + } + } +} +``` + +```yaml +/pets: + get: + description: Returns all pets from the system that the user has access to + produces: + - application/json + responses: + '200': + description: A list of pets. + schema: + type: array + items: + $ref: '#/definitions/pet' +``` + +#### Path Item Object + +Describes the operations available on a single path. +A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +$ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +get | [Operation Object](#operationObject) | A definition of a GET operation on this path. +put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. +post | [Operation Object](#operationObject) | A definition of a POST operation on this path. +delete | [Operation Object](#operationObject) | A definition of a DELETE operation on this path. +options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. +head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. +patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Path Item Object Example + +```js +{ + "get": { + "description": "Returns pets based on ID", + "summary": "Find pets by ID", + "operationId": "getPetsById", + "produces": [ + "application/json", + "text/html" + ], + "responses": { + "200": { + "description": "pet response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Pet" + } + } + }, + "default": { + "description": "error payload", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to use", + "required": true, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv" + } + ] +} +``` + +```yaml +get: + description: Returns pets based on ID + summary: Find pets by ID + operationId: getPetsById + produces: + - application/json + - text/html + responses: + '200': + description: pet response + schema: + type: array + items: + $ref: '#/definitions/Pet' + default: + description: error payload + schema: + $ref: '#/definitions/ErrorModel' +parameters: +- name: id + in: path + description: ID of pet to use + required: true + type: array + items: + type: string + collectionFormat: csv +``` + +#### Operation Object + +Describes a single API operation on a path. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +summary | `string` | A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. +description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. +consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#swaggerConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#swaggerProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. +responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. +schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#swaggerSchemes) definition. +deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#swaggerSecurity). To remove a top-level security declaration, an empty array can be used. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Operation Object Example + +```js +{ + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "description": "", + "operationId": "updatePetWithForm", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be updated", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "formData", + "description": "Updated name of the pet", + "required": false, + "type": "string" + }, + { + "name": "status", + "in": "formData", + "description": "Updated status of the pet", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Pet updated." + }, + "405": { + "description": "Invalid input" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] +} +``` + +```yaml +tags: +- pet +summary: Updates a pet in the store with form data +description: "" +operationId: updatePetWithForm +consumes: +- application/x-www-form-urlencoded +produces: +- application/json +- application/xml +parameters: +- name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: string +- name: name + in: formData + description: Updated name of the pet + required: false + type: string +- name: status + in: formData + description: Updated status of the pet + required: false + type: string +responses: + '200': + description: Pet updated. + '405': + description: Invalid input +security: +- petstore_auth: + - write:pets + - read:pets +``` + + +#### External Documentation Object + +Allows referencing an external resource for extended documentation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +description | `string` | A short description of the target documentation. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### External Documentation Object Example + +```js +{ + "description": "Find more info here", + "url": "https://swagger.io" +} +``` + +```yaml +description: Find more info here +url: https://swagger.io +``` + +#### Parameter Object + +Describes a single operation parameter. + +A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). + +There are five possible parameter types. +* Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. +* Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +* Header - Custom headers that are expected as part of the request. +* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. +* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): + * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. + * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
+in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "body". +description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. + +If [`in`](#parameterIn) is `"body"`: + +Field Name | Type | Description +---|:---:|--- +schema | [Schema Object](#schemaObject) | **Required.** The schema defining the type used for the body parameter. + +If [`in`](#parameterIn) is any value other than `"body"`: + +Field Name | Type | Description +---|:---:|--- +type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. If `type` is `"file"`, the [`consumes`](#operationConsumes) MUST be either `"multipart/form-data"`, `" application/x-www-form-urlencoded"` or both and the parameter MUST be [`in`](#parameterIn) `"formData"`. +format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. +items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. +collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
  • `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`. +default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. +maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. +minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. +pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. +maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. +minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. +uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. +enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. +multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. + + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + + +##### Parameter Object Examples + +###### Body Parameters + +A body parameter with a referenced schema definition (normally for a model definition): +```js +{ + "name": "user", + "in": "body", + "description": "user to add to the system", + "required": true, + "schema": { + "$ref": "#/definitions/User" + } +} +``` + +```yaml +name: user +in: body +description: user to add to the system +required: true +schema: + $ref: '#/definitions/User' +``` + +A body parameter that is an array of string values: +```js +{ + "name": "user", + "in": "body", + "description": "user to add to the system", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +name: user +in: body +description: user to add to the system +required: true +schema: + type: array + items: + type: string +``` + +###### Other Parameters + +A header parameter with an array of 64 bit integer numbers: + +```js +{ + "name": "token", + "in": "header", + "description": "token to be passed as a header", + "required": true, + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "collectionFormat": "csv" +} +``` + +```yaml +name: token +in: header +description: token to be passed as a header +required: true +type: array +items: + type: integer + format: int64 +collectionFormat: csv +``` + +A path parameter of a string value: +```js +{ + "name": "username", + "in": "path", + "description": "username to fetch", + "required": true, + "type": "string" +} +``` + +```yaml +name: username +in: path +description: username to fetch +required: true +type: string +``` + +An optional query parameter of a string value, allowing multiple values by repeating the query parameter: +```js +{ + "name": "id", + "in": "query", + "description": "ID of the object to fetch", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" +} +``` + +```yaml +name: id +in: query +description: ID of the object to fetch +required: false +type: array +items: + type: string +collectionFormat: multi +``` + +A form data with file type for a file upload: +```js +{ + "name": "avatar", + "in": "formData", + "description": "The avatar of the user", + "required": true, + "type": "file" +} +``` + +```yaml +name: avatar +in: formData +description: The avatar of the user +required: true +type: file +``` + +#### Items Object + +A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +type | `string` | **Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed. +format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. +items | [Items Object](#itemsObject) | **Required if [`type`](#itemsType) is "array".** Describes the type of items in the array. +collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. +default | * | Declares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#itemsType) for the data type. +maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. +minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. +pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. +maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. +minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. +uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. +enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. +multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Items Object Examples + +Items must be of type string and have the minimum length of 2 characters: + +```js +{ + "type": "string", + "minLength": 2 +} +``` + +```yaml +type: string +minLength: 2 +``` + +An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive): + +```js +{ + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 63 + } +} +``` + +```yaml +type: array +items: + type: integer + minimum: 0 + maximum: 63 +``` + +#### Responses Object + +A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. + +The `default` can be used a default response object for all HTTP codes that are not covered individually by the specification. + +The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + + +##### Responses Object Example + +A 200 response for successful operation and a default response for others (implying an error): + +```js +{ + "200": { + "description": "a pet to be returned", + "schema": { + "$ref": "#/definitions/Pet" + } + }, + "default": { + "description": "Unexpected error", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } +} +``` + +```yaml +'200': + description: a pet to be returned + schema: + $ref: '#/definitions/Pet' +default: + description: Unexpected error + schema: + $ref: '#/definitions/ErrorModel' +``` + +#### Response Object +Describes a single response from an API Operation. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type. +headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. +examples | [Example Object](#exampleObject) | An example of the response message. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Response Object Examples + +Response of an array of a complex type: + +```js +{ + "description": "A complex object array response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/VeryComplexType" + } + } +} +``` + +```yaml +description: A complex object array response +schema: + type: array + items: + $ref: '#/definitions/VeryComplexType' +``` + +Response with a string type: + +```js +{ + "description": "A simple string response", + "schema": { + "type": "string" + } +} +``` + +```yaml +description: A simple string response +schema: + type: string +``` + +Response with headers: + +```js +{ + "description": "A simple string response", + "schema": { + "type": "string" + }, + "headers": { + "X-Rate-Limit-Limit": { + "description": "The number of allowed requests in the current period", + "type": "integer" + }, + "X-Rate-Limit-Remaining": { + "description": "The number of remaining requests in the current period", + "type": "integer" + }, + "X-Rate-Limit-Reset": { + "description": "The number of seconds left in the current period", + "type": "integer" + } + } +} +``` + +```yaml +description: A simple string response +schema: + type: string +headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + type: integer + X-Rate-Limit-Remaining: + description: The number of remaining requests in the current period + type: integer + X-Rate-Limit-Reset: + description: The number of seconds left in the current period + type: integer +``` + +Response with no return value: + +```js +{ + "description": "object created" +} +``` + +```yaml +description: object created +``` + +#### Headers Object +Lists the headers that can be sent as part of a response. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{name} | [Header Object](#headerObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. + +##### Headers Object Example + +Rate-limit headers: + +```js +{ + "X-Rate-Limit-Limit": { + "description": "The number of allowed requests in the current period", + "type": "integer" + }, + "X-Rate-Limit-Remaining": { + "description": "The number of remaining requests in the current period", + "type": "integer" + }, + "X-Rate-Limit-Reset": { + "description": "The number of seconds left in the current period", + "type": "integer" + } +} +``` + +```yaml +X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + type: integer +X-Rate-Limit-Remaining: + description: The number of remaining requests in the current period + type: integer +X-Rate-Limit-Reset: + description: The number of seconds left in the current period + type: integer +``` + +#### Example Object + +Allows sharing examples for operation responses. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{[mime type](#mimeTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like. + +##### Example Object Example + +Example response for application/json mimetype of a Pet data type: + +```js +{ + "application/json": { + "name": "Puma", + "type": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + } +} +``` + +```yaml +application/json: + name: Puma + type: Dog + color: Black + gender: Female + breed: Mixed +``` + +#### Header Object + +Field Name | Type | Description +---|:---:|--- +description | `string` | A short description of the header. +type | `string` | **Required.** The type of the object. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. +format | `string` | The extending format for the previously mentioned [`type`](#stType). See [Data Type Formats](#dataTypeFormat) for further details. +items | [Items Object](#itemsObject) | **Required if [`type`](#stType) is "array".** Describes the type of items in the array. +collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. +default | * | Declares the value of the header that the server will use if none is provided. (Note: "default" has no meaning for required headers.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#headerDefault) for the header. +maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. +minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. +pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. +maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. +minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. +uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. +enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. +multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Header Object Example + +A simple header with of an integer type: + +```js +{ + "description": "The number of allowed requests in the current period", + "type": "integer" +} +``` + +```yaml +description: The number of allowed requests in the current period +type: integer +``` + +#### Tag Object + +Allows adding meta data to a single tag that is used by the [Operation Object](#operationObject). It is not mandatory to have a Tag Object per tag used there. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **Required.** The name of the tag. +description | `string` | A short description for the tag. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Tag Object Example + +```js +{ + "name": "pet", + "description": "Pets operations" +} +``` + +```yaml +name: pet +description: Pets operations +``` + +#### Reference Object + +A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. + +The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +$ref | `string` | **Required.** The reference string. + +##### Reference Object Example + +```js +{ + "$ref": "#/definitions/Pet" +} +``` + +```yaml +$ref: '#/definitions/Pet' +``` + +##### Relative Schema File Example +```js +{ + "$ref": "Pet.json" +} +``` + +```yaml +$ref: 'Pet.yaml' +``` + +##### Relative Files With Embedded Schema Example +```js +{ + "$ref": "definitions.json#/Pet" +} +``` + +```yaml +$ref: 'definitions.yaml#/Pet' +``` + +#### Schema Object + +The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. + +Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. + +The following properties are taken directly from the JSON Schema definition and follow the same specifications: +- $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) +- format (See [Data Type Formats](#dataTypeFormat) for further details) +- title +- description ([GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation) +- default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) +- multipleOf +- maximum +- exclusiveMaximum +- minimum +- exclusiveMinimum +- maxLength +- minLength +- pattern +- maxItems +- minItems +- uniqueItems +- maxProperties +- minProperties +- required +- enum +- type + +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. +- items +- allOf +- properties +- additionalProperties + +Other than the JSON Schema subset fields, the following fields may be used for further schema documentation. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as `readOnly` being `true` SHOULD NOT be in the `required` list of the defined schema. Default value is `false`. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. +example | Any | A free-form property to include a an example of an instance for this schema. + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +###### Composition and Inheritance (Polymorphism) + +Swagger allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. + +While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the `definitions` property. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. + +###### XML Modeling + +The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. The [XML Object](#xmlObject) contains additional information about the available options. + +##### Schema Object Examples + +###### Primitive Sample + +Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well. + +```js +{ + "type": "string", + "format": "email" +} +``` + +```yaml +type: string +format: email +``` + +###### Simple Model + +```js +{ + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "address": { + "$ref": "#/definitions/Address" + }, + "age": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + } +} +``` + +```yaml +type: object +required: +- name +properties: + name: + type: string + address: + $ref: '#/definitions/Address' + age: + type: integer + format: int32 + minimum: 0 +``` + +###### Model with Map/Dictionary Properties + +For a simple string to string mapping: + +```js +{ + "type": "object", + "additionalProperties": { + "type": "string" + } +} +``` + +```yaml +type: object +additionalProperties: + type: string +``` + +For a string to model mapping: + +```js +{ + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ComplexModel" + } +} +``` + +```yaml +type: object +additionalProperties: + $ref: '#/definitions/ComplexModel' +``` + +###### Model with Example + +```js +{ + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "example": { + "name": "Puma", + "id": 1 + } +} +``` + +```yaml +type: object +properties: + id: + type: integer + format: int64 + name: + type: string +required: +- name +example: + name: Puma + id: 1 +``` + +###### Models with Composition + +```js +{ + "definitions": { + "ErrorModel": { + "type": "object", + "required": [ + "message", + "code" + ], + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer", + "minimum": 100, + "maximum": 600 + } + } + }, + "ExtendedErrorModel": { + "allOf": [ + { + "$ref": "#/definitions/ErrorModel" + }, + { + "type": "object", + "required": [ + "rootCause" + ], + "properties": { + "rootCause": { + "type": "string" + } + } + } + ] + } + } +} +``` + +```yaml +definitions: + ErrorModel: + type: object + required: + - message + - code + properties: + message: + type: string + code: + type: integer + minimum: 100 + maximum: 600 + ExtendedErrorModel: + allOf: + - $ref: '#/definitions/ErrorModel' + - type: object + required: + - rootCause + properties: + rootCause: + type: string +``` + +###### Models with Polymorphism Support + +```js +{ + "definitions": { + "Pet": { + "type": "object", + "discriminator": "petType", + "properties": { + "name": { + "type": "string" + }, + "petType": { + "type": "string" + } + }, + "required": [ + "name", + "petType" + ] + }, + "Cat": { + "description": "A representation of a cat", + "allOf": [ + { + "$ref": "#/definitions/Pet" + }, + { + "type": "object", + "properties": { + "huntingSkill": { + "type": "string", + "description": "The measured skill for hunting", + "default": "lazy", + "enum": [ + "clueless", + "lazy", + "adventurous", + "aggressive" + ] + } + }, + "required": [ + "huntingSkill" + ] + } + ] + }, + "Dog": { + "description": "A representation of a dog", + "allOf": [ + { + "$ref": "#/definitions/Pet" + }, + { + "type": "object", + "properties": { + "packSize": { + "type": "integer", + "format": "int32", + "description": "the size of the pack the dog is from", + "default": 0, + "minimum": 0 + } + }, + "required": [ + "packSize" + ] + } + ] + } + } +} +``` + +```yaml +definitions: + Pet: + type: object + discriminator: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: + description: A representation of a cat + allOf: + - $ref: '#/definitions/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: + description: A representation of a dog + allOf: + - $ref: '#/definitions/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize +``` + +#### XML Object + +A metadata object that allows for more fine-tuned XML model definitions. + +When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property should be used to add that information. See examples for expected behavior. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within the Items Object (`items`), it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. +namespace | `string` | The URL of the namespace definition. Value SHOULD be in the form of a URL. +prefix | `string` | The prefix to be used for the [name](#xmlName). +attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. +wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### XML Object Examples + +The examples of the XML object definitions are included inside a property definition of a [Schema Object](#schemaObject) with a sample of the XML representation of it. + +###### No XML Element + +Basic string property: + +```js +{ + "animals": { + "type": "string" + } +} +``` + +```yaml +animals: + type: string +``` + +```xml +... +``` + +Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default): + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string +``` + +```xml +... +... +... +``` + +###### XML Name Replacement + +```js +{ + "animals": { + "type": "string", + "xml": { + "name": "animal" + } + } +} +``` + +```yaml +animals: + type: string + xml: + name: animal +``` + +```xml +... +``` + + +###### XML Attribute, Prefix and Namespace + +In this example, a full model definition is shown. + +```js +{ + "Person": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "xml": { + "attribute": true + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://swagger.io/schema/sample", + "prefix": "sample" + } + } + } + } + } +} +``` + +```yaml +Person: + type: object + properties: + id: + type: integer + format: int32 + xml: + attribute: true + name: + type: string + xml: + namespace: http://swagger.io/schema/sample + prefix: sample +``` + +```xml + + example + +``` + +###### XML Arrays + +Changing the element names: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal +``` + +```xml +value +value +``` + +The external `name` property has no effect on the XML: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens +``` + +```xml +value +value +``` + +Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +To overcome the above example, the following definition can be used: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +Affecting both internal and external names: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens", + "wrapped": false + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens + wrapped: false +``` + +```xml + + value + value + +``` + +If we change the external element but not the internal ones: + +```js +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +#### Definitions Object + +An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. + +##### Definitions Object Example + +```js +{ + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + } +} +``` + +```yaml +Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string +Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string +``` + +#### Parameters Definitions Object + +An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. + +This does *not* define global operation parameters. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [Parameter Object](#parameterObject) | A single parameter definition, mapping a "name" to the parameter it defines. + +##### Parameters Definition Object Example + +```js +{ + "skipParam": { + "name": "skip", + "in": "query", + "description": "number of items to skip", + "required": true, + "type": "integer", + "format": "int32" + }, + "limitParam": { + "name": "limit", + "in": "query", + "description": "max records to return", + "required": true, + "type": "integer", + "format": "int32" + } +} +``` + +```yaml +skipParam: + name: skip + in: query + description: number of items to skip + required: true + type: integer + format: int32 +limitParam: + name: limit + in: query + description: max records to return + required: true + type: integer + format: int32 +``` + + +#### Responses Definitions Object + +An object to hold responses to be reused across operations. Response definitions can be referenced to the ones defined here. + +This does *not* define global operation responses. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [Response Object](#responseObject) | A single response definition, mapping a "name" to the response it defines. + +##### Responses Definitions Object Example + +```js +{ + "NotFound": { + "description": "Entity not found." + }, + "IllegalInput": { + "description": "Illegal input for operation." + }, + "GeneralError": { + "description": "General Error", + "schema": { + "$ref": "#/definitions/GeneralError" + } + } +} +``` + +```yaml +NotFound: + description: Entity not found. +IllegalInput: + description: Illegal input for operation. +GeneralError: + description: General Error + schema: + $ref: '#/definitions/GeneralError' +``` + +#### Security Definitions Object + +A declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{name} | [Security Scheme Object](#securitySchemeObject) | A single security scheme definition, mapping a "name" to the scheme it defines. + +##### Security Definitions Object Example + +```js +{ + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "flow": "implicit", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } +} +``` + +```yaml +api_key: + type: apiKey + name: api_key + in: header +petstore_auth: + type: oauth2 + authorizationUrl: http://swagger.io/api/oauth/dialog + flow: implicit + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### Security Scheme Object + +Allows the definition of a security scheme that can be used by the operations. Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). + +##### Fixed Fields +Field Name | Type | Validity | Description +---|:---:|---|--- +type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"basic"`, `"apiKey"` or `"oauth2"`. +description | `string` | Any | A short description for security scheme. +name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. +in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. +flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. +scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. + +##### Patterned Fields + +Field Name | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Security Scheme Object Example + +###### Basic Authentication Sample + +```js +{ + "type": "basic" +} +``` + +```yaml +type: basic +``` + +###### API Key Sample + +```js +{ + "type": "apiKey", + "name": "api_key", + "in": "header" +} +``` + +```yaml +type: apiKey +name: api_key +in: header +``` + +###### Implicit OAuth2 Sample + +```js +{ + "type": "oauth2", + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "flow": "implicit", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } +} +``` + +```yaml +type: oauth2 +authorizationUrl: http://swagger.io/api/oauth/dialog +flow: implicit +scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### Scopes Object + +Lists the available scopes for an OAuth2 security scheme. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | `string` | Maps between a name of a scope to a short description of it (as the value of the property). + +##### Patterned Objects + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Scopes Object Example + +```js +{ + "write:pets": "modify pets in your account", + "read:pets": "read your pets" +} +``` + +```yaml +write:pets: modify pets in your account +read:pets: read your pets +``` + +#### Security Requirement Object + +Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes). + +The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#securityDefinitionsObject). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [`string`] | Each name must correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. + +##### Security Requirement Object Examples + +###### Non-OAuth2 Security Requirement + +```js +{ + "api_key": [] +} +``` + +```yaml +api_key: [] +``` + +###### OAuth2 Security Requirement + +```js +{ + "petstore_auth": [ + "write:pets", + "read:pets" + ] +} +``` + +```yaml +petstore_auth: +- write:pets +- read:pets +``` + +### Specification Extensions + +While the Swagger Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. + +The extensions properties are always prefixed by `"x-"` and can have any valid JSON format value. + +The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced). + +### Security Filtering + +Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. + +The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization. + +Two examples for this: + +1. The [Paths Object](#pathsObject) may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. +2. The [Path Item Object](#pathItemObject) may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. From 6f49b29d597e71f58c577a1a7eed273919b3413f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 14:21:55 -0700 Subject: [PATCH 0011/1801] changed swagger references --- versions/3.0.md | 76 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 67f77b4c9f..83ac9cc948 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,22 +1,22 @@ # OpenAPI Specification -## (fka Swagger RESTful API Documentation Specification) -#### Version 2.0 +#### Version 3.0 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). -The Swagger specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). +The OpenAPI Specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). ## Introductions -Swagger™ is a project used to describe and document RESTful APIs. +The OpenAPI Specification is a project used to describe and document RESTful APIs. -The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. +The OpenAPI Specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. ## Revision History Version | Date | Notes --- | --- | --- +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative 2.0 | 2014-09-08 | Release of Swagger 2.0 1.2 | 2014-03-14 | Initial release of the formal document. 1.1 | 2012-08-22 | Release of Swagger 1.1 @@ -50,8 +50,8 @@ The HTTP Status Codes are used to indicate the status of the executed operation. ### Format -The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a Swagger specification file. +The files describing the RESTful API in accordance with the Open API Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to +represent a OAS (OpenAPI Specification) file. For example, if a field is said to have an array value, the JSON array representation will be used: @@ -69,17 +69,17 @@ The schema exposes two types of fields. Fixed fields, which have a declared name ### File Structure -The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. +The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the Swagger specification file is named `swagger.json`. +By convention, the OAS specification file is named `swagger.json`. ### Data Types -Primitive data types in the Swagger Specification are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. +Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file. -Primitives have an optional modifier property `format`. Swagger uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the Swagger Specification are: +Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the OAS are: Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments @@ -98,7 +98,7 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur ### Schema -#### Swagger Object +#### OAS Object This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. @@ -106,27 +106,27 @@ This is the root document object for the API specification. It combines what pre Field Name | Type | Description ---|:---:|--- -swagger | `string` | **Required.** Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. -info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). -basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#swaggerHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself. -consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). -produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). -paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. -definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. -parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. -responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. -securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. -tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. -externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. +oas | `string` | **Required.** Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. +info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. +host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). +basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). +schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself. +consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. +definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. +parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. +responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. +securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. +tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. ##### Patterned Objects Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. #### Info Object @@ -250,14 +250,14 @@ url: http://www.apache.org/licenses/LICENSE-2.0.html #### Paths Object -Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL. +Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. The Paths may be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. ^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Paths Object Example @@ -318,7 +318,7 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#oasParameters). There can be one "body" parameter at most. ##### Patterned Fields @@ -415,13 +415,13 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#swaggerConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#swaggerProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. +consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#oasParameters). There can be one "body" parameter at most. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#swaggerSchemes) definition. +schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#swaggerSecurity). To remove a top-level security declaration, an empty array can be used. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. ##### Patterned Objects @@ -844,12 +844,12 @@ The `Responses Object` MUST contain at least one response code, and it SHOULD be ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. +default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#oasResponses) section. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#oasResponses) section. ^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. From 8760ec148f73dcc1898b719eec037afcaaa37212 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 14:30:11 -0700 Subject: [PATCH 0012/1801] added .travis --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..3ec173ff28 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +sudo: false +script: + - npm install + - gulp lint + - mocha +env: + - VALIDATORS=tv4 + - VALIDATORS=zschema +matrix: + allow_failures: + - env: VALIDATORS=tv4 From 3bf5f1d8b630c4f95590d2bff3956ae38f2c6099 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 14:38:01 -0700 Subject: [PATCH 0013/1801] added from master --- package.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000000..4fa476b77a --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "swagger-validator", + "version": "0.0.1", + "description": "validates a file", + "author": { + "name": "Tony Tam", + "email": "fehguy@gmail.com", + "url": "http://swagger.io" + }, + "license": "Apache", + "readmeFilename": "README.md", + "dependencies": { + "tv4": "~1.1.x", + "chai": "1.9.x" + }, + "devDependencies": { + "glob": "^4.0.5", + "gulp": "~3.8.x", + "gulp-ext-replace": "^0.1.0", + "gulp-jsonlint": "0.0.3", + "gulp-util": "^3.0.0", + "gulp-yaml": "0.0.3", + "js-yaml": "^3.1.0", + "json2yaml": "^1.0.3", + "jsonschema": "^1.0.0", + "map-stream": "^0.1.0", + "mocha": "^1.21.3", + "q": "^1.0.1", + "request": "^2.39.0", + "z-schema": "^2.4.9" + } +} From 54e270d19025bc83bb43873c396a1ec72da5f888 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 14:45:12 -0700 Subject: [PATCH 0014/1801] updated travis --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ec173ff28..66c5dcbb31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ sudo: false script: - npm install - - gulp lint - - mocha env: - VALIDATORS=tv4 - VALIDATORS=zschema From 983b8555751bb4e0a12d844188834598615c791f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 14 Mar 2016 15:06:06 -0700 Subject: [PATCH 0015/1801] fixed per comments --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 83ac9cc948..c263c3bd72 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -71,7 +71,7 @@ The schema exposes two types of fields. Fixed fields, which have a declared name The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the OAS specification file is named `swagger.json`. +By convention, the Open API Specification (OAS) file is named `swagger.json`. ### Data Types @@ -98,7 +98,7 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur ### Schema -#### OAS Object +#### OpenAPI Object This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. @@ -106,7 +106,7 @@ This is the root document object for the API specification. It combines what pre Field Name | Type | Description ---|:---:|--- -oas | `string` | **Required.** Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. +swagger | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). From a719c7cd3f84918bc64669fea2ad8b764eb2c98b Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 17 Mar 2016 16:38:26 -0700 Subject: [PATCH 0016/1801] fixes per comment --- versions/3.0.md | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index c263c3bd72..19cb77cf49 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -110,7 +110,7 @@ Field Name | Type | Description info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself. +schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. @@ -126,7 +126,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OAS Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. #### Info Object @@ -147,7 +147,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Info Object Example: @@ -199,7 +199,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Contact Object Example: @@ -232,7 +232,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### License Object Example: @@ -258,7 +258,7 @@ The Paths may be empty, due to [ACL constraints](#securityFiltering). Field Pattern | Type | Description ---|:---:|--- /{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Paths Object Example @@ -318,13 +318,13 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#oasParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Path Item Object Example @@ -415,11 +415,11 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#oasParameters). There can be one "body" parameter at most. +consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#oasSchemes) definition. +schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. @@ -427,7 +427,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Operation Object Example @@ -542,7 +542,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### External Documentation Object Example @@ -569,7 +569,7 @@ There are five possible parameter types. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. -* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): +* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specifications's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. @@ -614,7 +614,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Parameter Object Examples @@ -794,7 +794,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Items Object Examples @@ -844,13 +844,13 @@ The `Responses Object` MUST contain at least one response code, and it SHOULD be ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#oasResponses) section. +default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#oasResponses) section. -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Responses Object Example @@ -900,7 +900,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Response Object Examples @@ -1098,7 +1098,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Header Object Example @@ -1130,7 +1130,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Tag Object Example @@ -1220,7 +1220,7 @@ The following properties are taken directly from the JSON Schema definition and - enum - type -The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. - items - allOf - properties @@ -1241,13 +1241,13 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ###### Composition and Inheritance (Polymorphism) -Swagger allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. +The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. -While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the `definitions` property. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. +While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the `definitions` property. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. ###### XML Modeling @@ -1257,7 +1257,7 @@ The [xml](#schemaXml) property allows extra definitions when translating the JSO ###### Primitive Sample -Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well. +Unlike previous versions of Swagger, OpenAPI Schema definitions can be used to describe primitive and arrays as well. ```js { @@ -1594,7 +1594,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### XML Object Examples @@ -2150,7 +2150,7 @@ Field Name | Type | Validity | Description Field Name | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Security Scheme Object Example @@ -2219,7 +2219,7 @@ Field Pattern | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Scopes Object Example @@ -2280,7 +2280,7 @@ petstore_auth: ### Specification Extensions -While the Swagger Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. +While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. The extensions properties are always prefixed by `"x-"` and can have any valid JSON format value. @@ -2288,7 +2288,7 @@ The extensions may or may not be supported by the available tooling, but those m ### Security Filtering -Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. +Some objects in the OpenAPI Specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization. From 6badeacda6c6ba7cf740319f3d2b9bd8993efc27 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 17 Mar 2016 18:08:53 -0700 Subject: [PATCH 0017/1801] updated via comments --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 19cb77cf49..81b97ca7a0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -50,7 +50,7 @@ The HTTP Status Codes are used to indicate the status of the executed operation. ### Format -The files describing the RESTful API in accordance with the Open API Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to +The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to represent a OAS (OpenAPI Specification) file. For example, if a field is said to have an array value, the JSON array representation will be used: @@ -71,7 +71,7 @@ The schema exposes two types of fields. Fixed fields, which have a declared name The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the Open API Specification (OAS) file is named `swagger.json`. +By convention, the OpenAPI Specification (OAS) file is named `swagger.json`. ### Data Types @@ -569,7 +569,7 @@ There are five possible parameter types. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. -* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specifications's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): +* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. From 1b5b90cdc9a06db1633fd87c7061ddef261abef2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 18 Mar 2016 12:16:01 -0700 Subject: [PATCH 0018/1801] Fixed link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f73ca88dc..1578c2da18 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ You can see the current process for development inside the OpenAPI Specification The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. The OAI encourages participation from individuals and companies alike. If you wish to participate in the evolution of the OpenAPI Specification, please consider the following: -* Review the [current specification](). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [current specification](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so it's clear how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern along with, if possible, a proposed solution. From 606ecaf1065d855925c41e2c4453c1456c564a30 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 18 Mar 2016 12:24:54 -0700 Subject: [PATCH 0019/1801] added changes to include host, basePath, schemes --- versions/3.0.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 81b97ca7a0..1d6a2d02a9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -318,6 +318,9 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). +basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). +schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. ##### Patterned Fields @@ -422,6 +425,9 @@ Field Name | Type | Description schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) or path item-level [host](#pathItemHost). if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). +basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) or path item-level [basePath](#oasPathItemBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). +schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) or path-item level [schemes](#pathItemSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. ##### Patterned Objects From 5bdeea588c4ac13f180b0c3e1eb7a691d83efa0e Mon Sep 17 00:00:00 2001 From: Eric Henry Correia Date: Wed, 23 Mar 2016 12:40:57 -0400 Subject: [PATCH 0020/1801] Items Object should not be an array of object --- examples/v2.0/json/uber.json | 6 ++---- examples/v2.0/yaml/uber.yaml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/v2.0/json/uber.json b/examples/v2.0/json/uber.json index 5c9a637785..957782897d 100644 --- a/examples/v2.0/json/uber.json +++ b/examples/v2.0/json/uber.json @@ -346,11 +346,9 @@ }, "history": { "type": "array", - "items": [ - { + "items": { "$ref": "#/definitions/Activity" - } - ] + } } } }, diff --git a/examples/v2.0/yaml/uber.yaml b/examples/v2.0/yaml/uber.yaml index 3556cf5e87..12c14b08aa 100644 --- a/examples/v2.0/yaml/uber.yaml +++ b/examples/v2.0/yaml/uber.yaml @@ -261,7 +261,7 @@ definitions: history: type: array items: - - $ref: '#/definitions/Activity' + $ref: '#/definitions/Activity' Error: properties: code: From 19fed9f0f812ccebe0fc45313fea75bb6656de1c Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Thu, 7 Apr 2016 21:47:38 +0300 Subject: [PATCH 0021/1801] Wrap '$ref's to prevent 'definitions' override --- schemas/v2.0/schema.json | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json index e63aef6334..f12a8c0e47 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -40,11 +40,19 @@ }, "consumes": { "description": "A list of MIME types accepted by the API.", - "$ref": "#/definitions/mediaTypeList" + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] }, "produces": { "description": "A list of MIME types the API can produce.", - "$ref": "#/definitions/mediaTypeList" + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] }, "paths": { "$ref": "#/definitions/paths" @@ -263,11 +271,19 @@ }, "produces": { "description": "A list of MIME types the API can produce.", - "$ref": "#/definitions/mediaTypeList" + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] }, "consumes": { "description": "A list of MIME types the API can consume.", - "$ref": "#/definitions/mediaTypeList" + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] }, "parameters": { "$ref": "#/definitions/parametersList" From db997190adbed07a44458c1353749a82cfda3c37 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 05:49:54 -0700 Subject: [PATCH 0022/1801] updated doc for #561 --- versions/3.0.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 81b97ca7a0..7764ca7a81 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -71,7 +71,7 @@ The schema exposes two types of fields. Fixed fields, which have a declared name The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the OpenAPI Specification (OAS) file is named `swagger.json`. +By convention, the OpenAPI Specification (OAS) file is named `oas.json`. ### Data Types @@ -106,7 +106,8 @@ This is the root document object for the API specification. It combines what pre Field Name | Type | Description ---|:---:|--- -swagger | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. +swagger | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling vendors and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +schema | `string` | An optional URL to a formal OAS schema. If present, tooling _may_ choose to use this for validating the document, and the location _must_ be a formally approved OAS schema produced by the OpenAPI working group. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). From f01050af04199b36e3ee4c64bff5d24f581af714 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 05:53:37 -0700 Subject: [PATCH 0023/1801] added description field --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..9d5efe842b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -311,6 +311,7 @@ A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path Field Name | Type | Description ---|:---:|--- $ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +description | An optional, string description, intended to apply to all operations in this path. get | [Operation Object](#operationObject) | A definition of a GET operation on this path. put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. post | [Operation Object](#operationObject) | A definition of a POST operation on this path. From e7e3e9b943101d2b41e77d992ca597b5b58dfe10 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:05:49 -0700 Subject: [PATCH 0024/1801] moved reusable definitions under a single element --- versions/3.0.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..8841fcb5f0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -113,12 +113,14 @@ Field Name | Type | Description schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +responses | [Responses] paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. -definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. +schemas | [Schemas Object](#schemasObject) | An element to hold various schemas for the specification. +~~definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.~~ tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. @@ -248,6 +250,21 @@ name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html ``` +#### Schemas Object + +Holds a set of schemas for different aspects of the OAS. The intention is to put reusable components into a single location, allowing reuse from this and other OAS documents. + +##### Fixed Fields + +Field Pattern | Type | Description + | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. +Responses Definitions Object | Reusable responses objects. + | [Parameters Definitions Object](#parametersDefinitionsObject) | +An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. + | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. +[Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. + + #### Paths Object Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. From dd01d60d645a68526383b9c6e247be867dab3fda Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:10:56 -0700 Subject: [PATCH 0025/1801] added clarification on namespaces, characters in definitions name --- versions/3.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..9a592049a4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1945,7 +1945,11 @@ An object to hold data types that can be consumed and produced by operations. Th Field Pattern | Type | Description ---|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_()[]\/` + +The following characters are illegal in the `definitionsName`: `"'` + +In addition, high-level characters are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. ##### Definitions Object Example From bc59244cf3edfe517c34881c67cc280e116a710d Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:14:53 -0700 Subject: [PATCH 0026/1801] clarification about YAML --- versions/3.0.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..32d8e1f289 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -51,7 +51,12 @@ The HTTP Status Codes are used to indicate the status of the executed operation. ### Format The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a OAS (OpenAPI Specification) file. +represent a OAS (OpenAPI Specification) file. For YAML, version `1.1` is supported for OAS documents. + +As YAML has a superset of features, the following YAML features are NOT supported by the OAS: + +* YAML Merge. Consider using JSON Pointers instead +* Numeric keys. All numeric keys should be quoted For example, if a field is said to have an array value, the JSON array representation will be used: From 6c21f32d46606d90d96259ad3ab2765885c0d892 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:22:01 -0700 Subject: [PATCH 0027/1801] adde examples object --- versions/3.0.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..bd9e584c35 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1152,6 +1152,51 @@ name: pet description: Pets operations ``` +#### Examples Object + +Anywhere an `example` may be given, allow a $ref object. This does mean that `example` can be either a string primitive or an object, like `additionalProperties`: + +```yaml +# in a model +definitions: + properties: + name: + type: string + example: + $ref: http://foo.bar#/examples/name-example.json + +# in a parameter: + parameters: + - name: address + in: body + schema: + $ref: '#/definitions/Address' + examples: + 'application/json': + $ref: http://foo.bar#/examples/address-example.json + 'application/xml': + $ref: http://foo.bar#/examples/address-example.xml + 'text/plain': + $ref: http://foo.bar#/examples/address-example.txt + default: + $ref: http://foo.bar#/examples/address-example.whatever + - name: zip + in: query + type: string + format: zip + example: + $ref: http://foo.bar#/examples/zip-example +# in a response: + responses: + 200: + description: your car appointment has been booked + schema: + $ref: '#/definitions/SuccessResponse' + examples: + 'application/json': + $ref: http://foo.bar#/examples/address-example.json +``` + #### Reference Object A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. From d2d4fd7e169b2b30b2da13019ce36059b4402b72 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:26:14 -0700 Subject: [PATCH 0028/1801] added deprecated fields --- versions/3.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..58b78b531a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -586,6 +586,7 @@ Field Name | Type | Description in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "body". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. + deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. If [`in`](#parameterIn) is `"body"`: @@ -1242,6 +1243,7 @@ Field Name | Type | Description xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include a an example of an instance for this schema. + deprecated | `boolean` | Specifies that a schema is deprecated and should be transitioned out of usage. ##### Patterned Objects From 1b16d9a6e4b82e4af73d9a321cbce1c06ceb1b01 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 8 Apr 2016 06:28:18 -0700 Subject: [PATCH 0029/1801] added regex, quoting --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..24338d44bf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -855,7 +855,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain a regular expression for pattern matching, such as `'^2[\d]{2}'`. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. From af758160fc94fe90eac96789c7cfbeb35c7d4311 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 13:25:12 -0700 Subject: [PATCH 0030/1801] added summary --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9d5efe842b..bb8629d6d2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -311,6 +311,7 @@ A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path Field Name | Type | Description ---|:---:|--- $ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +summary | An optional, string summary, intended to apply to all operations in this path. description | An optional, string description, intended to apply to all operations in this path. get | [Operation Object](#operationObject) | A definition of a GET operation on this path. put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. From 7f1c22984a83605c6f365573c92c6aaae34d6962 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 13:31:13 -0700 Subject: [PATCH 0031/1801] clarified allowable names, removed disallowed names --- versions/3.0.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9a592049a4..5f9a8ff10f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1945,11 +1945,7 @@ An object to hold data types that can be consumed and produced by operations. Th Field Pattern | Type | Description ---|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_()[]\/` - -The following characters are illegal in the `definitionsName`: `"'` - -In addition, high-level characters are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_()[]\`. All other characters, including high-level characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. ##### Definitions Object Example From 6bb80f81366f9d94b3cba662843943747e815def Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 13:55:36 -0700 Subject: [PATCH 0032/1801] clarifications --- versions/3.0.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bd9e584c35..6eb185443b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1154,7 +1154,11 @@ description: Pets operations #### Examples Object -Anywhere an `example` may be given, allow a $ref object. This does mean that `example` can be either a string primitive or an object, like `additionalProperties`: +Anywhere an `example` may be given, allow a $ref object. This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`. + +In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. + +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1163,9 +1167,9 @@ definitions: name: type: string example: - $ref: http://foo.bar#/examples/name-example.json + $ref: http://foo.bar#/examples/name-example -# in a parameter: +# in a parameter, note the plural `examples` as the content-type is set by `consumes`: parameters: - name: address in: body @@ -1173,25 +1177,25 @@ definitions: $ref: '#/definitions/Address' examples: 'application/json': - $ref: http://foo.bar#/examples/address-example.json + $ref: 'http://foo.bar#/examples/address-example.json' 'application/xml': - $ref: http://foo.bar#/examples/address-example.xml + $ref: 'http://foo.bar#/examples/address-example.xml' 'text/plain': - $ref: http://foo.bar#/examples/address-example.txt + $ref: 'http://foo.bar#/examples/address-example.txt' default: - $ref: http://foo.bar#/examples/address-example.whatever - - name: zip - in: query - type: string - format: zip + $ref: 'http://foo.bar#/examples/address-example.whatever' + - name: 'zip' + in: 'query' + type: 'string' + format: 'zip' example: - $ref: http://foo.bar#/examples/zip-example -# in a response: + $ref: 'http://foo.bar#/examples/zip-example' +# in a response, note the plural `examples`: responses: 200: description: your car appointment has been booked - schema: - $ref: '#/definitions/SuccessResponse' + schema: + $ref: '#/definitions/SuccessResponse' examples: 'application/json': $ref: http://foo.bar#/examples/address-example.json From 89169865b0573abfb08a3a682e56c6c120c6ea6a Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 14:03:28 -0700 Subject: [PATCH 0033/1801] removed regex --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 24338d44bf..099de6aeef 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -855,7 +855,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain a regular expression for pattern matching, such as `'^2[\d]{2}'`. +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. From 7603a898eb6e3c8079d73ceee574d6193a634e8b Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 14:09:04 -0700 Subject: [PATCH 0034/1801] renamed keys, removed schema --- versions/3.0.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7764ca7a81..c4c304fa5d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -71,7 +71,7 @@ The schema exposes two types of fields. Fixed fields, which have a declared name The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the OpenAPI Specification (OAS) file is named `oas.json`. +By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or `openapi.yaml`. ### Data Types @@ -106,8 +106,7 @@ This is the root document object for the API specification. It combines what pre Field Name | Type | Description ---|:---:|--- -swagger | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling vendors and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. -schema | `string` | An optional URL to a formal OAS schema. If present, tooling _may_ choose to use this for validating the document, and the location _must_ be a formally approved OAS schema produced by the OpenAPI working group. +openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling vendors and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). From 239f25ba29326e0b9ee86b623b5f82774f61e1df Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 11 Apr 2016 14:35:52 -0700 Subject: [PATCH 0035/1801] added host section --- versions/3.0.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d6a2d02a9..d1215d0d2d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -108,9 +108,7 @@ Field Name | Type | Description ---|:---:|--- swagger | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). -basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. +hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. @@ -183,6 +181,18 @@ license: version: 1.0.1 ``` +#### Host Object + +An object representing a Host. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). +basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). +scheme | `string` | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `scheme` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. + #### Contact Object Contact information for the exposed API. From 649d177a79835a4dadbfea3af2026dfdb193cd79 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 13 Apr 2016 22:10:26 -0700 Subject: [PATCH 0036/1801] added examples, removed characters --- versions/3.0.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5f9a8ff10f..fa9a0d7749 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1945,7 +1945,18 @@ An object to hold data types that can be consumed and produced by operations. Th Field Pattern | Type | Description ---|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_()[]\`. All other characters, including high-level characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. + +Examples: + +``` +User +User_1 +User_Name +user-name +my.org.User +my\org\User +``` ##### Definitions Object Example From a3b079762d49a82f650ad74c011c63d67cb4b32e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 14 Apr 2016 23:19:37 -0700 Subject: [PATCH 0037/1801] added schema for all parameters --- versions/3.0.md | 84 +++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dd44977584..ff141004a5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -591,6 +591,8 @@ There are five possible parameter types. * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. +For complex parameter schemas, a serialization strategy is required. For parameter of type `in: body`, the serialization will be handled by the `consumes` attribute. For all other types, a serialization strategy must be declared. + ##### Fixed Fields Field Name | Type | Description ---|:---:|--- @@ -599,35 +601,7 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. - -If [`in`](#parameterIn) is `"body"`: - -Field Name | Type | Description ----|:---:|--- -schema | [Schema Object](#schemaObject) | **Required.** The schema defining the type used for the body parameter. - -If [`in`](#parameterIn) is any value other than `"body"`: - -Field Name | Type | Description ----|:---:|--- -type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. If `type` is `"file"`, the [`consumes`](#operationConsumes) MUST be either `"multipart/form-data"`, `" application/x-www-form-urlencoded"` or both and the parameter MUST be [`in`](#parameterIn) `"formData"`. -format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. -items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. -collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
  • `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`. -default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. ##### Patterned Fields @@ -699,10 +673,12 @@ A header parameter with an array of 64 bit integer numbers: "in": "header", "description": "token to be passed as a header", "required": true, - "type": "array", - "items": { - "type": "integer", - "format": "int64" + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } }, "collectionFormat": "csv" } @@ -713,11 +689,12 @@ name: token in: header description: token to be passed as a header required: true -type: array -items: - type: integer - format: int64 -collectionFormat: csv +schema: + type: array + items: + type: integer + format: int64 + collectionFormat: csv ``` A path parameter of a string value: @@ -727,7 +704,9 @@ A path parameter of a string value: "in": "path", "description": "username to fetch", "required": true, - "type": "string" + "schema": { + "type": "string" + } } ``` @@ -736,7 +715,8 @@ name: username in: path description: username to fetch required: true -type: string +schema: + type: string ``` An optional query parameter of a string value, allowing multiple values by repeating the query parameter: @@ -746,9 +726,11 @@ An optional query parameter of a string value, allowing multiple values by repea "in": "query", "description": "ID of the object to fetch", "required": false, - "type": "array", - "items": { - "type": "string" + "schema": { + "type": "array", + "items": { + "type": "string" + } }, "collectionFormat": "multi" } @@ -759,10 +741,11 @@ name: id in: query description: ID of the object to fetch required: false -type: array -items: - type: string -collectionFormat: multi +schema: + type: array + items: + type: string + collectionFormat: multi ``` A form data with file type for a file upload: @@ -772,7 +755,9 @@ A form data with file type for a file upload: "in": "formData", "description": "The avatar of the user", "required": true, - "type": "file" + "schema": { + "type": "file" + } } ``` @@ -781,7 +766,8 @@ name: avatar in: formData description: The avatar of the user required: true -type: file +schema: + type: file ``` #### Items Object From ef3dc37e54b6de0439ad17591b5482b09faaf459 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 14 Apr 2016 23:41:24 -0700 Subject: [PATCH 0038/1801] added cookie parameter --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dd44977584..9fe33bfc80 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -582,7 +582,7 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are five possible parameter types. +There are six possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. @@ -590,12 +590,12 @@ There are five possible parameter types. * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. - +* Cookie - Used to pass a specific cookie value to the API. Cookies are passed specifically through the `Set-Cookie: {name}={value}` syntax. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "body". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData", "body", or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. From 4afb37ae38f41ca8695200dcde0b6c756d5ca2d5 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Fri, 15 Apr 2016 10:48:05 +0200 Subject: [PATCH 0039/1801] Specification Extension instead of Vendor Extension #643 --- versions/3.0.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dd44977584..3f97017457 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -106,7 +106,7 @@ This is the root document object for the API specification. It combines what pre Field Name | Type | Description ---|:---:|--- -openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling vendors and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). @@ -124,7 +124,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OAS Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OAS Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. #### Info Object @@ -145,7 +145,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Info Object Example: @@ -209,7 +209,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Contact Object Example: @@ -242,7 +242,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### License Object Example: @@ -268,7 +268,7 @@ The Paths may be empty, due to [ACL constraints](#securityFiltering). Field Pattern | Type | Description ---|:---:|--- /{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Paths Object Example @@ -339,7 +339,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Path Item Object Example @@ -445,7 +445,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Operation Object Example @@ -560,7 +560,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### External Documentation Object Example @@ -633,7 +633,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Parameter Object Examples @@ -813,7 +813,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Items Object Examples @@ -869,7 +869,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- {[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Responses Object Example @@ -919,7 +919,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Response Object Examples @@ -1117,7 +1117,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Header Object Example @@ -1149,7 +1149,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Tag Object Example @@ -1171,7 +1171,7 @@ Anywhere an `example` may be given, allow a $ref object. This does mean that `e In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling Specifications may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1310,7 +1310,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ###### Composition and Inheritance (Polymorphism) @@ -1663,7 +1663,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### XML Object Examples @@ -2008,7 +2008,7 @@ An object to hold data types that can be consumed and produced by operations. Th Field Pattern | Type | Description ---|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling vendor's job to ensure that the namespace is honored. +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. Examples: @@ -2230,7 +2230,7 @@ Field Name | Type | Validity | Description Field Name | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Security Scheme Object Example @@ -2299,7 +2299,7 @@ Field Pattern | Type | Description Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Scopes Object Example @@ -2358,7 +2358,7 @@ petstore_auth: - read:pets ``` -### Specification Extensions +### Specification Extensions While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. From e9eb3e539951c17da55b9f5da02e239b55dfd833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 19 Apr 2016 19:50:36 +0200 Subject: [PATCH 0040/1801] Make clear that info/termsOfService should be an URL. As discussed in previous pull request #255, current tooling already interprets it like that. This pull request just redoes the same change to the 3.0 version instead of the 2.0 one (where they were not applied). Original change by Matti Schneider , 2015-01-29 10:51:26. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index dd44977584..f3e885e610 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -136,7 +136,7 @@ Field Name | Type | Description ---|:---:|--- title | `string` | **Required.** The title of the application. description | `string` | A short description of the application. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. -termsOfService | `string` | The Terms of Service for the API. +termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). From fe4f5e20ba939f18ee47135c852d15ea21106b70 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 19 Apr 2016 23:37:35 -0700 Subject: [PATCH 0041/1801] removed `Set-Cookie`, not needed for the spec --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9fe33bfc80..0795b29140 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -590,7 +590,7 @@ There are six possible parameter types. * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. -* Cookie - Used to pass a specific cookie value to the API. Cookies are passed specifically through the `Set-Cookie: {name}={value}` syntax. +* Cookie - Used to pass a specific cookie value to the API. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- From ed4f8ad73d8b6960b58d608e77eebecc5351658e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 19 Apr 2016 23:48:33 -0700 Subject: [PATCH 0042/1801] updated from schemas to components --- versions/3.0.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8841fcb5f0..67d460c443 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -115,12 +115,8 @@ Field Name | Type | Description produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). responses | [Responses] paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. -schemas | [Schemas Object](#schemasObject) | An element to hold various schemas for the specification. -~~definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. -parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. -responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. -securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.~~ +components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. @@ -250,7 +246,7 @@ name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html ``` -#### Schemas Object +#### Components Object Holds a set of schemas for different aspects of the OAS. The intention is to put reusable components into a single location, allowing reuse from this and other OAS documents. From 6c1415fd3bea6b6e6d8fc30bf6203f627d664a0f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 19 Apr 2016 23:53:47 -0700 Subject: [PATCH 0043/1801] updated from schemas to components --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 67d460c443..44a4ad3eb4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -255,8 +255,7 @@ Holds a set of schemas for different aspects of the OAS. The intention is to pu Field Pattern | Type | Description | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. Responses Definitions Object | Reusable responses objects. - | [Parameters Definitions Object](#parametersDefinitionsObject) | -An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. + | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. From 2047542bcd069f49a54ef8eda1d8b5373034941d Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 19 Apr 2016 23:54:42 -0700 Subject: [PATCH 0044/1801] updated from schemas to components --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 44a4ad3eb4..6b710ec2e4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -254,10 +254,10 @@ Holds a set of schemas for different aspects of the OAS. The intention is to pu Field Pattern | Type | Description | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. -Responses Definitions Object | Reusable responses objects. + | Responses Definitions Object | Reusable responses objects. | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. -[Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. + | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. #### Paths Object From e1c51086108af295cb9d58cbb9f9734db2eb4eb2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 19 Apr 2016 23:56:08 -0700 Subject: [PATCH 0045/1801] updated from schemas to components --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 6b710ec2e4..c0fe16d045 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -253,6 +253,7 @@ Holds a set of schemas for different aspects of the OAS. The intention is to pu ##### Fixed Fields Field Pattern | Type | Description +---|:---:|--- | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. | Responses Definitions Object | Reusable responses objects. | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. From 4bb62f8e6933e3697b660ef5758a9b0082d66807 Mon Sep 17 00:00:00 2001 From: Jason Harmon Date: Sun, 24 Apr 2016 21:31:14 -0500 Subject: [PATCH 0046/1801] Request bodies moved out of parameters --- versions/3.0.md | 164 ++++++++++++++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 67 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 622df7cd33..20475c0cb4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -346,7 +346,8 @@ Field Name | Type | Description host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for all the operations described under this path. This request body can be overriden at the operation level, but cannot be removed there. ##### Patterned Fields @@ -445,7 +446,8 @@ Field Name | Type | Description operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +body | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. If a request body is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -595,11 +597,10 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are six possible parameter types. +There are five possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. -* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. @@ -607,13 +608,13 @@ There are six possible parameter types. * Cookie - Used to pass a specific cookie value to the API. -For complex parameter schemas, a serialization strategy is required. For parameter of type `in: body`, the serialization will be handled by the `consumes` attribute. For all other types, a serialization strategy must be declared. +For complex parameter schemas, a serialization strategy is required. For all types, a serialization strategy must be declared. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData", "body", or "cookie". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. @@ -628,59 +629,6 @@ Field Pattern | Type | Description ##### Parameter Object Examples -###### Body Parameters - -A body parameter with a referenced schema definition (normally for a model definition): -```js -{ - "name": "user", - "in": "body", - "description": "user to add to the system", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } -} -``` - -```yaml -name: user -in: body -description: user to add to the system -required: true -schema: - $ref: '#/definitions/User' -``` - -A body parameter that is an array of string values: -```js -{ - "name": "user", - "in": "body", - "description": "user to add to the system", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } -} -``` - -```yaml -name: user -in: body -description: user to add to the system -required: true -schema: - type: array - items: - type: string -``` - -###### Other Parameters - A header parameter with an array of 64 bit integer numbers: ```js @@ -786,9 +734,89 @@ schema: type: file ``` +#### Request Body Object + +Describes a single request body. + +If the `requestBody` attribute is not present, or `schema` is not defined, the request body is not required. + +The serialization of the request body should be specified by the `consumes` attribute. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type. + + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + + +##### Request Body Examples + +A request body with a referenced model definition. +```js +{ + "description": "user to add to the system", + "schema": { + "$ref": "#/definitions/User" + }, + "examples": { + "application/json": { + "$ref": 'http://foo.bar#/examples/address-example.json' + 'application/xml': + $ref: 'http://foo.bar#/examples/address-example.xml' + 'text/plain': + $ref: 'http://foo.bar#/examples/address-example.txt' + default: + $ref: 'http://foo.bar#/examples/address-example.whatever' +} +``` + +```yaml +description: user to add to the system +schema: + $ref: '#/definitions/User' +examples: + 'application/json': + $ref: 'http://foo.bar/examples/user-example.json' + 'application/xml': + $ref: 'http://foo.bar/examples/user-example.xml' + 'text/plain': + $ref: 'http://foo.bar/examples/user-example.txt' + default: + $ref: 'http://foo.bar/examples/user-example.whatever' +``` + +A body parameter that is an array of string values: +```js +{ + "description": "user to add to the system", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +description: user to add to the system +required: true +schema: + type: array + items: + type: string +``` + #### Items Object -A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`. +A limited subset of JSON-Schema's items object. It is used by parameter definitions. ##### Fixed Fields Field Name | Type | Description @@ -1060,7 +1088,7 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation responses. +Allows sharing examples for operation requests and responses. ##### Patterned Fields Field Pattern | Type | Description @@ -1069,7 +1097,7 @@ Field Pattern | Type | Description ##### Example Object Example -Example response for application/json mimetype of a Pet data type: +Example request or response for application/json mimetype of a Pet data type: ```js { @@ -1173,7 +1201,7 @@ Anywhere an `example` may be given, allow a $ref object. This does mean that `e In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1184,10 +1212,8 @@ definitions: example: $ref: http://foo.bar#/examples/name-example -# in a parameter, note the plural `examples` as the content-type is set by `consumes`: - parameters: - - name: address - in: body +# in a request body, note the plural `examples` as the content-type is set by `consumes`: + requestBody: schema: $ref: '#/definitions/Address' examples: @@ -1199,6 +1225,10 @@ definitions: $ref: 'http://foo.bar#/examples/address-example.txt' default: $ref: 'http://foo.bar#/examples/address-example.whatever' + +# in a parameter + + parameters: - name: 'zip' in: 'query' type: 'string' From 7d62b8eeb129eb293fff08856e62700e5fa31e58 Mon Sep 17 00:00:00 2001 From: Jason Harmon Date: Sun, 24 Apr 2016 22:18:39 -0500 Subject: [PATCH 0047/1801] Revert "Request bodies moved out of parameters" This reverts commit 4bb62f8e6933e3697b660ef5758a9b0082d66807. --- versions/3.0.md | 164 ++++++++++++++++++++---------------------------- 1 file changed, 67 insertions(+), 97 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 20475c0cb4..622df7cd33 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -346,8 +346,7 @@ Field Name | Type | Description host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for all the operations described under this path. This request body can be overriden at the operation level, but cannot be removed there. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. ##### Patterned Fields @@ -446,8 +445,7 @@ Field Name | Type | Description operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -body | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. If a request body is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -597,10 +595,11 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are five possible parameter types. +There are six possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. +* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. @@ -608,13 +607,13 @@ There are five possible parameter types. * Cookie - Used to pass a specific cookie value to the API. -For complex parameter schemas, a serialization strategy is required. For all types, a serialization strategy must be declared. +For complex parameter schemas, a serialization strategy is required. For parameter of type `in: body`, the serialization will be handled by the `consumes` attribute. For all other types, a serialization strategy must be declared. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData", "body", or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. @@ -629,6 +628,59 @@ Field Pattern | Type | Description ##### Parameter Object Examples +###### Body Parameters + +A body parameter with a referenced schema definition (normally for a model definition): +```js +{ + "name": "user", + "in": "body", + "description": "user to add to the system", + "required": true, + "schema": { + "$ref": "#/definitions/User" + } +} +``` + +```yaml +name: user +in: body +description: user to add to the system +required: true +schema: + $ref: '#/definitions/User' +``` + +A body parameter that is an array of string values: +```js +{ + "name": "user", + "in": "body", + "description": "user to add to the system", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +name: user +in: body +description: user to add to the system +required: true +schema: + type: array + items: + type: string +``` + +###### Other Parameters + A header parameter with an array of 64 bit integer numbers: ```js @@ -734,89 +786,9 @@ schema: type: file ``` -#### Request Body Object - -Describes a single request body. - -If the `requestBody` attribute is not present, or `schema` is not defined, the request body is not required. - -The serialization of the request body should be specified by the `consumes` attribute. - -##### Fixed Fields -Field Name | Type | Description ----|:---:|--- -description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type. - - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. - - -##### Request Body Examples - -A request body with a referenced model definition. -```js -{ - "description": "user to add to the system", - "schema": { - "$ref": "#/definitions/User" - }, - "examples": { - "application/json": { - "$ref": 'http://foo.bar#/examples/address-example.json' - 'application/xml': - $ref: 'http://foo.bar#/examples/address-example.xml' - 'text/plain': - $ref: 'http://foo.bar#/examples/address-example.txt' - default: - $ref: 'http://foo.bar#/examples/address-example.whatever' -} -``` - -```yaml -description: user to add to the system -schema: - $ref: '#/definitions/User' -examples: - 'application/json': - $ref: 'http://foo.bar/examples/user-example.json' - 'application/xml': - $ref: 'http://foo.bar/examples/user-example.xml' - 'text/plain': - $ref: 'http://foo.bar/examples/user-example.txt' - default: - $ref: 'http://foo.bar/examples/user-example.whatever' -``` - -A body parameter that is an array of string values: -```js -{ - "description": "user to add to the system", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } -} -``` - -```yaml -description: user to add to the system -required: true -schema: - type: array - items: - type: string -``` - #### Items Object -A limited subset of JSON-Schema's items object. It is used by parameter definitions. +A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`. ##### Fixed Fields Field Name | Type | Description @@ -1088,7 +1060,7 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation requests and responses. +Allows sharing examples for operation responses. ##### Patterned Fields Field Pattern | Type | Description @@ -1097,7 +1069,7 @@ Field Pattern | Type | Description ##### Example Object Example -Example request or response for application/json mimetype of a Pet data type: +Example response for application/json mimetype of a Pet data type: ```js { @@ -1201,7 +1173,7 @@ Anywhere an `example` may be given, allow a $ref object. This does mean that `e In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1212,8 +1184,10 @@ definitions: example: $ref: http://foo.bar#/examples/name-example -# in a request body, note the plural `examples` as the content-type is set by `consumes`: - requestBody: +# in a parameter, note the plural `examples` as the content-type is set by `consumes`: + parameters: + - name: address + in: body schema: $ref: '#/definitions/Address' examples: @@ -1225,10 +1199,6 @@ definitions: $ref: 'http://foo.bar#/examples/address-example.txt' default: $ref: 'http://foo.bar#/examples/address-example.whatever' - -# in a parameter - - parameters: - name: 'zip' in: 'query' type: 'string' From b521d6cfe520339bb30795cad63a4d3f47c0beb2 Mon Sep 17 00:00:00 2001 From: Jason Harmon Date: Sun, 24 Apr 2016 22:30:28 -0500 Subject: [PATCH 0048/1801] Request bodies moved out of parameters --- versions/3.0.md | 164 ++++++++++++++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 67 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 622df7cd33..20475c0cb4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -346,7 +346,8 @@ Field Name | Type | Description host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for all the operations described under this path. This request body can be overriden at the operation level, but cannot be removed there. ##### Patterned Fields @@ -445,7 +446,8 @@ Field Name | Type | Description operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +body | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. If a request body is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -595,11 +597,10 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are six possible parameter types. +There are five possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. -* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. @@ -607,13 +608,13 @@ There are six possible parameter types. * Cookie - Used to pass a specific cookie value to the API. -For complex parameter schemas, a serialization strategy is required. For parameter of type `in: body`, the serialization will be handled by the `consumes` attribute. For all other types, a serialization strategy must be declared. +For complex parameter schemas, a serialization strategy is required. For all types, a serialization strategy must be declared. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData", "body", or "cookie". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. @@ -628,59 +629,6 @@ Field Pattern | Type | Description ##### Parameter Object Examples -###### Body Parameters - -A body parameter with a referenced schema definition (normally for a model definition): -```js -{ - "name": "user", - "in": "body", - "description": "user to add to the system", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } -} -``` - -```yaml -name: user -in: body -description: user to add to the system -required: true -schema: - $ref: '#/definitions/User' -``` - -A body parameter that is an array of string values: -```js -{ - "name": "user", - "in": "body", - "description": "user to add to the system", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } -} -``` - -```yaml -name: user -in: body -description: user to add to the system -required: true -schema: - type: array - items: - type: string -``` - -###### Other Parameters - A header parameter with an array of 64 bit integer numbers: ```js @@ -786,9 +734,89 @@ schema: type: file ``` +#### Request Body Object + +Describes a single request body. + +If the `requestBody` attribute is not present, or `schema` is not defined, the request body is not required. + +The serialization of the request body should be specified by the `consumes` attribute. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type. + + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + + +##### Request Body Examples + +A request body with a referenced model definition. +```js +{ + "description": "user to add to the system", + "schema": { + "$ref": "#/definitions/User" + }, + "examples": { + "application/json": { + "$ref": 'http://foo.bar#/examples/address-example.json' + 'application/xml': + $ref: 'http://foo.bar#/examples/address-example.xml' + 'text/plain': + $ref: 'http://foo.bar#/examples/address-example.txt' + default: + $ref: 'http://foo.bar#/examples/address-example.whatever' +} +``` + +```yaml +description: user to add to the system +schema: + $ref: '#/definitions/User' +examples: + 'application/json': + $ref: 'http://foo.bar/examples/user-example.json' + 'application/xml': + $ref: 'http://foo.bar/examples/user-example.xml' + 'text/plain': + $ref: 'http://foo.bar/examples/user-example.txt' + default: + $ref: 'http://foo.bar/examples/user-example.whatever' +``` + +A body parameter that is an array of string values: +```js +{ + "description": "user to add to the system", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +description: user to add to the system +required: true +schema: + type: array + items: + type: string +``` + #### Items Object -A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`. +A limited subset of JSON-Schema's items object. It is used by parameter definitions. ##### Fixed Fields Field Name | Type | Description @@ -1060,7 +1088,7 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation responses. +Allows sharing examples for operation requests and responses. ##### Patterned Fields Field Pattern | Type | Description @@ -1069,7 +1097,7 @@ Field Pattern | Type | Description ##### Example Object Example -Example response for application/json mimetype of a Pet data type: +Example request or response for application/json mimetype of a Pet data type: ```js { @@ -1173,7 +1201,7 @@ Anywhere an `example` may be given, allow a $ref object. This does mean that `e In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1184,10 +1212,8 @@ definitions: example: $ref: http://foo.bar#/examples/name-example -# in a parameter, note the plural `examples` as the content-type is set by `consumes`: - parameters: - - name: address - in: body +# in a request body, note the plural `examples` as the content-type is set by `consumes`: + requestBody: schema: $ref: '#/definitions/Address' examples: @@ -1199,6 +1225,10 @@ definitions: $ref: 'http://foo.bar#/examples/address-example.txt' default: $ref: 'http://foo.bar#/examples/address-example.whatever' + +# in a parameter + + parameters: - name: 'zip' in: 'query' type: 'string' From f5b4941ca9c18afc20128f6b69ea2071a7b27e82 Mon Sep 17 00:00:00 2001 From: Jason Harmon Date: Fri, 6 May 2016 10:34:28 -0500 Subject: [PATCH 0049/1801] Removed path-level body, added required flag for body, other typos and refinements --- versions/3.0.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 20475c0cb4..ecd1f9d441 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -347,7 +347,6 @@ Field Name | Type | Description basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for all the operations described under this path. This request body can be overriden at the operation level, but cannot be removed there. ##### Patterned Fields @@ -447,7 +446,7 @@ Field Name | Type | Description consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -body | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. If a request body is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -738,9 +737,7 @@ schema: Describes a single request body. -If the `requestBody` attribute is not present, or `schema` is not defined, the request body is not required. - -The serialization of the request body should be specified by the `consumes` attribute. +The `Content-Type` of the request body must be specified by the `consumes` attribute, either at the [top-level](#oasConsumes) or [operation level](#operationConsumes). ##### Fixed Fields Field Name | Type | Description @@ -748,6 +745,7 @@ Field Name | Type | Description description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type. +required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. ##### Patterned Fields From 6c51739db1bae7d1cadc3dbd7f6e2d4f430442b6 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 20 May 2016 07:38:56 -0700 Subject: [PATCH 0050/1801] Updated URLs to the OAI repo --- schemas/v1.2/apiDeclaration.json | 2 +- schemas/v1.2/authorizationObject.json | 2 +- schemas/v1.2/dataType.json | 2 +- schemas/v1.2/dataTypeBase.json | 2 +- schemas/v1.2/infoObject.json | 2 +- schemas/v1.2/modelsObject.json | 2 +- schemas/v1.2/oauth2GrantType.json | 2 +- schemas/v1.2/operationObject.json | 2 +- schemas/v1.2/parameterObject.json | 2 +- schemas/v1.2/resourceListing.json | 2 +- schemas/v1.2/resourceObject.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/schemas/v1.2/apiDeclaration.json b/schemas/v1.2/apiDeclaration.json index 79fb714947..4823b2069a 100644 --- a/schemas/v1.2/apiDeclaration.json +++ b/schemas/v1.2/apiDeclaration.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/apiDeclaration.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/apiDeclaration.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "swaggerVersion", "basePath", "apis" ], diff --git a/schemas/v1.2/authorizationObject.json b/schemas/v1.2/authorizationObject.json index 5a82d9a449..82649701df 100644 --- a/schemas/v1.2/authorizationObject.json +++ b/schemas/v1.2/authorizationObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/authorizationObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/authorizationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": { diff --git a/schemas/v1.2/dataType.json b/schemas/v1.2/dataType.json index a438a968d8..3e58c3b874 100644 --- a/schemas/v1.2/dataType.json +++ b/schemas/v1.2/dataType.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/dataType.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/dataType.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "Data type as described by the specification (version 1.2)", "type": "object", diff --git a/schemas/v1.2/dataTypeBase.json b/schemas/v1.2/dataTypeBase.json index dd8e09fd8d..8320d6c23e 100644 --- a/schemas/v1.2/dataTypeBase.json +++ b/schemas/v1.2/dataTypeBase.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/dataTypeBase.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/dataTypeBase.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "Data type fields (section 4.3.3)", "type": "object", diff --git a/schemas/v1.2/infoObject.json b/schemas/v1.2/infoObject.json index d9a3208221..f8819fe905 100644 --- a/schemas/v1.2/infoObject.json +++ b/schemas/v1.2/infoObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/infoObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/infoObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "info object (section 5.1.3)", "type": "object", diff --git a/schemas/v1.2/modelsObject.json b/schemas/v1.2/modelsObject.json index 2e9dee1db2..f591b39083 100644 --- a/schemas/v1.2/modelsObject.json +++ b/schemas/v1.2/modelsObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/modelsObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/modelsObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "id", "properties" ], diff --git a/schemas/v1.2/oauth2GrantType.json b/schemas/v1.2/oauth2GrantType.json index 00713e163a..c9bac6ca55 100644 --- a/schemas/v1.2/oauth2GrantType.json +++ b/schemas/v1.2/oauth2GrantType.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/oauth2GrantType.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/oauth2GrantType.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "minProperties": 1, diff --git a/schemas/v1.2/operationObject.json b/schemas/v1.2/operationObject.json index 2558d3feae..371a6cc82c 100644 --- a/schemas/v1.2/operationObject.json +++ b/schemas/v1.2/operationObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/operationObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/operationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "allOf": [ diff --git a/schemas/v1.2/parameterObject.json b/schemas/v1.2/parameterObject.json index 2c03744537..d762effe04 100644 --- a/schemas/v1.2/parameterObject.json +++ b/schemas/v1.2/parameterObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/parameterObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/parameterObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "allOf": [ diff --git a/schemas/v1.2/resourceListing.json b/schemas/v1.2/resourceListing.json index 3f2da1a180..b5dd17d6d8 100644 --- a/schemas/v1.2/resourceListing.json +++ b/schemas/v1.2/resourceListing.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/resourceListing.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/resourceListing.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "swaggerVersion", "apis" ], diff --git a/schemas/v1.2/resourceObject.json b/schemas/v1.2/resourceObject.json index 1f9a6a0b26..a88e83f562 100644 --- a/schemas/v1.2/resourceObject.json +++ b/schemas/v1.2/resourceObject.json @@ -1,5 +1,5 @@ { - "id": "https://raw.githubusercontent.com/swagger-api/swagger-spec/master/schemas/v1.2/resourceObject.json#", + "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/resourceObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "path" ], From 5e74e77763b2a65edc34a138b0f3baed6220e71f Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 23 May 2016 10:29:56 -0400 Subject: [PATCH 0051/1801] Updated YAML constraints --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 32d8e1f289..69f0197bcf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -51,12 +51,7 @@ The HTTP Status Codes are used to indicate the status of the executed operation. ### Format The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a OAS (OpenAPI Specification) file. For YAML, version `1.1` is supported for OAS documents. - -As YAML has a superset of features, the following YAML features are NOT supported by the OAS: - -* YAML Merge. Consider using JSON Pointers instead -* Numeric keys. All numeric keys should be quoted +represent a OAS (OpenAPI Specification) file. For example, if a field is said to have an array value, the JSON array representation will be used: @@ -72,6 +67,11 @@ All field names in the specification are **case sensitive**. The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name. +In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: + +- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) +- Keys used in YAML maps MUST be limited to scalars defined by the JSON schema ruleset + ### File Structure The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. From 3720cb42dd4cc4663979fcdbf3826bd5d7adea89 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 23 May 2016 12:48:02 -0400 Subject: [PATCH 0052/1801] Limited YAML map keys to strings --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 69f0197bcf..e089d1ecde 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -70,7 +70,7 @@ The schema exposes two types of fields. Fixed fields, which have a declared name In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) -- Keys used in YAML maps MUST be limited to scalars defined by the JSON schema ruleset +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the YAML Failsafe schema ruleset ### File Structure From 30c10c6268be84f46263f5773a90c14cb89efe96 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 9 Jun 2016 08:58:27 -0700 Subject: [PATCH 0053/1801] added links proposal --- versions/3.0.md | 342 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 341 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 541be2fc77..2cff6590d4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -938,7 +938,7 @@ default: ``` #### Response Object -Describes a single response from an API Operation. +Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. ##### Fixed Fields Field Name | Type | Description @@ -947,6 +947,8 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. examples | [Example Object](#exampleObject) | An example of the response message. +links | [Links Object](#linksObject) | An object representing operations related to the response payload. + ##### Patterned Objects @@ -1123,6 +1125,344 @@ application/json: breed: Mixed ``` +#### Links Object +The links object represents a set of possible design-time links for a response. The presence of a link does not guarantee the caller's ability to successfully call invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. + +As opposed to _dynamic_ links--that is, links provided **in** the response payload, the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. + +For computing links, and providing instructions to execute them, a mechanism is defined for accessing values in a response and using them as variables while invoking the linked operation. + +Field Name | Type | Description +---|:---:|--- +$ref | `string` | If present, a reference to another Links Object. Note, the presence of `$ref` in the Links Object will cause all _Patterned Objects_ to be ignored. + +Field Pattern | Type | Description +---|:---:|--- +link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the definitions name. The link shall reference a single Link Object, or a JSON Reference to a single link object + + +### Link Object +The `Link Object` is responsible for defining a possible operation based on a single response. + +Field Name | Type | Description + --- | :---: | --- +href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. + operationId| string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. +parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. +description | string | a description of the link, supports GFM. + +#### Response Payload Values + +Payload values are only available in parseable response payloads which match the advertised media-type. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. + +### Example + +Response payload: +```json +{ + "id": "df71a505-07bc-458a-a5c0-73c0340d1ec7", + "firstname": "Ash", + "lastname": "Williams" +} +``` + +Payload Variables: +```yaml +id: df71a505-07bc-458a-a5c0-73c0340d1ec7 +firstname: Ash +lastname: Williams +missingValue: null +``` + +In situations where variables appear in an array, an array of variables will be extracted. For example: + +```json +[ + { "color": "red" }, + { "color": "green" }, + { "color": "blue" } +] +``` + +will be extracted as such: + +```json +color: ["red", "green", "blue"] +``` + +The variables generated can be used in locations prescribed by the definition. + + +### Variable substitution +In all cases, _variables_ identified in the response payload may be substitued **only** in locations prescribed in the link definitions. All such locations are prefixed by a `$response` keyword and surrounded by curly brackets `{}`. + +### Example +Computing a link from a response object is performed as follows: + +```yaml +Addresses: + href: /users/{$response.id}/address +``` + +Where the `$response.id` from the example above would yield the target: + +```yaml +href: '/users/df71a505-07bc-458a-a5c0-73c0340d1ec7/address' +``` + +And the array example: + +```yaml +ColorSelection: + href: 'http://colors.my-server.com/colors/{$response.color}' +``` + +Would produce the following links: + +```yaml +href: 'http://colors.my-server.com/colors/red' +href: 'http://colors.my-server.com/colors/green' +href: 'http://colors.my-server.com/colors/blue' +``` + +As with all links, it at the the clients' discretion to follow them, and permissions and the existence of a value is not guaranteed soley by the existence of a link relationship. [**I assume you mean that the existance of the link relationship does not guarantee a successful response from the call**] + + +### Example + +The example below shows how relationships in the BitBucket API can be represented with the proposed OAI link scheme. This example uses `operationId` values to link responses to possible operations. + +```yaml +paths: + /2.0/users/{username}: + get: + operationId: getUserByName + parameters: + - name: username + type: string + in: path + required: true + responses: + 200: + description: The User + schema: + $ref: '#/components/definitions/user' + links: + userRepositories: + $ref: '#/components/links/UserRepositories' + /2.0/repositories/{username}: + get: + operationId: getRepositoriesByOwner + parameters: + - name: username + type: string + in: path + required: true + responses: + 200: + description: repositories owned by the supplied user + schema: + type: array + items: + $ref: '#/components/definitions/repository' + links: + userRepository: + $ref: '#/components/links/UserRepository' + /2.0/repositories/{username}/{slug}: + get: + operationId: getRepository + parameters: + - name: username + type: string + in: path + required: true + - name: slug + type: string + in: path + required: true + responses: + 200: + description: The repository + schema: + $ref: '#/components/definitions/repository' + links: + repositoryPullRequests: + $ref: '#/components/links/RepositoryPullRequests' + /2.0/repositories/{username}/{slug}/pullrequests: + get: + operationId: getPullRequestsByRepository + parameters: + - name: username + type: string + in: path + required: true + - name: slug + type: string + in: path + required: true + - name: state + type: string + in: query + enum: + - open + - merged + - declined + responses: + 200: + description: an array of pull request objects + schema: + type: array + items: + $ref: '#/components/definitions/pullrequest' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}: + get: + operationId: getPullRequestsById + parameters: + - name: username + type: string + in: path + required: true + - name: slug + type: string + in: path + required: true + - name: pid + type: string + in: path + required: true + responses: + 200: + description: a pull request object + schema: + $ref: '#/components/definitions/pullrequest' + links: + $ref: '#/components/links/PullRequestMerge' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: + post: + operationId: mergePullRequest + parameters: + - name: username + type: string + in: path + required: true + - name: slug + type: string + in: path + required: true + - name: pid + type: string + in: path + required: true + responses: + 204: + description: the PR was successfully merged +components: + links: + UserRepositories: + # returns array of '#/components/definitions/repository' + operationId: getRepositoriesByOwner + parameters: + username: $response.username + UserRepository: + # returns '#/components/definitions/repository' + operationId: getRepository + parameters: + username: $response.owner.username + slug: $response.slug + RepositoryPullRequests: + # returns '#/components/definitions/pullrequest' + operationId: getPullRequestsByRepository + params: + username: $response.owner.username + slug: $response.slug + PullRequestMerge: + # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + operationId: mergePullRequest + parameters: + username: $response.user.username # Should be $response.author.username? + slug: $response.repository.slug + pid: $response.id + definitions: + user: + type: object + properties: + username: + type: string + uuid: + type: string + repository: + type: object + properties: + slug: + type: string + owner: + $ref: '#/components/definitions/user' + pullrequest: + type: object + properties: + id: + type: integer + title: + type: string + repository: + $ref: '#/components/definitions/repository' + author: + $ref: '#/components/definitions/user' +``` + +As references to `operationId` may not be possible (the `operationId` is an optional value), references may also be made through a relative `href`: + +```yaml +components: + links: + UserRepositories: + # returns array of '#/components/definitions/repository' + href: '/2.0/repositories/{$response.username}' +``` + +or an absolute `href`: + +```yaml +components: + links: + UserRepositories: + # returns array of '#/components/definitions/repository' + href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.username}' +``` + + +### Link Parameters +Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these may be dynamic depending on the response itself. + +To specify parameters required by the operation, we can use a **Link Parameters Object**. This object contains parameter names along with static or dynamic valus: + +```yaml +paths: + /user/{username}: # ... + /user/{username}/commits: + get: + operationId: userCommitHistory + parameters: + - name: username + in: path + type: string + required: true + - name: page + type: integer + format: int32 + required: true + responses: { ... } +components: + links: + UserCommitHistory: + operationId: userCommitHistory + parameters: + username: $response.user.username + page: 0 +``` + +In the above, the link for `UserCommitHistory` points to the operation `getUserCommitHistory`, and passes the `username` value from the response payload as well as the static scalar value `0`. + #### Header Object Field Name | Type | Description From a7556c2efd4cd2db871c2bc43c71acf7add34392 Mon Sep 17 00:00:00 2001 From: Erik Wilde Date: Fri, 10 Jun 2016 12:24:59 +0200 Subject: [PATCH 0054/1801] fixing typo --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 541be2fc77..1d2963adbf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1100,7 +1100,7 @@ Field Pattern | Type | Description ##### Example Object Example -Example request or response for application/json mimetype of a Pet data type: +Example request or response for application/json mime type of a Pet data type: ```js { From 4fbbc041803d8ecc77df631025e6f8506c0fc0b9 Mon Sep 17 00:00:00 2001 From: Erik Wilde Date: Sun, 12 Jun 2016 13:39:20 +0200 Subject: [PATCH 0055/1801] Terminology fix: "Mime type" -> "Media type" this PR changes the anchor #mimeType to #mediaType, so if there are external links to this anchor, then those should be updated as well. alternatively, we could add a second anchor, effectively aliasing the section to be addressable by both identifiers. --- versions/3.0.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1d2963adbf..6e89bdae50 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -27,10 +27,10 @@ Version | Date | Notes ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. -##### Mime Types -Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). +##### Media Types +Media type definitions are spread across several resources. The media type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). -Some examples of possible mime type definitions: +Some examples of possible media type definitions: ``` text/plain; charset=utf-8 application/json @@ -114,8 +114,8 @@ Field Name | Type | Description openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. -consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). -produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes). +consumes | [`string`] | A list of media types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). +produces | [`string`] | A list of media types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). responses | [Responses] paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. @@ -448,8 +448,8 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). +consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). +produces | [`string`] | A list of media types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. @@ -749,7 +749,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type. +examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by media type. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -944,7 +944,7 @@ Describes a single response from an API Operation. Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. -schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type. +schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` media type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. examples | [Example Object](#exampleObject) | An example of the response message. @@ -1096,11 +1096,11 @@ Allows sharing examples for operation requests and responses. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[mime type](#mimeTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like. +{[media type](#mediaTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like. ##### Example Object Example -Example request or response for application/json mime type of a Pet data type: +Example request or response for application/json media type of a Pet data type: ```js { From 2ece1f3fcbed82e152655f5dd5dfa362b4f6b145 Mon Sep 17 00:00:00 2001 From: James Watts Date: Sun, 10 Jul 2016 00:31:28 +0200 Subject: [PATCH 0056/1801] Revised typo and language to MAY --- versions/2.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/2.0.md b/versions/2.0.md index 67f77b4c9f..1da5377cb3 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -837,7 +837,7 @@ items: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. -The `default` can be used a default response object for all HTTP codes that are not covered individually by the specification. +The `default` MAY be used as the default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. From 2fd57b27fc5009a4ff995f8e401e50f9c4360b1b Mon Sep 17 00:00:00 2001 From: Erik Wilde Date: Tue, 12 Jul 2016 11:37:51 +0200 Subject: [PATCH 0057/1801] fixing typo --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6e89bdae50..2bfca451ce 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -6,7 +6,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S The OpenAPI Specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). -## Introductions +## Introduction The OpenAPI Specification is a project used to describe and document RESTful APIs. From 78e6195dec8ca4a5a5673340231b96e0526ecc05 Mon Sep 17 00:00:00 2001 From: Logan Bailey Date: Thu, 21 Jul 2016 07:42:46 -0700 Subject: [PATCH 0058/1801] Grammar - Removed duplicate article's a and an --- versions/2.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/2.0.md b/versions/2.0.md index 67f77b4c9f..1b70405e83 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -1235,7 +1235,7 @@ Field Name | Type | Description readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as `readOnly` being `true` SHOULD NOT be in the `required` list of the defined schema. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. -example | Any | A free-form property to include a an example of an instance for this schema. +example | Any | A free-form property to include an example of an instance for this schema. ##### Patterned Objects From bbb5d33fc6a6b8ddc59e04c2ffb799855914f33a Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 21 Jul 2016 17:18:35 -0700 Subject: [PATCH 0059/1801] clarifications, respond to feedback --- versions/3.0.md | 63 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1445914fb..625a4c987e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1151,6 +1151,8 @@ href | url | a relative or absolute URL to a linked resource. This field parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. description | string | a description of the link, supports GFM. +Locating a linked resource may be performed by either a `href` or `operationId`. In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. + #### Response Payload Values Payload values are only available in parseable response payloads which match the advertised media-type. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. @@ -1194,17 +1196,66 @@ The variables generated can be used in locations prescribed by the definition. ### Variable substitution -In all cases, _variables_ identified in the response payload may be substitued **only** in locations prescribed in the link definitions. All such locations are prefixed by a `$response` keyword and surrounded by curly brackets `{}`. +In all cases, _variables_ from request and responses may be substituted for link generation. The table below designates the source of the substitution value and the syntax for accessing it: -### Example -Computing a link from a response object is performed as follows: +Source Location | reference identifier | example value | example reference | notes +---|:---|:---|:--- +HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation +Requested content type | `$accepts` | `/users/3?format={$accepts}` | +Request parameter | `$request` | `/users/{$request.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers +Request body | `$requestBody` | `/users/{$requestBody.user.uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Request URL | `$url` | `/track?url={$url}` | +Response value | `$response` | `{$response.uuid}` | Only the payload in the response can be accessed with the `$response` syntax +Response header | `$responseHeader` | `{$responseHeader.Server}` | Single header values only are available. + +From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. For responses, the response payload may be used with the `$response` syntax. For both requests and responses, values will be substituted in the link in sections designated with the `$request` or `$response` keyword, surrounded by curly brackets `{}`. + +### Request parameter example +Computing a link from a request operation like such: + +```yaml +paths: + /users/{id}: + parameters: + - name: id + in: path + required: true + description: the user identifier, as userId or username + schema: + type: string + responses: + 200: + description: the user being returned + schema: + type: object + properties: + uuid: the unique user id + type: string + format: uuid +``` + +Can be used in a link like this: ```yaml Addresses: - href: /users/{$response.id}/address + href: '/users/{$request.id}/department' +``` + +Where the `$request.id` is the value passed in the request to `/users/{id}`. For a `id` value of `10101110`, the generated link would be: + +```yaml +href: '/users/10101110/department' ``` -Where the `$response.id` from the example above would yield the target: +### Response payload example + +```yaml +Addresses: + href: '/users/{$response.uuid}/address' +``` + +Where the `$response.uuid` from the example above would yield the target: + ```yaml href: '/users/df71a505-07bc-458a-a5c0-73c0340d1ec7/address' @@ -1225,7 +1276,7 @@ href: 'http://colors.my-server.com/colors/green' href: 'http://colors.my-server.com/colors/blue' ``` -As with all links, it at the the clients' discretion to follow them, and permissions and the existence of a value is not guaranteed soley by the existence of a link relationship. [**I assume you mean that the existance of the link relationship does not guarantee a successful response from the call**] +As with all links, it at the the clients' discretion to follow them, and permissions and the ability to make a successful call to that link is not guaranteed soley by the existance of a relationship. ### Example From 6636d942d805af5c459bd50c3eccd64abfc84cb8 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 21 Jul 2016 21:22:51 -0700 Subject: [PATCH 0060/1801] added extensions --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 625a4c987e..d46077c3f8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1150,6 +1150,7 @@ href | url | a relative or absolute URL to a linked resource. This field operationId| string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. description | string | a description of the link, supports GFM. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. Locating a linked resource may be performed by either a `href` or `operationId`. In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. From ad989ad7fae36fb74ff81161e0f193b02019e057 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 21 Jul 2016 21:32:50 -0700 Subject: [PATCH 0061/1801] added headers --- versions/3.0.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d46077c3f8..96c7814515 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1145,10 +1145,11 @@ Field Pattern | Type | Description The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description - --- | :---: | --- -href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. - operationId| string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. +---|:---:|--- +href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. +operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. +headers | Link Headers Object | an Object representing headers to pass to the linked resource. description | string | a description of the link, supports GFM. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. From 096cfdc099a2f473e0f9cfc57ce487b4538a2e8d Mon Sep 17 00:00:00 2001 From: Logan Bailey Date: Thu, 28 Jul 2016 08:54:49 -0700 Subject: [PATCH 0062/1801] [Grammar] Removes duplicate article `a` --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 96c7814515..db5e8bd250 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1731,7 +1731,7 @@ Field Name | Type | Description readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as `readOnly` being `true` SHOULD NOT be in the `required` list of the defined schema. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. -example | Any | A free-form property to include a an example of an instance for this schema. +example | Any | A free-form property to include an example of an instance for this schema. deprecated | `boolean` | Specifies that a schema is deprecated and should be transitioned out of usage. ##### Patterned Objects From 9ec38c20017503811ab810b1513a403a51c78b40 Mon Sep 17 00:00:00 2001 From: Robert Panzer Date: Tue, 9 Aug 2016 08:42:33 +0200 Subject: [PATCH 0063/1801] Fix error in json example The XML property example in JSON nested the name property inside the id property which is wrong I guess and the two properties should be next to each other. --- versions/2.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/2.0.md b/versions/2.0.md index 1b70405e83..d52c9d0ec6 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -1686,13 +1686,13 @@ In this example, a full model definition is shown. "format": "int32", "xml": { "attribute": true - }, - "name": { - "type": "string", - "xml": { - "namespace": "http://swagger.io/schema/sample", - "prefix": "sample" - } + } + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://swagger.io/schema/sample", + "prefix": "sample" } } } From 27ffc62115e4f03e1811e9a48298a19062f8f5c5 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 9 Aug 2016 16:31:11 -0400 Subject: [PATCH 0064/1801] Initial changes --- versions/3.0.md | 323 +++++++++++++++++++++++++++++++----------------- 1 file changed, 210 insertions(+), 113 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 96c7814515..15b47c2755 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -114,9 +114,7 @@ Field Name | Type | Description openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. -consumes | [`string`] | A list of media types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). -produces | [`string`] | A list of media types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). -responses | [Responses] +responses | [Responses](#responsesObject) paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. @@ -295,16 +293,17 @@ Field Pattern | Type | Description "/pets": { "get": { "description": "Returns all pets from the system that the user has access to", - "produces": [ - "application/json" - ], "responses": { - "200": { + "200": { "description": "A list of pets.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/pet" + "representations" : { + "application/json" : { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/pet" + } + } } } } @@ -318,15 +317,15 @@ Field Pattern | Type | Description /pets: get: description: Returns all pets from the system that the user has access to - produces: - - application/json responses: '200': description: A list of pets. - schema: - type: array - items: - $ref: '#/definitions/pet' + representations: + 'application/json': + schema: + type: array + items: + $ref: '#/definitions/pet' ``` #### Path Item Object @@ -367,24 +366,28 @@ Field Pattern | Type | Description "description": "Returns pets based on ID", "summary": "Find pets by ID", "operationId": "getPetsById", - "produces": [ - "application/json", - "text/html" - ], "responses": { "200": { "description": "pet response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" + "representations": { + "application/json" : { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Pet" + } + } } } }, "default": { "description": "error payload", - "schema": { - "$ref": "#/definitions/ErrorModel" + "representations": { + "text/html" : { + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } } } } @@ -410,20 +413,21 @@ get: description: Returns pets based on ID summary: Find pets by ID operationId: getPetsById - produces: - - application/json - - text/html responses: '200': description: pet response - schema: - type: array - items: - $ref: '#/definitions/Pet' + representations: + application/json: + schema: + type: array + items: + $ref: '#/definitions/Pet' default: description: error payload - schema: - $ref: '#/definitions/ErrorModel' + representations: + text/html: + schema: + $ref: '#/definitions/ErrorModel' parameters: - name: id in: path @@ -448,8 +452,6 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). -produces | [`string`] | A list of media types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. @@ -476,13 +478,6 @@ Field Pattern | Type | Description "summary": "Updates a pet in the store with form data", "description": "", "operationId": "updatePetWithForm", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/json", - "application/xml" - ], "parameters": [ { "name": "petId", @@ -490,28 +485,39 @@ Field Pattern | Type | Description "description": "ID of pet that needs to be updated", "required": true, "type": "string" - }, - { - "name": "name", - "in": "formData", - "description": "Updated name of the pet", - "required": false, - "type": "string" - }, - { - "name": "status", - "in": "formData", - "description": "Updated status of the pet", - "required": false, - "type": "string" } ], + "requestBody" : { + "representations" : { + "application/x-www-form-urlencoded":{ + "schema" : { + "properties": { + "name" + "description" : "Updated name of the pet", + "type": "string" + "status": + "description" : "Updated status of the pet", + "type": "string" + }, + "required" : ["status"] + } + } + } + }, "responses": { "200": { - "description": "Pet updated." + "description": "Pet updated.", + "representations" : { + "application/json" : {}, + "application/xml" : {} + } }, "405": { - "description": "Invalid input" + "description": "Invalid input", + "representations" : { + "application/json" : {}, + "application/xml" : {} + } } }, "security": [ @@ -531,32 +537,36 @@ tags: summary: Updates a pet in the store with form data description: "" operationId: updatePetWithForm -consumes: -- application/x-www-form-urlencoded -produces: -- application/json -- application/xml parameters: - name: petId in: path description: ID of pet that needs to be updated required: true type: string -- name: name - in: formData - description: Updated name of the pet - required: false - type: string -- name: status - in: formData - description: Updated status of the pet - required: false - type: string +responseBody: + representations: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status responses: '200': description: Pet updated. + representations: + application/json: {} + application/xml: {} '405': description: Invalid input + representations: + application/json: {} + application/xml: {} security: - petstore_auth: - write:pets @@ -601,14 +611,10 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are five possible parameter types. +There are four possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. -* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): - * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. - * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. - * Cookie - Used to pass a specific cookie value to the API. @@ -618,7 +624,7 @@ For complex parameter schemas, a serialization strategy is required. For all typ Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. @@ -748,6 +754,7 @@ The `Content-Type` of the request body must be specified by the `consumes` attri Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +representations | [Representations Object](#representationsObject) | The representations of the request body. schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by media type. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -765,44 +772,57 @@ A request body with a referenced model definition. ```js { "description": "user to add to the system", - "schema": { - "$ref": "#/definitions/User" - }, - "examples": { - "application/json": { - "$ref": 'http://foo.bar#/examples/address-example.json' - 'application/xml': - $ref: 'http://foo.bar#/examples/address-example.xml' - 'text/plain': - $ref: 'http://foo.bar#/examples/address-example.txt' - default: - $ref: 'http://foo.bar#/examples/address-example.whatever' + "representations" : { + "application/json" : { + "schema": { + "$ref": "#/definitions/User" + }, + "examples": [ + { "$ref": 'http://foo.bar#/examples/address-example.json'} + ]http://foo.bar#/examples/address-example.txt + }, + "application/xml" : { + "examples": [ + { "$ref": 'http://foo.bar#/examples/address-example.xml'} + ] + }, + "text/plain" : { + "examples": [ + { "$ref": 'http://foo.bar#/examples/address-example.txt'} + ] + } + } } ``` ```yaml description: user to add to the system -schema: - $ref: '#/definitions/User' -examples: - 'application/json': - $ref: 'http://foo.bar/examples/user-example.json' - 'application/xml': - $ref: 'http://foo.bar/examples/user-example.xml' - 'text/plain': - $ref: 'http://foo.bar/examples/user-example.txt' - default: - $ref: 'http://foo.bar/examples/user-example.whatever' +representations: + 'application/json': + schema: + $ref: '#/definitions/User' + examples: + - 'http://foo.bar/examples/user-example.json' + 'application/xml': + examples: + - 'http://foo.bar/examples/user-example.xml' + 'text/plain': + examples: + - 'http://foo.bar/examples/user-example.txt' ``` A body parameter that is an array of string values: ```js { "description": "user to add to the system", - "schema": { - "type": "array", - "items": { - "type": "string" + "representations": { + "application/json" : { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } } } } @@ -811,12 +831,89 @@ A body parameter that is an array of string values: ```yaml description: user to add to the system required: true -schema: - type: array - items: - type: string +representations: + application/json: + schema: + type: array + items: + type: string +``` + + +#### Representations Object + +Describes a set of supported representations. A representations object can be used in [requestBody](#requestBody), [response objects](#responseObject) and [parameter objects](#parameterObject) to describe complex parameters. + +Each key in the representations object is the media-type of the [Representation Object](#representationObject). + +##### Representations Examples + +```js +{ + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "examples": [] + }, + "application/xml" : {} +} +``` + +```yaml +application/json: + schema: + type: array + items: + type: string +application/xml: {} +``` + +#### Representation Object +The representation object provides schema and examples for a the media type identified by its key. Representation objects can be used in a [representations object](#representationsObject). + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +examples | [Examples Array](#examplesArray) | Examples of the representation. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. + +##### Representation Examples + +A representation description. +```js +{ + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": "string" + } + }, + "examples": [] + }, + "application/xml" : {} +} ``` +```yaml +application/json: + schema: + type: array + items: + type: string +application/xml: {} +``` + + #### Items Object A limited subset of JSON-Schema's items object. It is used by parameter definitions. From e7ef31578bb30b48a487594f5e315bd77456a8d8 Mon Sep 17 00:00:00 2001 From: Robert Panzer Date: Wed, 10 Aug 2016 08:18:53 +0200 Subject: [PATCH 0065/1801] Fix example in json example in 3.0 --- versions/3.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 96c7814515..5f268e6fbb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2183,13 +2183,13 @@ In this example, a full model definition is shown. "format": "int32", "xml": { "attribute": true - }, - "name": { - "type": "string", - "xml": { - "namespace": "http://swagger.io/schema/sample", - "prefix": "sample" - } + } + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://swagger.io/schema/sample", + "prefix": "sample" } } } From 80921005ded73add0cf2059b2c0b767727e846c6 Mon Sep 17 00:00:00 2001 From: Ole Lensmar Date: Fri, 12 Aug 2016 12:32:49 +0200 Subject: [PATCH 0066/1801] fixed formatting of Variable substitution table --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5f268e6fbb..4f88a70790 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1201,8 +1201,8 @@ The variables generated can be used in locations prescribed by the definition. In all cases, _variables_ from request and responses may be substituted for link generation. The table below designates the source of the substitution value and the syntax for accessing it: Source Location | reference identifier | example value | example reference | notes ----|:---|:---|:--- -HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation +---|:---|:---|:---|:--- +HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation Requested content type | `$accepts` | `/users/3?format={$accepts}` | Request parameter | `$request` | `/users/{$request.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers Request body | `$requestBody` | `/users/{$requestBody.user.uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself From 4db61e43efd18fff17e9f32be38bdb0f707ca8a4 Mon Sep 17 00:00:00 2001 From: James Watts Date: Mon, 15 Aug 2016 20:44:29 +0200 Subject: [PATCH 0067/1801] Revised language update --- versions/2.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/2.0.md b/versions/2.0.md index 1da5377cb3..a6d47f9ff2 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -837,7 +837,7 @@ items: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. -The `default` MAY be used as the default response object for all HTTP codes that are not covered individually by the specification. +The `default` can be used as the default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. From 075b76d0b8006f6825f7d8241bf33cfa65113837 Mon Sep 17 00:00:00 2001 From: James Watts Date: Mon, 15 Aug 2016 20:50:10 +0200 Subject: [PATCH 0068/1801] Minor language update to use MAY keyword --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6e89bdae50..d401f8a48c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -889,7 +889,7 @@ items: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. -The `default` can be used a default response object for all HTTP codes that are not covered individually by the specification. +The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. From 33f7cac5c1796ec53e68f00d987a750f1e2c1df4 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 16 Aug 2016 00:43:42 -0400 Subject: [PATCH 0069/1801] More updates of representations --- versions/3.0.md | 220 +++++++++++++++++++++++++++++------------------- 1 file changed, 133 insertions(+), 87 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15b47c2755..3aeca416f6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -114,9 +114,8 @@ Field Name | Type | Description openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. -responses | [Responses](#responsesObject) paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. -components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. @@ -268,7 +267,7 @@ Holds a set of schemas for different aspects of the OAS. The intention is to pu Field Pattern | Type | Description ---|:---:|--- | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. - | Responses Definitions Object | Reusable responses objects. + | [Responses Definitions Object](#responsesDefinitionsObject) | Reusable responses objects. | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. @@ -417,7 +416,7 @@ get: '200': description: pet response representations: - application/json: + 'application/json': schema: type: array items: @@ -425,7 +424,7 @@ get: default: description: error payload representations: - text/html: + 'text/html': schema: $ref: '#/definitions/ErrorModel' parameters: @@ -545,7 +544,7 @@ parameters: type: string responseBody: representations: - application/x-www-form-urlencoded: + 'application/x-www-form-urlencoded': schema: properties: name: @@ -560,13 +559,13 @@ responses: '200': description: Pet updated. representations: - application/json: {} - application/xml: {} + 'application/json': {} + 'application/xml': {} '405': description: Invalid input representations: - application/json: {} - application/xml: {} + 'application/json': {} + 'application/xml': {} security: - petstore_auth: - write:pets @@ -756,7 +755,6 @@ Field Name | Type | Description description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. representations | [Representations Object](#representationsObject) | The representations of the request body. schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by media type. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -779,7 +777,7 @@ A request body with a referenced model definition. }, "examples": [ { "$ref": 'http://foo.bar#/examples/address-example.json'} - ]http://foo.bar#/examples/address-example.txt + ] }, "application/xml" : { "examples": [ @@ -832,7 +830,7 @@ A body parameter that is an array of string values: description: user to add to the system required: true representations: - application/json: + 'application/json': schema: type: array items: @@ -849,7 +847,7 @@ Each key in the representations object is the media-type of the [Representation ##### Representations Examples ```js -{ +"representations" : { "application/json": { "schema": { "type": "array", @@ -864,12 +862,13 @@ Each key in the representations object is the media-type of the [Representation ``` ```yaml -application/json: - schema: - type: array - items: - type: string -application/xml: {} +representations: + 'application/json': + schema: + type: array + items: + type: string + 'application/xml': {} ``` #### Representation Object @@ -947,7 +946,7 @@ Field Pattern | Type | Description ##### Items Object Examples -Items must be of type string and have the minimum length of 2 characters: +Items must be of type string and have the minimum length of 2 characters: ```js { @@ -1010,14 +1009,22 @@ A 200 response for successful operation and a default response for others (imply { "200": { "description": "a pet to be returned", - "schema": { - "$ref": "#/definitions/Pet" + "representations" : { + "application/json" : { + "schema": { + "$ref": "#/definitions/Pet" + } + } } }, "default": { "description": "Unexpected error", - "schema": { - "$ref": "#/definitions/ErrorModel" + "representations" : { + "application/json" : { + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } } } } @@ -1026,12 +1033,16 @@ A 200 response for successful operation and a default response for others (imply ```yaml '200': description: a pet to be returned - schema: - $ref: '#/definitions/Pet' + representations: + 'application/json': + schema: + $ref: '#/definitions/Pet' default: description: Unexpected error - schema: - $ref: '#/definitions/ErrorModel' + representations: + 'application/json': + schema: + $ref: '#/definitions/ErrorModel' ``` #### Response Object @@ -1041,9 +1052,8 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. -schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` media type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. -examples | [Example Object](#exampleObject) | An example of the response message. +representations | [Representations Object](#representationsObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. @@ -1060,10 +1070,14 @@ Response of an array of a complex type: ```js { "description": "A complex object array response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/VeryComplexType" + "representations" : { + "application/json" : { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/VeryComplexType" + } + } } } } @@ -1071,10 +1085,12 @@ Response of an array of a complex type: ```yaml description: A complex object array response -schema: - type: array - items: - $ref: '#/definitions/VeryComplexType' +representations: + 'application/json': + schema: + type: array + items: + $ref: '#/definitions/VeryComplexType' ``` Response with a string type: @@ -1082,9 +1098,14 @@ Response with a string type: ```js { "description": "A simple string response", - "schema": { - "type": "string" + "representations" : { + "application/json" : { + "schema": { + "type": "string" + } + } } + } ``` @@ -1099,8 +1120,12 @@ Response with headers: ```js { "description": "A simple string response", - "schema": { - "type": "string" + "representations" : { + "application/json" : { + "schema": { + "type": "string" + } + } }, "headers": { "X-Rate-Limit-Limit": { @@ -1121,8 +1146,10 @@ Response with headers: ```yaml description: A simple string response -schema: - type: string +representations: + 'application/json': + schema: + type: string headers: X-Rate-Limit-Limit: description: The number of allowed requests in the current period @@ -1188,7 +1215,7 @@ X-Rate-Limit-Reset: type: integer ``` -#### Example Object +#### Examples Object Allows sharing examples for operation requests and responses. @@ -1197,24 +1224,24 @@ Field Pattern | Type | Description ---|:---:|--- {[media type](#mediaTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like. -##### Example Object Example +##### Examples Array Example -Example request or response for application/json media type of a Pet data type: +Example representation for application/json media type of a Pet data type: ```js -{ - "application/json": { +[ + { "name": "Puma", "type": "Dog", "color": "Black", "gender": "Female", "breed": "Mixed" } -} +] ``` ```yaml -application/json: +- name: Puma type: Dog color: Black @@ -1325,12 +1352,14 @@ paths: responses: 200: description: the user being returned - schema: - type: object - properties: - uuid: the unique user id - type: string - format: uuid + representations: + 'application/json': + schema: + type: object + properties: + uuid: the unique user id + type: string + format: uuid ``` Can be used in a link like this: @@ -1394,9 +1423,11 @@ paths: required: true responses: 200: - description: The User - schema: - $ref: '#/components/definitions/user' + description: The User + representations: + 'application/json': + schema: + $ref: '#/components/definitions/user' links: userRepositories: $ref: '#/components/links/UserRepositories' @@ -1411,10 +1442,12 @@ paths: responses: 200: description: repositories owned by the supplied user - schema: - type: array - items: - $ref: '#/components/definitions/repository' + representations: + 'application/json': + schema: + type: array + items: + $ref: '#/components/definitions/repository' links: userRepository: $ref: '#/components/links/UserRepository' @@ -1432,9 +1465,11 @@ paths: required: true responses: 200: - description: The repository - schema: - $ref: '#/components/definitions/repository' + description: The repository + representations: + 'application/json': + schema: + $ref: '#/components/definitions/repository' links: repositoryPullRequests: $ref: '#/components/links/RepositoryPullRequests' @@ -1460,10 +1495,12 @@ paths: responses: 200: description: an array of pull request objects - schema: - type: array - items: - $ref: '#/components/definitions/pullrequest' + representations: + 'application/json': + schema: + type: array + items: + $ref: '#/components/definitions/pullrequest' /2.0/repositories/{username}/{slug}/pullrequests/{pid}: get: operationId: getPullRequestsById @@ -1483,8 +1520,10 @@ paths: responses: 200: description: a pull request object - schema: - $ref: '#/components/definitions/pullrequest' + representations: + 'application/json': + schema: + $ref: '#/components/definitions/pullrequest' links: $ref: '#/components/links/PullRequestMerge' /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: @@ -1707,17 +1746,22 @@ definitions: # in a request body, note the plural `examples` as the content-type is set by `consumes`: requestBody: - schema: - $ref: '#/definitions/Address' - examples: - 'application/json': - $ref: 'http://foo.bar#/examples/address-example.json' + representations: + 'application/json': + schema: + $ref: '#/definitions/Address' + examples: + - + $ref: 'http://foo.bar#/examples/address-example.json' 'application/xml': - $ref: 'http://foo.bar#/examples/address-example.xml' + examples: + - + $ref: 'http://foo.bar#/examples/address-example.xml' 'text/plain': - $ref: 'http://foo.bar#/examples/address-example.txt' - default: - $ref: 'http://foo.bar#/examples/address-example.whatever' + examples: + - + $ref: 'http://foo.bar#/examples/address-example.txt' + # in a parameter @@ -1732,11 +1776,13 @@ definitions: responses: 200: description: your car appointment has been booked - schema: - $ref: '#/definitions/SuccessResponse' - examples: + representations: 'application/json': - $ref: http://foo.bar#/examples/address-example.json + schema: + $ref: '#/definitions/SuccessResponse' + examples: + - + $ref: http://foo.bar#/examples/address-example.json ``` #### Reference Object From b2db2e9af45caf04b1226205ea8efdb41f2f0f4d Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 17 Aug 2016 21:52:38 -0400 Subject: [PATCH 0070/1801] Expanded representations examples --- versions/3.0.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index cf4b249145..64bdd5b25e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -840,7 +840,7 @@ representations: #### Representations Object -Describes a set of supported representations. A representations object can be used in [requestBody](#requestBody), [response objects](#responseObject) and [parameter objects](#parameterObject) to describe complex parameters. +Describes a set of supported representations. A representations object can be used in [requestBody](#requestBody) and [response objects](#responseObject). Each key in the representations object is the media-type of the [Representation Object](#representationObject). @@ -849,15 +849,29 @@ Each key in the representations object is the media-type of the [Representation ```js "representations" : { "application/json": { + 'application/json': + "schema": { "type": "array", "items": { "type": "string" } }, - "examples": [] + "examples": [ + ["Bob","Diane","Mary","Bill"], + [] + ] }, - "application/xml" : {} + "application/xml" : { + "examples" : [ + "", + "" + ] + }, + "text/plain" : { + "Bob,Diane,Mary,Bill", + "" + } } ``` @@ -868,7 +882,21 @@ representations: type: array items: type: string - 'application/xml': {} + examples: + - + - Bob + - Diane + - Mary + - Bill + - {} + + 'application/xml': + examples: + - "" + - "" + 'text/plain': + examples: + - "Bob,Diane,Mary,Bill" ``` #### Representation Object From 8f033498c63b930fbc85ac037f916b67be7c317a Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 18 Aug 2016 10:35:35 -0400 Subject: [PATCH 0071/1801] Updating representation example --- versions/3.0.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 64bdd5b25e..4e46e19ac5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -337,8 +337,8 @@ A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path Field Name | Type | Description ---|:---:|--- $ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. -summary | An optional, string summary, intended to apply to all operations in this path. -description | An optional, string description, intended to apply to all operations in this path. +summary| `string` | An optional, string summary, intended to apply to all operations in this path. +description | `string` | An optional, string description, intended to apply to all operations in this path. get | [Operation Object](#operationObject) | A definition of a GET operation on this path. put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. post | [Operation Object](#operationObject) | A definition of a POST operation on this path. @@ -754,7 +754,6 @@ Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. representations | [Representations Object](#representationsObject) | The representations of the request body. -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -849,8 +848,6 @@ Each key in the representations object is the media-type of the [Representation ```js "representations" : { "application/json": { - 'application/json': - "schema": { "type": "array", "items": { @@ -920,24 +917,30 @@ A representation description. { "application/json": { "schema": { - "type": "object", - "properties": { - "type": "string" - } + "$ref": "#/definitions/Pet" }, - "examples": [] - }, - "application/xml" : {} + "examples": [{ + "name" : "Fluffy", + "petType" : "Cat" + }, + { + "name" : "Rover", + "petType" : "Frog" + }] + } } ``` ```yaml application/json: schema: - type: array - items: - type: string -application/xml: {} + $ref: "#/definitions/Pet" + examples: + - name: Fluffy + petType: Cat + - name: Rover + petType: Frog + ``` From dbf5f6ddda1561a3e0d9d08c94c56c4c6d298c62 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 19 Aug 2016 05:44:21 -0700 Subject: [PATCH 0072/1801] added callbacks --- versions/3.0.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index a0c0ee772e..b661c6b579 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -453,6 +453,7 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. +callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. @@ -1050,6 +1051,36 @@ Response with no return value: description: object created ``` +#### Callback Object + +A container for possible out-of band callbacks from an operation. A callback may be returned from an operation, calling back to the path specified in the operation object. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback payload structure +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. + + +##### Callback Object Example + +A callback to the URL specified by the `url` parameter in the request + + +```yaml +myWebhook: + '$request.url': + post: + body: + name: postResponse + schema: + $ref: '#/definitions/SomePayload' + responses: + 200: + description: webhook successfully processed an no retries will be performed +``` + + #### Headers Object Lists the headers that can be sent as part of a response. From ad670d7b6ebeda7c71ce0f5fed13a2d7d7152c26 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 22 Aug 2016 09:18:38 -0700 Subject: [PATCH 0073/1801] clarified scope of existing repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a61c211cd..6ec5e06b3a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The current version of the OpenAPI specification is 2.0 - and you can find it [h ### [OpenAPI 2.0 Specification](versions/2.0.md) -This repository contains the existing Swagger 1.2 specification as well as proposals for the 2.0 version. +This repository contains the existing Swagger 1.2, 2.0 specifications as well as proposals for the next verson of the specification, which will be called the OpenAPI Specification 3.0. The proposals live in the [OpenAPI.next](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) branch. ## Structure From 111cf2bd77b76b0d0c4b1478f12c556b6c5debf6 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 27 Jun 2016 14:02:18 -0400 Subject: [PATCH 0074/1801] Change markdown standard from GFM to CommonMark --- versions/3.0.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index a0c0ee772e..46af2989a2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -138,7 +138,7 @@ The object provides metadata about the API. The metadata can be used by the clie Field Name | Type | Description ---|:---:|--- title | `string` | **Required.** The title of the application. -description | `string` | A short description of the application. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. @@ -445,7 +445,7 @@ Field Name | Type | Description ---|:---:|--- tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. summary | `string` | A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. -description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). @@ -572,7 +572,7 @@ Allows referencing an external resource for extended documentation. Field Name | Type | Description ---|:---:|--- -description | `string` | A short description of the target documentation. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL. ##### Patterned Objects @@ -619,7 +619,7 @@ Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". -description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. @@ -747,7 +747,7 @@ The `Content-Type` of the request body must be specified by the `consumes` attri ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by media type. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -943,7 +943,7 @@ Describes a single response from an API Operation, including design-time, static ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` media type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. examples | [Example Object](#exampleObject) | An example of the response message. @@ -1569,7 +1569,7 @@ Allows adding meta data to a single tag that is used by the [Operation Object](# Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the tag. -description | `string` | A short description for the tag. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. ##### Patterned Fields @@ -1697,7 +1697,7 @@ The following properties are taken directly from the JSON Schema definition and - $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) - format (See [Data Type Formats](#dataTypeFormat) for further details) - title -- description ([GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation) +- description ([CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation) - default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) - multipleOf - maximum From 156d852aa27e56e94c295bc92e3358ddcac15d16 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 8 Sep 2016 12:12:27 -0400 Subject: [PATCH 0075/1801] Updated GFM reference for Link Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 46af2989a2..6dc8ec03f4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1150,7 +1150,7 @@ href | url | a relative or absolute URL to a linked resource. This fie operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | Link Headers Object | an Object representing headers to pass to the linked resource. -description | string | a description of the link, supports GFM. +description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. Locating a linked resource may be performed by either a `href` or `operationId`. In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. From 3587914943e1d71c1bd40831cd3940facbdf6d4e Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 9 Sep 2016 22:23:57 -0400 Subject: [PATCH 0076/1801] Split sentences into lines for better diffing --- versions/3.0.md | 163 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 114 insertions(+), 49 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6dc8ec03f4..32a373053a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -10,7 +10,9 @@ The OpenAPI Specification is licensed under [The Apache License, Version 2.0](ht The OpenAPI Specification is a project used to describe and document RESTful APIs. -The OpenAPI Specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. +The OpenAPI Specification defines a set of files required to describe such an API. +These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. +Additional utilities can also take advantage of the resulting files, such as testing tools. ## Revision History @@ -28,7 +30,8 @@ Version | Date | Notes Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. ##### Media Types -Media type definitions are spread across several resources. The media type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). +Media type definitions are spread across several resources. +The media type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). Some examples of possible media type definitions: ``` @@ -44,14 +47,15 @@ Some examples of possible media type definitions: application/vnd.github.v3.patch ``` ##### HTTP Status Codes -The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are described by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). ## Specification ### Format -The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a OAS (OpenAPI Specification) file. +The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. +YAML, being a superset of JSON, can be used as well to represent a OAS (OpenAPI Specification) file. For example, if a field is said to have an array value, the JSON array representation will be used: @@ -65,7 +69,9 @@ While the API is described using JSON it does not impose a JSON input/output to All field names in the specification are **case sensitive**. -The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name. +The schema exposes two types of fields. +Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. +Patterned fields can have multiple occurrences as long as each has a unique name. In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: @@ -74,17 +80,25 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA ### File Structure -The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. +The OAS representation of the API is made of a single file. +However, parts of the definitions can be split into separate files, at the discretion of the user. +This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or `openapi.yaml`. ### Data Types -Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. +Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). +Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file. -Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the OAS are: +Primitives have an optional modifier property `format`. +OAS uses several known formats to more finely define the data type being used. +However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. +Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification +Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). +The formats defined by the OAS are: Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments @@ -105,13 +119,14 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur #### OpenAPI Object -This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. +This is the root document object for the API specification. +It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. consumes | [`string`] | A list of media types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). @@ -131,7 +146,8 @@ Field Pattern | Type | Description #### Info Object -The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. +The object provides metadata about the API. +The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. ##### Fixed Fields @@ -263,7 +279,8 @@ url: http://www.apache.org/licenses/LICENSE-2.0.html #### Components Object -Holds a set of schemas for different aspects of the OAS. The intention is to put reusable components into a single location, allowing reuse from this and other OAS documents. +Holds a set of schemas for different aspects of the OAS. +The intention is to put reusable components into a single location, allowing reuse from this and other OAS documents. ##### Fixed Fields @@ -278,7 +295,8 @@ Field Pattern | Type | Description #### Paths Object -Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. +Holds the relative paths to the individual endpoints. +The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. The Paths may be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields @@ -332,7 +350,8 @@ Field Pattern | Type | Description #### Path Item Object Describes the operations available on a single path. -A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. +A Path Item may be empty, due to [ACL constraints](#securityFiltering). +The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. ##### Fixed Fields @@ -612,7 +631,8 @@ There are five possible parameter types. * Cookie - Used to pass a specific cookie value to the API. -For complex parameter schemas, a serialization strategy is required. For all types, a serialization strategy must be declared. +For complex parameter schemas, a serialization strategy is required. +For all types, a serialization strategy must be declared. ##### Fixed Fields Field Name | Type | Description @@ -819,7 +839,8 @@ schema: #### Items Object -A limited subset of JSON-Schema's items object. It is used by parameter definitions. +A limited subset of JSON-Schema's items object. +It is used by parameter definitions. ##### Fixed Fields Field Name | Type | Description @@ -887,7 +908,10 @@ items: #### Responses Object -A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. +A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response. +It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. +However, it is expected from the documentation to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. @@ -896,7 +920,9 @@ The `Responses Object` MUST contain at least one response code, and it SHOULD be ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. +default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. +It can be used to cover undeclared responses. +[Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. ##### Patterned Fields Field Pattern | Type | Description @@ -1126,7 +1152,8 @@ application/json: ``` #### Links Object -The links object represents a set of possible design-time links for a response. The presence of a link does not guarantee the caller's ability to successfully call invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. +The links object represents a set of possible design-time links for a response. +The presence of a link does not guarantee the caller's ability to successfully call invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. As opposed to _dynamic_ links--that is, links provided **in** the response payload, the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. @@ -1138,7 +1165,8 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the definitions name. The link shall reference a single Link Object, or a JSON Reference to a single link object +link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the definitions name. +The link shall reference a single Link Object, or a JSON Reference to a single link object ### Link Object @@ -1153,11 +1181,15 @@ headers | Link Headers Object | an Object representing headers to pass to description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. -Locating a linked resource may be performed by either a `href` or `operationId`. In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. +Locating a linked resource may be performed by either a `href` or `operationId`. +In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. #### Response Payload Values -Payload values are only available in parseable response payloads which match the advertised media-type. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. +Payload values are only available in parseable response payloads which match the advertised media-type. +In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. +In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. ### Example @@ -1178,7 +1210,8 @@ lastname: Williams missingValue: null ``` -In situations where variables appear in an array, an array of variables will be extracted. For example: +In situations where variables appear in an array, an array of variables will be extracted. +For example: ```json [ @@ -1198,7 +1231,8 @@ The variables generated can be used in locations prescribed by the definition. ### Variable substitution -In all cases, _variables_ from request and responses may be substituted for link generation. The table below designates the source of the substitution value and the syntax for accessing it: +In all cases, _variables_ from request and responses may be substituted for link generation. +The table below designates the source of the substitution value and the syntax for accessing it: Source Location | reference identifier | example value | example reference | notes ---|:---|:---|:---|:--- @@ -1210,7 +1244,9 @@ Request URL | `$url` | `/track?url={$url}` | Response value | `$response` | `{$response.uuid}` | Only the payload in the response can be accessed with the `$response` syntax Response header | `$responseHeader` | `{$responseHeader.Server}` | Single header values only are available. -From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. For responses, the response payload may be used with the `$response` syntax. For both requests and responses, values will be substituted in the link in sections designated with the `$request` or `$response` keyword, surrounded by curly brackets `{}`. +From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. +For responses, the response payload may be used with the `$response` syntax. +For both requests and responses, values will be substituted in the link in sections designated with the `$request` or `$response` keyword, surrounded by curly brackets `{}`. ### Request parameter example Computing a link from a request operation like such: @@ -1243,7 +1279,8 @@ Addresses: href: '/users/{$request.id}/department' ``` -Where the `$request.id` is the value passed in the request to `/users/{id}`. For a `id` value of `10101110`, the generated link would be: +Where the `$request.id` is the value passed in the request to `/users/{id}`. +For a `id` value of `10101110`, the generated link would be: ```yaml href: '/users/10101110/department' @@ -1485,9 +1522,11 @@ components: ### Link Parameters -Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these may be dynamic depending on the response itself. +Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. +Many operations require parameters to be passed, and these may be dynamic depending on the response itself. -To specify parameters required by the operation, we can use a **Link Parameters Object**. This object contains parameter names along with static or dynamic valus: +To specify parameters required by the operation, we can use a **Link Parameters Object**. +This object contains parameter names along with static or dynamic valus: ```yaml paths: @@ -1563,7 +1602,8 @@ type: integer #### Tag Object -Allows adding meta data to a single tag that is used by the [Operation Object](#operationObject). It is not mandatory to have a Tag Object per tag used there. +Allows adding meta data to a single tag that is used by the [Operation Object](#operationObject). +It is not mandatory to have a Tag Object per tag used there. ##### Fixed Fields Field Name | Type | Description @@ -1593,11 +1633,13 @@ description: Pets operations #### Examples Object -Anywhere an `example` may be given, allow a $ref object. This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`. +Anywhere an `example` may be given, allow a $ref object. +This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`. In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling Specifications may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. +Tooling Specifications may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model @@ -1644,9 +1686,11 @@ definitions: #### Reference Object -A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. +A simple object to allow referencing other definitions in the specification. +It can be used to reference parameters and responses that are defined at the top level for reuse. -The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported. +The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. +For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported. ##### Fixed Fields Field Name | Type | Description @@ -1689,9 +1733,13 @@ $ref: 'definitions.yaml#/Pet' #### Schema Object -The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. +The Schema Object allows the definition of input and output data types. +These types can be objects, but also primitives and arrays. +This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. +On top of this subset, there are extensions provided by this specification to allow for more complete documentation. -Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. +Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). +Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. The following properties are taken directly from the JSON Schema definition and follow the same specifications: - $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) @@ -1716,7 +1764,8 @@ The following properties are taken directly from the JSON Schema definition and - enum - type -The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. +Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. - items - allOf - properties @@ -1742,13 +1791,20 @@ Field Pattern | Type | Description ###### Composition and Inheritance (Polymorphism) -The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. +The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. +`allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. -While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the `definitions` property. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. +While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field. +When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. +As such, the `discriminator` field MUST be a required field. +The value of the chosen property has to be the friendly name given to the model under the `definitions` property. +As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. ###### XML Modeling -The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. The [XML Object](#xmlObject) contains additional information about the available options. +The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. +The [XML Object](#xmlObject) contains additional information about the available options. ##### Schema Object Examples @@ -2076,7 +2132,8 @@ definitions: A metadata object that allows for more fine-tuned XML model definitions. -When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property should be used to add that information. See examples for expected behavior. +When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property should be used to add that information. +See examples for expected behavior. ##### Fixed Fields Field Name | Type | Description @@ -2430,13 +2487,15 @@ animals: #### Definitions Object -An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models. +An object to hold data types that can be consumed and produced by operations. +These data types can be primitives, arrays or models. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. +{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. +The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. Examples: @@ -2501,7 +2560,8 @@ Tag: #### Parameters Definitions Object -An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. +An object to hold parameters to be reused across operations. +Parameter definitions can be referenced to the ones defined here. This does *not* define global operation parameters. @@ -2554,7 +2614,8 @@ limitParam: #### Responses Definitions Object -An object to hold responses to be reused across operations. Response definitions can be referenced to the ones defined here. +An object to hold responses to be reused across operations. +Response definitions can be referenced to the ones defined here. This does *not* define global operation responses. @@ -2596,7 +2657,8 @@ GeneralError: #### Security Definitions Object -A declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme. +A declaration of the security schemes available to be used in the specification. +This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme. ##### Patterned Fields Field Pattern | Type | Description @@ -2640,7 +2702,8 @@ petstore_auth: #### Security Scheme Object -Allows the definition of a security scheme that can be used by the operations. Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). +Allows the definition of a security scheme that can be used by the operations. +Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). ##### Fixed Fields Field Name | Type | Validity | Description @@ -2745,7 +2808,8 @@ read:pets: read your pets #### Security Requirement Object -Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes). +Lists the required security schemes to execute this operation. +The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes). The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#securityDefinitionsObject). @@ -2798,7 +2862,8 @@ The extensions may or may not be supported by the available tooling, but those m Some objects in the OpenAPI Specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. -The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization. +The reasoning behind it is to allow an additional layer of access control over the documentation itself. +While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization. Two examples for this: From 557b64120af81983746e88175e2fd7e40b8a58ab Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 9 Sep 2016 22:41:58 -0400 Subject: [PATCH 0077/1801] Fixed issues mentioned in comments --- versions/3.0.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d838a9f8de..c52779cc90 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -297,12 +297,12 @@ Field Pattern | Type | Description "description": "A list of pets.", "representations" : { "application/json" : { - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/pet" - } - } + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/pet" + } + } } } } @@ -384,9 +384,9 @@ Field Pattern | Type | Description "representations": { "text/html" : { "schema": { - "$ref": "#/definitions/ErrorModel" - } + "$ref": "#/definitions/ErrorModel" } + } } } } @@ -490,6 +490,7 @@ Field Pattern | Type | Description "representations" : { "application/x-www-form-urlencoded":{ "schema" : { + "type" : "object", "properties": { "name" "description" : "Updated name of the pet", From 6bbdb88e1fbf3ab1c49eee8d41aa8ae5c5f7f111 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 9 Sep 2016 23:06:24 -0400 Subject: [PATCH 0078/1801] Renamed representations to content --- versions/3.0.md | 101 ++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 57470b6806..854430014c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -295,7 +295,7 @@ Field Pattern | Type | Description "responses": { "200": { "description": "A list of pets.", - "representations" : { + "content" : { "application/json" : { "schema": { "type": "array", @@ -319,7 +319,7 @@ Field Pattern | Type | Description responses: '200': description: A list of pets. - representations: + content: 'application/json': schema: type: array @@ -368,7 +368,7 @@ Field Pattern | Type | Description "responses": { "200": { "description": "pet response", - "representations": { + "content": { "application/json" : { "schema": { "type": "array", @@ -381,7 +381,7 @@ Field Pattern | Type | Description }, "default": { "description": "error payload", - "representations": { + "content": { "text/html" : { "schema": { "$ref": "#/definitions/ErrorModel" @@ -415,7 +415,7 @@ get: responses: '200': description: pet response - representations: + content: 'application/json': schema: type: array @@ -423,7 +423,7 @@ get: $ref: '#/definitions/Pet' default: description: error payload - representations: + content: 'text/html': schema: $ref: '#/definitions/ErrorModel' @@ -487,7 +487,7 @@ Field Pattern | Type | Description } ], "requestBody" : { - "representations" : { + "content" : { "application/x-www-form-urlencoded":{ "schema" : { "type" : "object", @@ -507,14 +507,14 @@ Field Pattern | Type | Description "responses": { "200": { "description": "Pet updated.", - "representations" : { + "content" : { "application/json" : {}, "application/xml" : {} } }, "405": { "description": "Invalid input", - "representations" : { + "content" : { "application/json" : {}, "application/xml" : {} } @@ -544,7 +544,7 @@ parameters: required: true type: string responseBody: - representations: + content: 'application/x-www-form-urlencoded': schema: properties: @@ -559,12 +559,12 @@ responseBody: responses: '200': description: Pet updated. - representations: + content: 'application/json': {} 'application/xml': {} '405': description: Invalid input - representations: + content: 'application/json': {} 'application/xml': {} security: @@ -624,13 +624,8 @@ For complex parameter schemas, a serialization strategy is required. For all typ Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-<<<<<<< HEAD -in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". -description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. -======= in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. ->>>>>>> OpenAPI.next required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. @@ -753,13 +748,11 @@ schema: Describes a single request body. -The `Content-Type` of the request body must be specified by the `consumes` attribute, either at the [top-level](#oasConsumes) or [operation level](#operationConsumes). - ##### Fixed Fields Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -representations | [Representations Object](#representationsObject) | The representations of the request body. +content | [Content Object](#contentObject) | The content of the request body. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -775,7 +768,7 @@ A request body with a referenced model definition. ```js { "description": "user to add to the system", - "representations" : { + "content" : { "application/json" : { "schema": { "$ref": "#/definitions/User" @@ -800,7 +793,7 @@ A request body with a referenced model definition. ```yaml description: user to add to the system -representations: +content: 'application/json': schema: $ref: '#/definitions/User' @@ -818,7 +811,7 @@ A body parameter that is an array of string values: ```js { "description": "user to add to the system", - "representations": { + "content": { "application/json" : { "schema": { "type": "array", @@ -834,7 +827,7 @@ A body parameter that is an array of string values: ```yaml description: user to add to the system required: true -representations: +content: 'application/json': schema: type: array @@ -843,16 +836,16 @@ representations: ``` -#### Representations Object +#### Content Object -Describes a set of supported representations. A representations object can be used in [requestBody](#requestBody) and [response objects](#responseObject). +Describes a set of supported content types. A content object can be used in [requestBody](#requestBody) and [response objects](#responseObject). -Each key in the representations object is the media-type of the [Representation Object](#representationObject). +Each key in the content object is the media-type of the [Content Type Object](#contentTypeObject). -##### Representations Examples +##### Content Examples ```js -"representations" : { +"content" : { "application/json": { "schema": { "type": "array", @@ -879,7 +872,7 @@ Each key in the representations object is the media-type of the [Representation ``` ```yaml -representations: +content: 'application/json': schema: type: array @@ -902,23 +895,23 @@ representations: - "Bob,Diane,Mary,Bill" ``` -#### Representation Object -The representation object provides schema and examples for a the media type identified by its key. Representation objects can be used in a [representations object](#representationsObject). +#### Content Type Object +Each content type object provides schema and examples for a the media type identified by its key. Content Type objects can be used in a [content object](#contentObject). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the representation. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +examples | [Examples Array](#examplesArray) | Examples of the content type. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. -##### Representation Examples +##### Content Type Examples -A representation description. +A content type description. ```js { "application/json": { @@ -1046,7 +1039,7 @@ A 200 response for successful operation and a default response for others (imply { "200": { "description": "a pet to be returned", - "representations" : { + "content" : { "application/json" : { "schema": { "$ref": "#/definitions/Pet" @@ -1056,7 +1049,7 @@ A 200 response for successful operation and a default response for others (imply }, "default": { "description": "Unexpected error", - "representations" : { + "content" : { "application/json" : { "schema": { "$ref": "#/definitions/ErrorModel" @@ -1070,13 +1063,13 @@ A 200 response for successful operation and a default response for others (imply ```yaml '200': description: a pet to be returned - representations: + content: 'application/json': schema: $ref: '#/definitions/Pet' default: description: Unexpected error - representations: + content: 'application/json': schema: $ref: '#/definitions/ErrorModel' @@ -1090,7 +1083,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. -representations | [Representations Object](#representationsObject) | An object containing descriptions of potential response payloads. +content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. @@ -1107,7 +1100,7 @@ Response of an array of a complex type: ```js { "description": "A complex object array response", - "representations" : { + "content" : { "application/json" : { "schema": { "type": "array", @@ -1122,7 +1115,7 @@ Response of an array of a complex type: ```yaml description: A complex object array response -representations: +content: 'application/json': schema: type: array @@ -1135,7 +1128,7 @@ Response with a string type: ```js { "description": "A simple string response", - "representations" : { + "content" : { "application/json" : { "schema": { "type": "string" @@ -1157,7 +1150,7 @@ Response with headers: ```js { "description": "A simple string response", - "representations" : { + "content" : { "application/json" : { "schema": { "type": "string" @@ -1183,7 +1176,7 @@ Response with headers: ```yaml description: A simple string response -representations: +content: 'application/json': schema: type: string @@ -1389,7 +1382,7 @@ paths: responses: 200: description: the user being returned - representations: + content: 'application/json': schema: type: object @@ -1461,7 +1454,7 @@ paths: responses: 200: description: The User - representations: + content: 'application/json': schema: $ref: '#/components/definitions/user' @@ -1479,7 +1472,7 @@ paths: responses: 200: description: repositories owned by the supplied user - representations: + content: 'application/json': schema: type: array @@ -1503,7 +1496,7 @@ paths: responses: 200: description: The repository - representations: + content: 'application/json': schema: $ref: '#/components/definitions/repository' @@ -1532,7 +1525,7 @@ paths: responses: 200: description: an array of pull request objects - representations: + content: 'application/json': schema: type: array @@ -1557,7 +1550,7 @@ paths: responses: 200: description: a pull request object - representations: + content: 'application/json': schema: $ref: '#/components/definitions/pullrequest' @@ -1783,7 +1776,7 @@ definitions: # in a request body, note the plural `examples` as the content-type is set by `consumes`: requestBody: - representations: + content: 'application/json': schema: $ref: '#/definitions/Address' @@ -1813,7 +1806,7 @@ definitions: responses: 200: description: your car appointment has been booked - representations: + content: 'application/json': schema: $ref: '#/definitions/SuccessResponse' From 5aeb8b94eb06e028b5310fe6d75362abb464c6ed Mon Sep 17 00:00:00 2001 From: Erik Wilde Date: Mon, 4 Jul 2016 12:14:27 +0200 Subject: [PATCH 0079/1801] tweak HTTP status code language --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 32a373053a..2b6a98e1e4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -47,8 +47,7 @@ Some examples of possible media type definitions: application/vnd.github.v3.patch ``` ##### HTTP Status Codes -The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are described by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are initially defined by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). ## Specification From d2906f67998a6950a05aa2b392fcf7bb53e6b399 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 19 Sep 2016 14:37:43 -0700 Subject: [PATCH 0080/1801] Jason is no longer 'n Austin --- CONTRIBUTORS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6043c58832..5a5ab82e15 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,6 +1,6 @@ * Darrel Miller [@darrelmiller](https://github.com/darrelmiller) -* Jason Harmon [@jasonh-n-austin](https://github.com/jasonh-n-austin) +* Jason Harmon [@jharmn](https://github.com/jharmn) * Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) * Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) * Ron Ratovsky [@webron](https://github.com/webron) -* Tony Tam [@fehguy](https://github.com/fehguy) \ No newline at end of file +* Tony Tam [@fehguy](https://github.com/fehguy) From 5e939f7437829de698fc38eff2c6b590d241e462 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 22 Sep 2016 16:49:11 +0100 Subject: [PATCH 0081/1801] Typo fixes --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2b6a98e1e4..dcaaeb57db 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -95,7 +95,7 @@ An additional primitive data type `"file"` is used by the [Parameter Object](#pa Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. -Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification +Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the OAS are: @@ -1525,7 +1525,7 @@ Using the `operationId` to reference an operation in the definition has many ben Many operations require parameters to be passed, and these may be dynamic depending on the response itself. To specify parameters required by the operation, we can use a **Link Parameters Object**. -This object contains parameter names along with static or dynamic valus: +This object contains parameter names along with static or dynamic values: ```yaml paths: @@ -1638,7 +1638,7 @@ This does mean that `example`, structurally, can be either a string primitive or In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. -Tooling Specifications may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible. +Tooling Specifications may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. ```yaml # in a model From f82d0a12c81da01eef4f7cd572226343c240726a Mon Sep 17 00:00:00 2001 From: it33 Date: Wed, 28 Sep 2016 21:50:09 -0700 Subject: [PATCH 0082/1801] Hyphenate adjective Sorry, total nit, if "Swagger-specific" is a term describing "annotations", maybe it's easier to read with a hyphen? I don't think what's there is wrong, I was just scanning this document and got tripped up over "The Swagger specific annotations...", so if I tripped, maybe others will too. Just a thought. Overall, love the project! --- guidelines/EXTENSIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guidelines/EXTENSIONS.md b/guidelines/EXTENSIONS.md index c0ead4be21..be10b14984 100644 --- a/guidelines/EXTENSIONS.md +++ b/guidelines/EXTENSIONS.md @@ -89,4 +89,4 @@ An API consumer reading these parameter definitions could interpret this as havi ## Annotations -The Swagger specific annotations currently available for jax-rs APIs do not support the addition of extension data. +The Swagger-specific annotations currently available for jax-rs APIs do not support the addition of extension data. From 650000a84424b3a3c7ae8f375e0774210299daa3 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 28 Sep 2016 23:19:33 -0700 Subject: [PATCH 0083/1801] updated #761 for naming consistency --- versions/3.0.md | 520 ++++++++++++++++++++++++++++-------------------- 1 file changed, 308 insertions(+), 212 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dcaaeb57db..6119777f95 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -58,7 +58,7 @@ YAML, being a superset of JSON, can be used as well to represent a OAS (OpenAPI For example, if a field is said to have an array value, the JSON array representation will be used: -```js +```json { "field" : [...] } @@ -128,8 +128,6 @@ Field Name | Type | Description openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. -consumes | [`string`] | A list of media types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). -produces | [`string`] | A list of media types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). responses | [Responses] paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. @@ -167,7 +165,7 @@ Field Pattern | Type | Description ##### Info Object Example: -```js +```json { "title": "Swagger Sample App", "description": "This is a sample server Petstore server.", @@ -231,7 +229,7 @@ Field Pattern | Type | Description ##### Contact Object Example: -```js +```json { "name": "API Support", "url": "http://www.swagger.io/support", @@ -264,7 +262,7 @@ Field Pattern | Type | Description ##### License Object Example: -```js +```json { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" @@ -307,21 +305,22 @@ Field Pattern | Type | Description ##### Paths Object Example -```js +```json { "/pets": { "get": { "description": "Returns all pets from the system that the user has access to", - "produces": [ - "application/json" - ], "responses": { "200": { "description": "A list of pets.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/pet" + "representations": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/pet" + } + } } } } @@ -335,15 +334,15 @@ Field Pattern | Type | Description /pets: get: description: Returns all pets from the system that the user has access to - produces: - - application/json responses: '200': description: A list of pets. - schema: - type: array - items: - $ref: '#/definitions/pet' + representations: + application/json: + schema: + type: array + items: + $ref: '#/definitions/pet' ``` #### Path Item Object @@ -379,30 +378,34 @@ Field Pattern | Type | Description ##### Path Item Object Example -```js +```json { "get": { "description": "Returns pets based on ID", "summary": "Find pets by ID", "operationId": "getPetsById", - "produces": [ - "application/json", - "text/html" - ], "responses": { "200": { "description": "pet response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" + "representations": { + "*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Pet" + } + } } } }, "default": { "description": "error payload", - "schema": { - "$ref": "#/definitions/ErrorModel" + "representations": { + "*": { + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } } } } @@ -428,20 +431,21 @@ get: description: Returns pets based on ID summary: Find pets by ID operationId: getPetsById - produces: - - application/json - - text/html responses: '200': description: pet response - schema: - type: array - items: - $ref: '#/definitions/Pet' + representations: + application/json: + schema: + type: array + items: + $ref: '#/definitions/Pet' default: description: error payload - schema: - $ref: '#/definitions/ErrorModel' + representations: + "*": + schema: + $ref: '#/definitions/ErrorModel' parameters: - name: id in: path @@ -466,8 +470,6 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). -produces | [`string`] | A list of media types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. @@ -486,7 +488,7 @@ Field Pattern | Type | Description ##### Operation Object Example -```js +```json { "tags": [ "pet" @@ -494,13 +496,6 @@ Field Pattern | Type | Description "summary": "Updates a pet in the store with form data", "description": "", "operationId": "updatePetWithForm", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/json", - "application/xml" - ], "parameters": [ { "name": "petId", @@ -549,11 +544,6 @@ tags: summary: Updates a pet in the store with form data description: "" operationId: updatePetWithForm -consumes: -- application/x-www-form-urlencoded -produces: -- application/json -- application/xml parameters: - name: petId in: path @@ -601,7 +591,7 @@ Field Pattern | Type | Description ##### External Documentation Object Example -```js +```json { "description": "Find more info here", "url": "https://swagger.io" @@ -623,7 +613,7 @@ There are five possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * Header - Custom headers that are expected as part of the request. -* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): +* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request representations. This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers. @@ -654,7 +644,7 @@ Field Pattern | Type | Description A header parameter with an array of 64 bit integer numbers: -```js +```json { "name": "token", "in": "header", @@ -685,7 +675,7 @@ schema: ``` A path parameter of a string value: -```js +```json { "name": "username", "in": "path", @@ -707,7 +697,7 @@ schema: ``` An optional query parameter of a string value, allowing multiple values by repeating the query parameter: -```js +```json { "name": "id", "in": "query", @@ -736,7 +726,7 @@ schema: ``` A form data with file type for a file upload: -```js +```json { "name": "avatar", "in": "formData", @@ -761,13 +751,10 @@ schema: Describes a single request body. -The `Content-Type` of the request body must be specified by the `consumes` attribute, either at the [top-level](#oasConsumes) or [operation level](#operationConsumes). - ##### Fixed Fields Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by media type. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. @@ -775,53 +762,72 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- +`*` | [Schema Object](#schemaObject) | The schema defining the request body. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. ##### Request Body Examples A request body with a referenced model definition. -```js +```json { "description": "user to add to the system", - "schema": { - "$ref": "#/definitions/User" - }, - "examples": { - "application/json": { - "$ref": 'http://foo.bar#/examples/address-example.json' - 'application/xml': - $ref: 'http://foo.bar#/examples/address-example.xml' - 'text/plain': - $ref: 'http://foo.bar#/examples/address-example.txt' - default: - $ref: 'http://foo.bar#/examples/address-example.whatever' + "representations": { + "application/json": { + "schema": { + "$ref": "#/definitions/User" + }, + "example": { + "$ref": "http://foo.bar#/examples/address-example.json" + } + }, + "application/xml": { + "schema": { + "$ref": "#/definitions/User" + }, + "example": { + "$ref": "http://foo.bar#/examples/address-example.xml" + } + }, + "*": { + "example": { + $ref: "http://foo.bar#/examples/address-example.whatever" + } + } + } } ``` ```yaml description: user to add to the system -schema: - $ref: '#/definitions/User' -examples: - 'application/json': - $ref: 'http://foo.bar/examples/user-example.json' - 'application/xml': - $ref: 'http://foo.bar/examples/user-example.xml' - 'text/plain': - $ref: 'http://foo.bar/examples/user-example.txt' - default: - $ref: 'http://foo.bar/examples/user-example.whatever' +representations: + 'application/json': + schema: + $ref: '#/definitions/User' + example: + $ref: 'http://foo.bar/examples/user-example.json' + 'application/xml': + schema: + $ref: '#/definitions/User' + example: + $ref: 'http://foo.bar/examples/user-example.xml' + '*': + schema: + $ref: 'http://foo.bar/examples/user-example.whatever' ``` A body parameter that is an array of string values: -```js +```json { "description": "user to add to the system", - "schema": { - "type": "array", - "items": { - "type": "string" + "representations": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } } } } @@ -830,10 +836,12 @@ A body parameter that is an array of string values: ```yaml description: user to add to the system required: true -schema: - type: array - items: - type: string +representations: + text/plain: + schema: + type: array + items: + type: string ``` #### Items Object @@ -872,7 +880,7 @@ Field Pattern | Type | Description Items must be of type string and have the minimum length of 2 characters: -```js +```json { "type": "string", "minLength": 2 @@ -886,14 +894,14 @@ minLength: 2 An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive): -```js +```json { - "type": "array", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 63 - } + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 63 + } } ``` @@ -926,7 +934,7 @@ It can be used to cover undeclared responses. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. @@ -934,18 +942,26 @@ Field Pattern | Type | Description A 200 response for successful operation and a default response for others (implying an error): -```js +```json { "200": { "description": "a pet to be returned", - "schema": { - "$ref": "#/definitions/Pet" + "representations": { + "application/json": { + "schema": { + "$ref": "#/definitions/Pet" + } + } } }, "default": { "description": "Unexpected error", - "schema": { - "$ref": "#/definitions/ErrorModel" + "representations": { + "application/json": { + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } } } } @@ -954,12 +970,16 @@ A 200 response for successful operation and a default response for others (imply ```yaml '200': description: a pet to be returned - schema: - $ref: '#/definitions/Pet' + representations: + application/json + schema: + $ref: '#/definitions/Pet' default: description: Unexpected error - schema: - $ref: '#/definitions/ErrorModel' + representations: + '*': + schema: + $ref: '#/definitions/ErrorModel' ``` #### Response Object @@ -969,7 +989,6 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` media type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. examples | [Example Object](#exampleObject) | An example of the response message. links | [Links Object](#linksObject) | An object representing operations related to the response payload. @@ -979,19 +998,26 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- +`*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +Representations may take the form of a wildcard (`*`) to designate any `Content-Type`, or a regular expression for matching a specific type + ##### Response Object Examples Response of an array of a complex type: -```js +```json { "description": "A complex object array response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/VeryComplexType" + "representations": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/VeryComplexType" + } + } } } } @@ -999,36 +1025,48 @@ Response of an array of a complex type: ```yaml description: A complex object array response -schema: - type: array - items: - $ref: '#/definitions/VeryComplexType' +representations: + application/json: + schema: + type: array + items: + $ref: '#/definitions/VeryComplexType' ``` Response with a string type: -```js +```json { "description": "A simple string response", - "schema": { - "type": "string" + "representations": { + "schema": { + "text/plain": { + "type": "string" + } + } } } ``` ```yaml description: A simple string response -schema: - type: string +representations: + text/plain: + schema: + type: string ``` Response with headers: -```js +```json { "description": "A simple string response", - "schema": { - "type": "string" + "representations": { + "text/plain": { + "schema": { + "type": "string" + } + } }, "headers": { "X-Rate-Limit-Limit": { @@ -1049,8 +1087,11 @@ Response with headers: ```yaml description: A simple string response -schema: - type: string +representations: + text/plain: + schema: + type: string + example: 'whoa!' headers: X-Rate-Limit-Limit: description: The number of allowed requests in the current period @@ -1065,7 +1106,7 @@ headers: Response with no return value: -```js +```json { "description": "object created" } @@ -1087,7 +1128,7 @@ Field Pattern | Type | Description Rate-limit headers: -```js +```json { "X-Rate-Limit-Limit": { "description": "The number of allowed requests in the current period", @@ -1129,7 +1170,7 @@ Field Pattern | Type | Description Example request or response for application/json media type of a Pet data type: -```js +```json { "application/json": { "name": "Puma", @@ -1214,9 +1255,9 @@ For example: ```json [ - { "color": "red" }, - { "color": "green" }, - { "color": "blue" } + { "color": "red" }, + { "color": "green" }, + { "color": "blue" } ] ``` @@ -1263,12 +1304,14 @@ paths: responses: 200: description: the user being returned - schema: - type: object - properties: - uuid: the unique user id - type: string - format: uuid + representations: + application/json: + schema: + type: object + properties: + uuid: the unique user id + type: string + format: uuid ``` Can be used in a link like this: @@ -1334,8 +1377,10 @@ paths: responses: 200: description: The User - schema: - $ref: '#/components/definitions/user' + representations: + application/json: + schema: + $ref: '#/components/definitions/user' links: userRepositories: $ref: '#/components/links/UserRepositories' @@ -1350,10 +1395,12 @@ paths: responses: 200: description: repositories owned by the supplied user - schema: - type: array - items: - $ref: '#/components/definitions/repository' + representations: + application/json: + schema: + type: array + items: + $ref: '#/components/definitions/repository' links: userRepository: $ref: '#/components/links/UserRepository' @@ -1372,8 +1419,10 @@ paths: responses: 200: description: The repository - schema: - $ref: '#/components/definitions/repository' + representations: + application/json: + schema: + $ref: '#/components/definitions/repository' links: repositoryPullRequests: $ref: '#/components/links/RepositoryPullRequests' @@ -1399,10 +1448,12 @@ paths: responses: 200: description: an array of pull request objects - schema: - type: array - items: - $ref: '#/components/definitions/pullrequest' + representations: + application/json: + schema: + type: array + items: + $ref: '#/components/definitions/pullrequest' /2.0/repositories/{username}/{slug}/pullrequests/{pid}: get: operationId: getPullRequestsById @@ -1422,8 +1473,10 @@ paths: responses: 200: description: a pull request object - schema: - $ref: '#/components/definitions/pullrequest' + representations: + application/json: + schema: + $ref: '#/components/definitions/pullrequest' links: $ref: '#/components/links/PullRequestMerge' /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: @@ -1587,7 +1640,7 @@ Field Pattern | Type | Description A simple header with of an integer type: -```js +```json { "description": "The number of allowed requests in the current period", "type": "integer" @@ -1618,7 +1671,7 @@ Field Pattern | Type | Description ##### Tag Object Example -```js +```json { "name": "pet", "description": "Pets operations" @@ -1649,19 +1702,15 @@ definitions: example: $ref: http://foo.bar#/examples/name-example -# in a request body, note the plural `examples` as the content-type is set by `consumes`: +# in a request body, note the plural `examples` as the content-type is set to `*`: requestBody: - schema: - $ref: '#/definitions/Address' - examples: - 'application/json': - $ref: 'http://foo.bar#/examples/address-example.json' - 'application/xml': - $ref: 'http://foo.bar#/examples/address-example.xml' - 'text/plain': - $ref: 'http://foo.bar#/examples/address-example.txt' - default: - $ref: 'http://foo.bar#/examples/address-example.whatever' + representations: + 'application/json': + schema: + $ref: '#/definitions/Address' + examples: + - {"foo": "bar"} + - {"bar": "baz"} # in a parameter @@ -1676,11 +1725,12 @@ definitions: responses: 200: description: your car appointment has been booked - schema: - $ref: '#/definitions/SuccessResponse' - examples: - 'application/json': - $ref: http://foo.bar#/examples/address-example.json + representations: + application/json: + schema: + $ref: '#/definitions/SuccessResponse' + example: + $ref: http://foo.bar#/examples/address-example.json ``` #### Reference Object @@ -1698,7 +1748,7 @@ Field Name | Type | Description ##### Reference Object Example -```js +```json { "$ref": "#/definitions/Pet" } @@ -1709,7 +1759,7 @@ $ref: '#/definitions/Pet' ``` ##### Relative Schema File Example -```js +```json { "$ref": "Pet.json" } @@ -1720,7 +1770,7 @@ $ref: 'Pet.yaml' ``` ##### Relative Files With Embedded Schema Example -```js +```json { "$ref": "definitions.json#/Pet" } @@ -1780,6 +1830,7 @@ Field Name | Type | Description xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. +examples | Any | An array of free-formed properties to include examples for this schema. deprecated | `boolean` | Specifies that a schema is deprecated and should be transitioned out of usage. ##### Patterned Objects @@ -1811,10 +1862,10 @@ The [XML Object](#xmlObject) contains additional information about the available Unlike previous versions of Swagger, OpenAPI Schema definitions can be used to describe primitive and arrays as well. -```js +```json { - "type": "string", - "format": "email" + "type": "string", + "format": "email" } ``` @@ -1825,7 +1876,7 @@ format: email ###### Simple Model -```js +```json { "type": "object", "required": [ @@ -1866,7 +1917,7 @@ properties: For a simple string to string mapping: -```js +```json { "type": "object", "additionalProperties": { @@ -1883,7 +1934,7 @@ additionalProperties: For a string to model mapping: -```js +```json { "type": "object", "additionalProperties": { @@ -1900,7 +1951,7 @@ additionalProperties: ###### Model with Example -```js +```json { "type": "object", "properties": { @@ -1937,9 +1988,54 @@ example: id: 1 ``` +###### Model with Examples + +```json +{ + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "examples": [ + { + "name": "Puma", + "id": 1 + }, { + "name": "Ferguson", + "id": 2 + }] +} +``` + +```yaml +type: object +properties: + id: + type: integer + format: int64 + name: + type: string +required: +- name +examples: + - name: Puma + id: 1 + - name: Ferguson + id: 2 +``` + ###### Models with Composition -```js +```json { "definitions": { "ErrorModel": { @@ -2008,7 +2104,7 @@ definitions: ###### Models with Polymorphism Support -```js +```json { "definitions": { "Pet": { @@ -2157,7 +2253,7 @@ The examples of the XML object definitions are included inside a property defini Basic string property: -```js +```json { "animals": { "type": "string" @@ -2176,7 +2272,7 @@ animals: Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default): -```js +```json { "animals": { "type": "array", @@ -2202,7 +2298,7 @@ animals: ###### XML Name Replacement -```js +```json { "animals": { "type": "string", @@ -2229,7 +2325,7 @@ animals: In this example, a full model definition is shown. -```js +```json { "Person": { "type": "object", @@ -2279,7 +2375,7 @@ Person: Changing the element names: -```js +```json { "animals": { "type": "array", @@ -2309,7 +2405,7 @@ animals: The external `name` property has no effect on the XML: -```js +```json { "animals": { "type": "array", @@ -2344,7 +2440,7 @@ animals: Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally: -```js +```json { "animals": { "type": "array", @@ -2376,7 +2472,7 @@ animals: To overcome the above example, the following definition can be used: -```js +```json { "animals": { "type": "array", @@ -2413,7 +2509,7 @@ animals: Affecting both internal and external names: -```js +```json { "animals": { "type": "array", @@ -2452,7 +2548,7 @@ animals: If we change the external element but not the internal ones: -```js +```json { "animals": { "type": "array", @@ -2509,7 +2605,7 @@ my\org\User ##### Definitions Object Example -```js +```json { "Category": { "type": "object", @@ -2572,7 +2668,7 @@ Field Pattern | Type | Description ##### Parameters Definition Object Example -```js +```json { "skipParam": { "name": "skip", @@ -2626,7 +2722,7 @@ Field Pattern | Type | Description ##### Responses Definitions Object Example -```js +```json { "NotFound": { "description": "Entity not found." @@ -2666,7 +2762,7 @@ Field Pattern | Type | Description ##### Security Definitions Object Example -```js +```json { "api_key": { "type": "apiKey", @@ -2726,7 +2822,7 @@ Field Name | Type | Description ###### Basic Authentication Sample -```js +```json { "type": "basic" } @@ -2738,7 +2834,7 @@ type: basic ###### API Key Sample -```js +```json { "type": "apiKey", "name": "api_key", @@ -2754,7 +2850,7 @@ in: header ###### Implicit OAuth2 Sample -```js +```json { "type": "oauth2", "authorizationUrl": "http://swagger.io/api/oauth/dialog", @@ -2793,7 +2889,7 @@ Field Pattern | Type | Description ##### Scopes Object Example -```js +```json { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -2822,7 +2918,7 @@ Field Pattern | Type | Description ###### Non-OAuth2 Security Requirement -```js +```json { "api_key": [] } @@ -2834,7 +2930,7 @@ api_key: [] ###### OAuth2 Security Requirement -```js +```json { "petstore_auth": [ "write:pets", From fb50e3f7f07d0049cfa8c094143154f73405408e Mon Sep 17 00:00:00 2001 From: Dan Brubaker Horst Date: Thu, 29 Sep 2016 11:01:31 -0400 Subject: [PATCH 0084/1801] The URL for Github Flavored Markdown documentation changed This feature seemed to be the best analog to the previous page: https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown --- versions/2.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/2.0.md b/versions/2.0.md index 2428b65527..2c638ce9c4 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -137,7 +137,7 @@ The object provides metadata about the API. The metadata can be used by the clie Field Name | Type | Description ---|:---:|--- title | `string` | **Required.** The title of the application. -description | `string` | A short description of the application. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description of the application. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. termsOfService | `string` | The Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. @@ -412,7 +412,7 @@ Field Name | Type | Description ---|:---:|--- tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. summary | `string` | A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. -description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#swaggerConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). @@ -535,7 +535,7 @@ Allows referencing an external resource for extended documentation. Field Name | Type | Description ---|:---:|--- -description | `string` | A short description of the target documentation. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description of the target documentation. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL. ##### Patterned Objects @@ -578,7 +578,7 @@ Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "body". -description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. If [`in`](#parameterIn) is `"body"`: @@ -891,7 +891,7 @@ Describes a single response from an API Operation. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | **Required.** A short description of the response. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. examples | [Example Object](#exampleObject) | An example of the response message. @@ -1124,7 +1124,7 @@ Allows adding meta data to a single tag that is used by the [Operation Object](# Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the tag. -description | `string` | A short description for the tag. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation. +description | `string` | A short description for the tag. [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. ##### Patterned Fields @@ -1201,7 +1201,7 @@ The following properties are taken directly from the JSON Schema definition and - $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) - format (See [Data Type Formats](#dataTypeFormat) for further details) - title -- description ([GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation) +- description ([GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) can be used for rich text representation) - default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) - multipleOf - maximum From 3579304ca2c8bb97d831a66e984c559060977163 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Thu, 29 Sep 2016 17:37:16 -0700 Subject: [PATCH 0085/1801] [ToC] Add Table of Contents Signed-off-by: Rob Dolin --- versions/3.0.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9acd51bc98..7d8748edda 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -14,6 +14,20 @@ The OpenAPI Specification defines a set of files required to describe such an AP These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. +## Table of Contents + + +- [OpenAPI Specification](#openapi-specification) +- [Introduction](#introduction) +- [Table of Contents](#table-of-contents) +- [Revision History](#revision-history) +- [Definitions](#definitions) +- [Specification](#specification) + - [Format](#format) + - [File Structure](#file-structure) + + + ## Revision History Version | Date | Notes From 70ecbf67b46392d7c3e1824cbb7724ac7f37938b Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Thu, 29 Sep 2016 17:57:40 -0700 Subject: [PATCH 0086/1801] [ToC] Add more to Table of Contents Signed-off-by: Rob Dolin --- versions/3.0.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 7d8748edda..2d6458f513 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -25,6 +25,21 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Specification](#specification) - [Format](#format) - [File Structure](#file-structure) + - [Data Types](#data-types) + - [Schema](#schema) + - [OpenAPI Object](#openapi-object) + - [Info Object](#info-object) + - [Host Object](#host-object) + - [Contact Object](#contact-object) + - [License Object](#license-object) + - [Components Object](#components-object) + - [Paths Object](#paths-object) + ... + ... + - [Security Scheme Object](#security-scheme-object) + - [Specification Extensions](#specification-extensions) + - [Security Filtering](#security-filtering) + From c7c343c0229e3c178cde192daa7a0c5a984d517f Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 30 Sep 2016 13:49:55 +0100 Subject: [PATCH 0087/1801] Remove merge conflict header --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9acd51bc98..fd78bb9c95 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1302,7 +1302,6 @@ Field Pattern | Type | Description Example representation for application/json media type of a Pet data type: -<<<<<<< HEAD ```json [ { From 9952f5a19d42efac243c968b9414d0fbd9d599bd Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 30 Sep 2016 11:04:20 -0400 Subject: [PATCH 0088/1801] URI Template support in parameters --- versions/3.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9acd51bc98..ccbfc013e2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -647,6 +647,9 @@ Field Name | Type | Description required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. +escape | `boolean` | Determines whether the parameter value should have unallowed characters percent-encoded based the parameter location. The default value is `true`. +style | `string` | Determines rendering rules based on [RFC 6570](https://tools.ietf.org/html/rfc6570). Valid values include "matrix", "label", "segment", "simple". The style is only used when `in` has the value `path`. "matrix" refers to what RFC6570 calls "path-style". Default value is "simple". +explode | `boolean` | Indicates if the parameter values should rendered using the rules of the explode operator as defined in [RFC 6570](https://tools.ietf.org/html/rfc6570#section-2.2). Default value is `false`. ##### Patterned Fields From 0cb670884cb60490fd8034e4ad59b934edfa746d Mon Sep 17 00:00:00 2001 From: Darrel Date: Sun, 2 Oct 2016 19:36:14 -0400 Subject: [PATCH 0089/1801] Reorganized the Specification Extension references --- versions/3.0.md | 110 +++++++++++++----------------------------------- 1 file changed, 30 insertions(+), 80 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index f7761d43c4..355adbf01b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -134,11 +134,7 @@ Field Name | Type | Description tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OAS Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). #### Info Object @@ -156,11 +152,7 @@ Field Name | Type | Description license | [License Object](#licenseObject) | The license information for the exposed API. version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Info Object Example: @@ -220,11 +212,7 @@ Field Name | Type | Description url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Contact Object Example: @@ -253,11 +241,7 @@ Field Name | Type | Description name | `string` | **Required.** The license name used for the API. url | `string` | A URL to the license used for the API. MUST be in the format of a URL. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### License Object Example: @@ -300,7 +284,8 @@ The Paths may be empty, due to [ACL constraints](#securityFiltering). Field Pattern | Type | Description ---|:---:|--- /{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. + +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Paths Object Example @@ -369,11 +354,8 @@ Field Name | Type | Description schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Path Item Object Example @@ -480,11 +462,7 @@ Field Name | Type | Description basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) or path item-level [basePath](#oasPathItemBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) or path-item level [schemes](#pathItemSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Operation Object Example @@ -604,11 +582,7 @@ Field Name | Type | Description description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### External Documentation Object Example @@ -649,12 +623,7 @@ Field Name | Type | Description deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. - +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Parameter Object Examples @@ -1002,11 +971,7 @@ Field Name | Type | Description enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Items Object Examples @@ -1067,9 +1032,10 @@ It can be used to cover undeclared responses. Field Pattern | Type | Description ---|:---:|--- [HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). + ##### Responses Object Example A 200 response for successful operation and a default response for others (implying an error): @@ -1131,10 +1097,11 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- `*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. Representations may take the form of a wildcard (`*`) to designate any `Content-Type`, or a regular expression for matching a specific type +This object can be extended with [Specification Extensions](#specificationExtensions). + ##### Response Object Examples Response of an array of a complex type: @@ -1257,7 +1224,8 @@ A container for possible out-of band callbacks from an operation. A callback may Field Pattern | Type | Description ---|:---:|--- Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback payload structure -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. + +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Callback Object Example @@ -1382,7 +1350,8 @@ operationId | string | the name of an _existing_, resolvable OAS operation, as d parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | Link Headers Object | an Object representing headers to pass to the linked resource. description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. + +This object can be extended with [Specification Extensions](#specificationExtensions). Locating a linked resource may be performed by either a `href` or `operationId`. In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. @@ -1793,11 +1762,7 @@ Field Name | Type | Description enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Header Object Example @@ -1827,10 +1792,7 @@ Field Name | Type | Description description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Tag Object Example @@ -2004,11 +1966,7 @@ Field Name | Type | Description examples | Any | An array of free-formed properties to include examples for this schema. deprecated | `boolean` | Specifies that a schema is deprecated and should be transitioned out of usage. -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ###### Composition and Inheritance (Polymorphism) @@ -2410,11 +2368,7 @@ Field Name | Type | Description attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### XML Object Examples @@ -2983,11 +2937,7 @@ Field Name | Type | Validity | Description tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. -##### Patterned Fields - -Field Name | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Security Scheme Object Example @@ -3052,11 +3002,7 @@ Field Pattern | Type | Description ---|:---:|--- {name} | `string` | Maps between a name of a scope to a short description of it (as the value of the property). -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Scopes Object Example @@ -3120,7 +3066,11 @@ petstore_auth: While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. -The extensions properties are always prefixed by `"x-"` and can have any valid JSON format value. +The extensions properties are implemented as patterned fields that are always prefixed by `"x-"`. + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. Can have any valid JSON format value. The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced). From e171472e999b83568a6e9ba42f675a655f81b47e Mon Sep 17 00:00:00 2001 From: Darrel Date: Sun, 2 Oct 2016 20:15:18 -0400 Subject: [PATCH 0090/1801] Added auth header support and OpenIdConnect --- versions/3.0.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index f7761d43c4..120238fd56 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2974,10 +2974,13 @@ Supported schemes are basic authentication, an API key (either as a header or as ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"basic"`, `"apiKey"` or `"oauth2"`. +type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. +scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per RFC 7234. +bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token should be formatted. +openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. @@ -2995,12 +2998,14 @@ Field Name | Type | Description ```json { - "type": "basic" + "type": "scheme", + "scheme" : "basic" } ``` ```yaml -type: basic +type: http +scheme: basic ``` ###### API Key Sample @@ -3019,6 +3024,22 @@ name: api_key in: header ``` +###### JWT Bearer Sample + +```json +{ + "type": "scheme", + "scheme" : "bearer", + "bearerFormat" : "JWT", +} +``` + +```yaml +type: http +scheme: bearer +bearerFormat: JWT +``` + ###### Implicit OAuth2 Sample ```json From f5c88c3953a167d048dd2255e7692d81a6091064 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 4 Oct 2016 04:09:09 +0100 Subject: [PATCH 0091/1801] Typo fixes --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index f7761d43c4..2e5bd3fda6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1520,7 +1520,7 @@ href: 'http://colors.my-server.com/colors/green' href: 'http://colors.my-server.com/colors/blue' ``` -As with all links, it at the the clients' discretion to follow them, and permissions and the ability to make a successful call to that link is not guaranteed soley by the existance of a relationship. +As with all links, it at the the clients' discretion to follow them, and permissions and the ability to make a successful call to that link is not guaranteed solely by the existence of a relationship. ### Example From b6672459f0ea452b33b1c6c1199435de2b923af8 Mon Sep 17 00:00:00 2001 From: Miguel Sancho Fernandez Date: Wed, 5 Oct 2016 10:19:25 -0400 Subject: [PATCH 0092/1801] working fix on readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ec5e06b3a..ad4b4fc621 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The current version of the OpenAPI specification is 2.0 - and you can find it [h ### [OpenAPI 2.0 Specification](versions/2.0.md) -This repository contains the existing Swagger 1.2, 2.0 specifications as well as proposals for the next verson of the specification, which will be called the OpenAPI Specification 3.0. The proposals live in the [OpenAPI.next](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) branch. +This repository contains the existing Swagger 1.2, 2.0 specifications as well as proposals for the next version of the specification, which will be called the OpenAPI Specification 3.0. The proposals live in the [OpenAPI.next](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) branch. ## Structure From 5e974989fdd0d209b7183d8563a6864bef02c1ca Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 6 Oct 2016 17:41:46 -0700 Subject: [PATCH 0093/1801] adds documentation on the openapi attribute and versioning strategy --- versions/3.0.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2e5bd3fda6..46c88003b5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -125,7 +125,7 @@ It combines what previously was the Resource Listing and API Declaration (versio Field Name | Type | Description ---|:---:|--- -openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. @@ -140,6 +140,15 @@ Field Pattern | Type | Description ---|:---:|--- ^x- | Any | Allows extensions to the OAS Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +#### OpenAPI Version String + +The version string signifies the version of the OpenAPI Specification that the document complies to. The format for this string _must_ be `major`.`minor`.`patch`. The `patch` _may_ be suffixed by a hyphen and extra alphanumeric characters. + +A `major`.`minor` shall be used to designate the OpenAPI Specification version, and will be considered compatible with the OpenAPI Specification specified by that `major`.`minor` version. The patch version will not be considered by tooling, making no distinction between `3.0.0` and `3.0.1`. + +In subsequent versions of the OpenAPI Specification, care will be given such that increments of the `minor` version should not interfere with operations of tooling developed to a lower minor version. Thus a hypothetical `3.1.0` specification should be usable with tooling designed for `3.0.0`. + + #### Info Object The object provides metadata about the API. From 2233066751cfbe2827cc138fb4b19be16db5f0be Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 6 Oct 2016 19:46:51 -0700 Subject: [PATCH 0094/1801] added hosts setting --- versions/3.0.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ae3bb390a8..f4506218f0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -127,7 +127,7 @@ Field Name | Type | Description ---|:---:|--- openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. +hosts | [Host Object](#hostObject) | An array of Host objects which provide connectivity information to a target host. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. @@ -205,9 +205,73 @@ An object representing a Host. Field Name | Type | Description ---|:---:|--- -host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). -basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#oasHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -scheme | `string` | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `scheme` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. +host URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the #hostTemplateParameter syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +host description | `string` | An optional string describing the host designated by the URL. +templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template + +This object can be extended with [Specification Extensions](#specificationExtensions). + +##### Host Object Example + +The following shows how multiple hosts can be described in the host object array + +```yaml +servers: +- url: https://development.gigantic-server.com/v1 + description: Development server +- url: https://staging.gigantic-server.com/v1 + description: Staging server +- url: https://api.gigantic-server.com/v1 + description: Production server +``` + +The following shows how templates an be used for a host configuration + +```yaml +servers: +- url: {scheme}://{host}:{port}/{basePath} + description: The production API server + templates: + scheme: + enum: + - https + - http + default: https + host: + enum: + - na1.gigantic-server.com + - na2.gigantic-server.com + port: + enum: + - 8443 + - 443 + default: 8443 + basePath: + default: v2 +``` + +#### Host Templates Object + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- + [variable name] | [Host Template Parameter](#hostTemplateParameter) | A parameter to be used for substitution in the URL template. + +This object can be extended with [Specification Extensions](#specificationExtensions). + + +#### Host Template + +An object representing a Host URL template + +Field Name | Type | Description +---|:---:|--- +enum | [Possible Values] | An enumeration of primitive type values to be used if the substitution options are from a limited set. +default | [Default Value] | **Required.** The default value to use for substitution if an alternate value is not specified + +This object can be extended with [Specification Extensions](#specificationExtensions). + #### Contact Object From 1dbcb29ff82c38a79855c1445fed7e1cc8ae2087 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 6 Oct 2016 21:49:12 -0700 Subject: [PATCH 0095/1801] added items from #741 --- versions/3.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index f4506218f0..3a2e3e4410 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2023,6 +2023,9 @@ The following properties are taken from the JSON Schema definition but their def Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. - items - allOf +- oneOf +- anyOf +- not - properties - additionalProperties From 86e5686880103ca33039de4eae7eddd8f3ae7927 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Thu, 6 Oct 2016 13:44:06 +0200 Subject: [PATCH 0096/1801] https://github.com/OAI/OpenAPI-Specification/issues/607 --- versions/3.0.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5d2998b531..42b3165290 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -95,23 +95,33 @@ An additional primitive data type `"file"` is used by the [Parameter Object](#pa Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. -Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. +Formats such as `"email"`, `"T-shirt size"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the OAS are: Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments ----------- | ------ | -------- | -------- +octet | `integer` | `uint8` | unsigned 8 bits +signed byte| `integer` | `int8` | signed 8 bits +short| `integer` | `int16` | signed 16 bits integer | `integer` | `int32` | signed 32 bits long | `integer` | `int64` | signed 64 bits +big integer | `integer` | | | float | `number` | `float` | | double | `number` | `double` | | +decimal | `number` | `decimal` | decimal floating-point number, recipient-side internal representation as a binary floating-point number may lead to rounding errors +big decimal | `number` | | | string | `string` | | | -byte | `string` | `byte` | base64 encoded characters +encoded binary | `string` | `byte` | base64 encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-4) +url-safe encoded binary | `string` | `base64url` | base64url encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-5) binary | `string` | `binary` | any sequence of octets boolean | `boolean` | | | date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +time (of day) | `string` | `time` | As defined by `partial-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +duration| `string` | `duration` | As defined by `xs:dayTimeDuration` - [XML Schema 1.1](http://www.w3.org/TR/xmlschema11-2/#dayTimeDuration) +uuid| `string` | `uuid` | Universally Unique Identifier (UUID) - [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) password | `string` | `password` | Used to hint UIs the input needs to be obscured. ### Schema From ed8eac7549d029f7768dc267cceeabbd5603e770 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Fri, 7 Oct 2016 15:56:45 +0200 Subject: [PATCH 0097/1801] Removed duplicate line for schemes Fixed typos in JSON example --- versions/3.0.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42b3165290..02ed57e908 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -465,7 +465,6 @@ Field Name | Type | Description requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. -schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) or path item-level [host](#pathItemHost). if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). @@ -494,19 +493,21 @@ This object can be extended with [Specification Extensions](#specificationExtens } ], "requestBody" : { - "content" : { - "application/x-www-form-urlencoded":{ - "schema" : { - "type" : "object", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", "properties": { - "name" - "description" : "Updated name of the pet", + "name": { + "description": "Updated name of the pet", "type": "string" - "status": - "description" : "Updated status of the pet", + }, + "status": { + "description": "Updated status of the pet", "type": "string" + } }, - "required" : ["status"] + "required": ["status"] } } } From f6636310ea1b41934192a460d43476e58ca920d8 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Fri, 7 Oct 2016 16:01:25 +0200 Subject: [PATCH 0098/1801] Backed out accidental changes --- versions/3.0.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 02ed57e908..efab3b7cd3 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -95,33 +95,23 @@ An additional primitive data type `"file"` is used by the [Parameter Object](#pa Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. -Formats such as `"email"`, `"T-shirt size"`, etc., can be used even though they are not defined by this specification. +Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the OAS are: Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments ----------- | ------ | -------- | -------- -octet | `integer` | `uint8` | unsigned 8 bits -signed byte| `integer` | `int8` | signed 8 bits -short| `integer` | `int16` | signed 16 bits integer | `integer` | `int32` | signed 32 bits long | `integer` | `int64` | signed 64 bits -big integer | `integer` | | | float | `number` | `float` | | double | `number` | `double` | | -decimal | `number` | `decimal` | decimal floating-point number, recipient-side internal representation as a binary floating-point number may lead to rounding errors -big decimal | `number` | | | string | `string` | | | -encoded binary | `string` | `byte` | base64 encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-4) -url-safe encoded binary | `string` | `base64url` | base64url encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-5) +byte | `string` | `byte` | base64 encoded characters binary | `string` | `binary` | any sequence of octets boolean | `boolean` | | | date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -time (of day) | `string` | `time` | As defined by `partial-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -duration| `string` | `duration` | As defined by `xs:dayTimeDuration` - [XML Schema 1.1](http://www.w3.org/TR/xmlschema11-2/#dayTimeDuration) -uuid| `string` | `uuid` | Universally Unique Identifier (UUID) - [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) password | `string` | `password` | Used to hint UIs the input needs to be obscured. ### Schema From 000a9a0f99f108b68ac49c5664b1e0323b102bf8 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 7 Oct 2016 09:58:05 -0700 Subject: [PATCH 0099/1801] moved it around, fixed example --- versions/3.0.md | 148 +++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 76 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 3a2e3e4410..178d40d225 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -127,7 +127,7 @@ Field Name | Type | Description ---|:---:|--- openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -hosts | [Host Object](#hostObject) | An array of Host objects which provide connectivity information to a target host. +hosts | [Server Object](#serverObject) | An array of Server Objects which provide connectivity information to a target host. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. @@ -197,23 +197,80 @@ license: version: 1.0.1 ``` -#### Host Object +#### Contact Object -An object representing a Host. +Contact information for the exposed API. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -host URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the #hostTemplateParameter syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +name | `string` | The identifying name of the contact person/organization. +url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. +email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +##### Contact Object Example: + +```json +{ + "name": "API Support", + "url": "http://www.swagger.io/support", + "email": "support@swagger.io" +} +``` + +```yaml +name: API Support +url: http://www.swagger.io/support +email: support@swagger.io +``` + +#### License Object + +License information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | **Required.** The license name used for the API. +url | `string` | A URL to the license used for the API. MUST be in the format of a URL. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +##### License Object Example: + +```json +{ + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" +} +``` + +```yaml +name: Apache 2.0 +url: http://www.apache.org/licenses/LICENSE-2.0.html +``` + +#### Server Object + +An object representing a Server. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the #hostTemplateParameter syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. host description | `string` | An optional string describing the host designated by the URL. templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template This object can be extended with [Specification Extensions](#specificationExtensions). -##### Host Object Example +##### Server Object Example -The following shows how multiple hosts can be described in the host object array +The following shows how multiple hosts can be described in the Server Object array ```yaml servers: @@ -225,28 +282,24 @@ servers: description: Production server ``` -The following shows how templates an be used for a host configuration +The following shows how templates an be used for a server configuration ```yaml servers: -- url: {scheme}://{host}:{port}/{basePath} +- url: https://{username}.gigantic-server.com:{port}/{basePath} description: The production API server templates: - scheme: - enum: - - https - - http - default: https - host: - enum: - - na1.gigantic-server.com - - na2.gigantic-server.com + username: + # note! no enum here means it is an open value + default: demo + description: this value is assigned by the service provider, in this example `gigantic-server.com` port: enum: - 8443 - 443 default: 8443 basePath: + # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` default: v2 ``` @@ -268,68 +321,11 @@ An object representing a Host URL template Field Name | Type | Description ---|:---:|--- enum | [Possible Values] | An enumeration of primitive type values to be used if the substitution options are from a limited set. -default | [Default Value] | **Required.** The default value to use for substitution if an alternate value is not specified +default | [Default Value] | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. +description | `string` | An optional description for the template parameter This object can be extended with [Specification Extensions](#specificationExtensions). - -#### Contact Object - -Contact information for the exposed API. - -##### Fixed Fields - -Field Name | Type | Description ----|:---:|--- -name | `string` | The identifying name of the contact person/organization. -url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. -email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. - -This object can be extended with [Specification Extensions](#specificationExtensions). - -##### Contact Object Example: - -```json -{ - "name": "API Support", - "url": "http://www.swagger.io/support", - "email": "support@swagger.io" -} -``` - -```yaml -name: API Support -url: http://www.swagger.io/support -email: support@swagger.io -``` - -#### License Object - -License information for the exposed API. - -##### Fixed Fields - -Field Name | Type | Description ----|:---:|--- -name | `string` | **Required.** The license name used for the API. -url | `string` | A URL to the license used for the API. MUST be in the format of a URL. - -This object can be extended with [Specification Extensions](#specificationExtensions). - -##### License Object Example: - -```json -{ - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" -} -``` - -```yaml -name: Apache 2.0 -url: http://www.apache.org/licenses/LICENSE-2.0.html -``` - #### Components Object Holds a set of schemas for different aspects of the OAS. From a790e9ffb22e6698d2b2c708cdc65434f992763b Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 7 Oct 2016 09:58:50 -0700 Subject: [PATCH 0100/1801] ooops --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 178d40d225..ff09457cca 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -127,7 +127,7 @@ Field Name | Type | Description ---|:---:|--- openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -hosts | [Server Object](#serverObject) | An array of Server Objects which provide connectivity information to a target host. +servers | [Server Object](#serverObject) | An array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. From 5b5523765baab9a94eefb9ebb919166cb2958af2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 7 Oct 2016 10:02:51 -0700 Subject: [PATCH 0101/1801] ooops --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ff09457cca..4fd462e98e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -127,7 +127,7 @@ Field Name | Type | Description ---|:---:|--- openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [Server Object](#serverObject) | An array of Server Objects which provide connectivity information to a target server. +servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. @@ -262,7 +262,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the #hostTemplateParameter syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [#hostTemplateParameter] syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. host description | `string` | An optional string describing the host designated by the URL. templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template From 828583a7121ab8facbcc3b4fb0b77842d63937ee Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 7 Oct 2016 20:50:56 -0700 Subject: [PATCH 0102/1801] Introduced prefix and separator --- versions/3.0.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ccbfc013e2..7903ab2feb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -647,16 +647,25 @@ Field Name | Type | Description required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -escape | `boolean` | Determines whether the parameter value should have unallowed characters percent-encoded based the parameter location. The default value is `true`. -style | `string` | Determines rendering rules based on [RFC 6570](https://tools.ietf.org/html/rfc6570). Valid values include "matrix", "label", "segment", "simple". The style is only used when `in` has the value `path`. "matrix" refers to what RFC6570 calls "path-style". Default value is "simple". +escape | `boolean` | Determines whether the parameter value should have unallowed characters percent-encoded based the parameter location. This property only applies to parameters with an `in` value of `query`. The default value is `true`. +style | `string` | Defines a character to prefix each parameter value. Valid values include [;.]. Where no separator is specified and a parameter value is an array, then a comma will be used as the default separator. +style | `string` | Defines a character used to separate the values of parameters that are lists and maps. Value values include [;.]. Where no separator is specified and a parameter value is an array, then a comma will be used as the default separator. explode | `boolean` | Indicates if the parameter values should rendered using the rules of the explode operator as defined in [RFC 6570](https://tools.ietf.org/html/rfc6570#section-2.2). Default value is `false`. - ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +##### Parameter Value Rendering Examples + +path | escape | prefix | separator | explode | Value | Output +---|:---:|---:|---:|---:|---:|---:| +/share/myfile{ext} | true | . | | false | jpg | /share/myfile.jpg +/registerwebhook?url={callback} | false | | | false | http://example.org/myreceiver | /registerwebhook?url=http://example.org/myreceiver +/letters?value={value} | true | | , | false | [a,b,c] | /letters?value=a,b,c +/letters?value={value} | true | | , | true | [a,b,c] | /letters?value=a&value=b,c + ##### Parameter Object Examples From 7ca85c1d552fbc598690a91c028270675d709d54 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Tue, 11 Oct 2016 12:11:30 -0700 Subject: [PATCH 0103/1801] [Contributors] Add self to contributors list Signed-off-by: Rob Dolin --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5a5ab82e15..4a2f1256fc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,5 +2,6 @@ * Jason Harmon [@jharmn](https://github.com/jharmn) * Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) * Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Rob Dolin [@RobDolinMS](https://github.com/robdolinms) * Ron Ratovsky [@webron](https://github.com/webron) * Tony Tam [@fehguy](https://github.com/fehguy) From 9053862b787047e0aa98dd23bcd5f3133b886b43 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Tue, 11 Oct 2016 12:36:23 -0700 Subject: [PATCH 0104/1801] [3.0.md] Finish adding links to all spec sections Signed-off-by: Rob Dolin --- versions/3.0.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2d6458f513..dbe52fc0fc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -34,9 +34,35 @@ Additional utilities can also take advantage of the resulting files, such as tes - [License Object](#license-object) - [Components Object](#components-object) - [Paths Object](#paths-object) - ... - ... - - [Security Scheme Object](#security-scheme-object) + - [Path Item Object](#path-item-object) + - [Operation Object](#operation-object) + - [External Documentation Object](#external-documentation-object) + - [Parameter Object](#parameter-object) + - [Request Body Object](#request-body-object) + - [Content Object](#content-object) + - [Content Type Object](#content-type-object) + - [Items Object](#items-object) + - [Responses Object](#responses-object) + - [Response Object](#response-object) + - [Headers Object](#headers-object) + - [Examples Object](#examples-object) + - [Links Object](#links-object) + - [Link Object](#link-object) + - [Variable substitution](#variable-substitution) + - [Link Parameters](#link-parameters) + - [Header Object](#header-object) + - [Tag Object](#tag-object) + - [Examples Object](#examples-object) + - [Reference Object](#reference-object) + - [Schema Object](#schema-object) + - [XML Object](#xml-object) + - [Definitions Object](#definitions-object) + - [Parameters Definitions Object](#parameters-definitions-object) + - [Responses Definitions Object](#responses-definitions-object) + - [Security Definitions Object](#security-definitions-object) + - [Security Scheme Object](#security-scheme-object) + - [Scopes Object](#scopes-object) + - [Security Requirement Object](#security-requirement-object) - [Specification Extensions](#specification-extensions) - [Security Filtering](#security-filtering) From d7e78ac33f4f3e9b88dcbf7a5f55c360d6ab1a30 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 20 Oct 2016 11:18:47 -0700 Subject: [PATCH 0105/1801] doc review for path item objects --- versions/3.0.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbbfeb5548..f7bf2feb7e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -345,8 +345,8 @@ Field Pattern | Type | Description #### Paths Object Holds the relative paths to the individual endpoints. -The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. -The Paths may be empty, due to [ACL constraints](#securityFiltering). +The path is appended to the [`Server Object`](#serverObject) in order to construct +the full URL. The Paths may be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields @@ -418,9 +418,7 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. -host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). -basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. +[Server Object](#serverObject) | An alternative `server` object to service this operation. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). From 1301be350dc7e1832fa655e3b438723930fa85b2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 20 Oct 2016 11:21:13 -0700 Subject: [PATCH 0106/1801] fixed basePath reference --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index f7bf2feb7e..9a4aedda75 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -352,7 +352,7 @@ the full URL. The Paths may be empty, due to [ACL constraints](#securityFilteri Field Pattern | Type | Description ---|:---:|--- -/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#oasBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`Server Object`](#serverObject) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. This object can be extended with [Specification Extensions](#specificationExtensions). From c306532e657fbbae1c55d337ce62acc571ce30db Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 20 Oct 2016 11:28:14 -0700 Subject: [PATCH 0107/1801] reviewed, added `TRACE` for #325 --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9a4aedda75..6eb563ce37 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -418,6 +418,7 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. [Server Object](#serverObject) | An alternative `server` object to service this operation. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). From ab6f58ade251a6d9255c05c900cb05129d43a891 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 20 Oct 2016 11:32:14 -0700 Subject: [PATCH 0108/1801] reviewed, cleaned up operation object docs --- versions/3.0.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6eb563ce37..955f70badb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -419,7 +419,7 @@ Field Name | Type | Description head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. -[Server Object](#serverObject) | An alternative `server` object to service this operation. +[Server Object](#serverObject) | An alternative `server` object to service all operations in this path. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). @@ -526,9 +526,7 @@ Field Name | Type | Description schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. -host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) or path item-level [host](#pathItemHost). if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). -basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) or path item-level [basePath](#oasPathItemBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). -schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) or path-item level [schemes](#pathItemSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. +[Server Object](#serverObject) | An alternative `server` object to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -600,7 +598,7 @@ This object can be extended with [Specification Extensions](#specificationExtens tags: - pet summary: Updates a pet in the store with form data -description: "" +description: '' operationId: updatePetWithForm parameters: - name: petId From 31ffe115d57a25da736b56bc198d22bb24930883 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 21 Oct 2016 20:50:16 -0400 Subject: [PATCH 0109/1801] Some fixes to the security definition object Corrected RFC reference. Clarified that URLs can be relative. Fixed basic auth example. --- versions/3.0.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbbfeb5548..3ea8f9602c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3004,12 +3004,11 @@ Field Name | Type | Validity | Description description | `string` | Any | A short description for security scheme. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. -scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per RFC 7234. -bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token should be formatted. -openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. +scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per [RFC 7235](https://tools.ietf.org/html/rfc7235). +openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. Url may be relative to location of OpenAPI document. flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. -tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3020,7 +3019,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { - "type": "scheme", + "type": "http", "scheme" : "basic" } ``` From bd4d7b190b6924ebff0528c37e7e397945b2765c Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 21 Oct 2016 20:50:56 -0400 Subject: [PATCH 0110/1801] Update to description of bearerFormat property --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 3ea8f9602c..42089ccb06 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3005,6 +3005,7 @@ Field Name | Type | Validity | Description name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per [RFC 7235](https://tools.ietf.org/html/rfc7235). +bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. Url may be relative to location of OpenAPI document. flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. From f22e9fbadfc2a81fe07a83e84a6c840262590747 Mon Sep 17 00:00:00 2001 From: Gustavo Ferreira Date: Sun, 23 Oct 2016 02:41:16 +0100 Subject: [PATCH 0111/1801] Update README.md Just a minor typo on a word. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ec5e06b3a..ad4b4fc621 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The current version of the OpenAPI specification is 2.0 - and you can find it [h ### [OpenAPI 2.0 Specification](versions/2.0.md) -This repository contains the existing Swagger 1.2, 2.0 specifications as well as proposals for the next verson of the specification, which will be called the OpenAPI Specification 3.0. The proposals live in the [OpenAPI.next](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) branch. +This repository contains the existing Swagger 1.2, 2.0 specifications as well as proposals for the next version of the specification, which will be called the OpenAPI Specification 3.0. The proposals live in the [OpenAPI.next](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) branch. ## Structure From 6aded08d56c1e7bb12c981b655896f7fc7e54d3f Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 28 Oct 2016 00:29:45 -0400 Subject: [PATCH 0112/1801] Added flow object --- versions/3.0.md | 125 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42089ccb06..7b64d20ce9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2968,11 +2968,14 @@ Field Pattern | Type | Description }, "petstore_auth": { "type": "oauth2", - "authorizationUrl": "http://swagger.io/api/oauth/dialog", - "flow": "implicit", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" + "flow": { + "implicit": { + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } } } } @@ -2985,17 +2988,18 @@ api_key: in: header petstore_auth: type: oauth2 - authorizationUrl: http://swagger.io/api/oauth/dialog - flow: implicit - scopes: - write:pets: modify pets in your account - read:pets: read your pets + flow: + implicit: + authorizationUrl: http://swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets ``` #### Security Scheme Object Allows the definition of a security scheme that can be used by the operations. -Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). ##### Fixed Fields Field Name | Type | Validity | Description @@ -3006,11 +3010,8 @@ Field Name | Type | Validity | Description in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per [RFC 7235](https://tools.ietf.org/html/rfc7235). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. Url may be relative to location of OpenAPI document. -flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. -tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. -scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3067,22 +3068,96 @@ bearerFormat: JWT ```json { "type": "oauth2", - "authorizationUrl": "http://swagger.io/api/oauth/dialog", - "flow": "implicit", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" + "flow": { + "implicit": { + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } } } ``` ```yaml type: oauth2 -authorizationUrl: http://swagger.io/api/oauth/dialog -flow: implicit -scopes: - write:pets: modify pets in your account - read:pets: read your pets +flow: + implicit: + authorizationUrl: http://swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### OAuth Flows Object + +Allows configuration of the supported OAuth Flows. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|---|--- +implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow +password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow +client_credentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenApi 2.0. +authorization_code| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenApi 2.0. +refresh_token| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Refresh Token flow. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +#### OAuth Flow Object + +Configuration details for a supported OAuth Flow + +##### Fixed Fields +Field Name | Type | Validity | Description +---|:---:|---|--- +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorization_code"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +tokenUrl | `string` | `oauth2` (`"password"`, `"client_credentials"`, `"authorization_code"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +##### OAuth Flow Object Examples + +```JSON +{ + "type": "oauth2", + "flow": { + "implicit": { + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "authorization_code": { + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "tokenUrl": "http://swagger.io/api/oauth/token", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```YAML +type: oauth2 +flow: + implicit: + authorizationUrl: http://swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + authorization_code: + authorizationUrl: http://swagger.io/api/oauth/dialog + tokenUrl: http://swagger.io/api/oauth/token + scopes: + write:pets: modify pets in your account + read:pets: read your pets ``` #### Scopes Object From f913a66638bf8818854028632b5951406a622051 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Fri, 28 Oct 2016 09:26:00 -0400 Subject: [PATCH 0113/1801] markdown typo --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbbfeb5548..424aa9a01c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -262,7 +262,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [#hostTemplateParameter] syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. host description | `string` | An optional string describing the host designated by the URL. templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template From 00be7e39b9482dc92888b3e87c78267a6e5002d0 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 28 Oct 2016 09:53:09 -0400 Subject: [PATCH 0114/1801] Update to Security Requirements descriptions for clarity --- versions/3.0.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7b64d20ce9..140aae1362 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -130,7 +130,6 @@ Field Name | Type | Description servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. @@ -526,7 +525,7 @@ Field Name | Type | Description callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes can be used for this operation. The list of values describes alternative security schemes that can be used. Only one of the schemes need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) or path item-level [host](#pathItemHost). if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) or path item-level [basePath](#oasPathItemBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) or path-item level [schemes](#pathItemSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. @@ -3189,15 +3188,18 @@ read:pets: read your pets #### Security Requirement Object Lists the required security schemes to execute this operation. -The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes). - The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#securityDefinitionsObject). +Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where there multiple query parameters or HTTP headers are required to convey security information. + +When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize. + ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [`string`] | Each name must correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +{name} | [`string`] | Each name must correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. ##### Security Requirement Object Examples From 78cba996a53143b55d49d9c9af6a25cbad5eac83 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 28 Oct 2016 09:55:44 -0400 Subject: [PATCH 0115/1801] More security requirements clarification --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 140aae1362..564067146f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -130,6 +130,7 @@ Field Name | Type | Description servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes can be used across the API. The list of values describes alternative security schemes that can be used. Only one of the schemes need to be satisfied to authorize a request. Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. From e66e26c7935e37d39a155dafca1e67a9d205656e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 28 Oct 2016 09:46:04 -0700 Subject: [PATCH 0116/1801] Update 3.0.md --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 955f70badb..69291c60fb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -419,7 +419,7 @@ Field Name | Type | Description head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. -[Server Object](#serverObject) | An alternative `server` object to service all operations in this path. +servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). @@ -526,7 +526,7 @@ Field Name | Type | Description schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. -[Server Object](#serverObject) | An alternative `server` object to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. +servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. This object can be extended with [Specification Extensions](#specificationExtensions). From 18ad65a156d6cd6d911961b75007044afa49532d Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 1 Nov 2016 14:27:08 -0400 Subject: [PATCH 0117/1801] Added links and callbacks to components --- versions/3.0.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbbfeb5548..58d701250e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -328,8 +328,8 @@ This object can be extended with [Specification Extensions](#specificationExtens #### Components Object -Holds a set of schemas for different aspects of the OAS. -The intention is to put reusable components into a single location, allowing reuse from this and other OAS documents. +Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. ##### Fixed Fields @@ -340,6 +340,10 @@ Field Pattern | Type | Description | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. + | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. + | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. + +TODO: All objects that are children of the componentsObject use keys where following characters are legal in the `name`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. #### Paths Object @@ -2779,7 +2783,7 @@ animals: #### Definitions Object -An object to hold data types that can be consumed and produced by operations. +An object to hold schemas for data types that can be consumed and produced by operations. These data types can be primitives, arrays or models. ##### Patterned Fields From df151d69ef796324a596361cb7717c0f59580d01 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 1 Nov 2016 15:52:57 -0400 Subject: [PATCH 0118/1801] Fix casing of flows and wording of sec reqs --- versions/3.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 564067146f..e192c1d759 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -130,7 +130,7 @@ Field Name | Type | Description servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes can be used across the API. The list of values describes alternative security schemes that can be used. Only one of the schemes need to be satisfied to authorize a request. Individual operations can override this definition. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. @@ -526,7 +526,7 @@ Field Name | Type | Description callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. -security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes can be used for this operation. The list of values describes alternative security schemes that can be used. Only one of the schemes need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) or path item-level [host](#pathItemHost). if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating). basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) or path item-level [basePath](#oasPathItemBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating). schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) or path-item level [schemes](#pathItemSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. @@ -3099,9 +3099,9 @@ Field Name | Type | Description ---|:---:|---|--- implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow -client_credentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenApi 2.0. -authorization_code| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenApi 2.0. -refresh_token| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Refresh Token flow. +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenApi 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenApi 2.0. +refresh_token| [OAuth Flow Object](#oauthFlowObject) | [TODO] DO WE NEED THIS? Configuration for the OAuth Refresh Token flow. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3112,8 +3112,8 @@ Configuration details for a supported OAuth Flow ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorization_code"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. -tokenUrl | `string` | `oauth2` (`"password"`, `"client_credentials"`, `"authorization_code"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. @@ -3132,7 +3132,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "read:pets": "read your pets" } }, - "authorization_code": { + "authorizationCode": { "authorizationUrl": "http://swagger.io/api/oauth/dialog", "tokenUrl": "http://swagger.io/api/oauth/token", "scopes": { @@ -3152,7 +3152,7 @@ flow: scopes: write:pets: modify pets in your account read:pets: read your pets - authorization_code: + authorizationCode: authorizationUrl: http://swagger.io/api/oauth/dialog tokenUrl: http://swagger.io/api/oauth/token scopes: From de8ba9c0d4c8db79ca0192d073dfc493856d020d Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 1 Nov 2016 16:27:00 -0400 Subject: [PATCH 0119/1801] Apply naming constraint across all component definitions --- versions/3.0.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 58d701250e..9d57b48313 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -331,6 +331,7 @@ This object can be extended with [Specification Extensions](#specificationExtens Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + ##### Fixed Fields Field Pattern | Type | Description @@ -343,8 +344,9 @@ Field Pattern | Type | Description | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. -TODO: All objects that are children of the componentsObject use keys where following characters are legal in the `name`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. - +All the fixed fields declared above are objects that MUST contain keys that only use the following characters: `a-zA-Z0-9.-_\`. +Where it is necessary to namespace definition names the `.` character SHOULD be used to separate namespace segments of the name. +This namespacing mechanism is simply a naming convention and this specification defines no special behavior on namespaced identifiers. #### Paths Object @@ -2791,7 +2793,6 @@ These data types can be primitives, arrays or models. Field Pattern | Type | Description ---|:---:|--- {name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. -The following characters are legal in the `definitionsName`: `a-zA-Z0-9.-_\`. All other characters, including extended ASCII characters, are not legal in the `definitionsName`. The name may be used to namespace the definitions--it is the tooling Specification's job to ensure that the namespace is honored. Examples: From 06e9df23face2bde13d6c9d1a28eb08189a46b32 Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 2 Nov 2016 09:32:01 -0400 Subject: [PATCH 0120/1801] Removed refresh flow --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index e192c1d759..d4cb798072 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3101,7 +3101,6 @@ Field Name | Type | Description password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenApi 2.0. authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenApi 2.0. -refresh_token| [OAuth Flow Object](#oauthFlowObject) | [TODO] DO WE NEED THIS? Configuration for the OAuth Refresh Token flow. This object can be extended with [Specification Extensions](#specificationExtensions). From 465a54827b89b5dbe3c00f830c204d6687178360 Mon Sep 17 00:00:00 2001 From: jobol Date: Thu, 3 Nov 2016 14:56:22 +0100 Subject: [PATCH 0121/1801] Fix server field names it is disturbing to not have the real field names --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 85b62bf16c..24e5803553 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -317,8 +317,8 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -server URL template | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. -host description | `string` | An optional string describing the host designated by the URL. +url | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +description | `string` | An optional string describing the host designated by the URL. templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template This object can be extended with [Specification Extensions](#specificationExtensions). From 452a988b76535db0706f9911db0ca102de021a0e Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 4 Nov 2016 14:41:09 -0400 Subject: [PATCH 0122/1801] Fixed casing and https --- versions/3.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d4cb798072..34c5050990 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3011,7 +3011,7 @@ Field Name | Type | Validity | Description scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per [RFC 7235](https://tools.ietf.org/html/rfc7235). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. -openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. Url may be relative to location of OpenAPI document. +openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. URL may be relative to location of OpenAPI document. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3070,7 +3070,7 @@ bearerFormat: JWT "type": "oauth2", "flow": { "implicit": { - "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "authorizationUrl": "https://swagger.io/api/oauth/dialog", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -3084,7 +3084,7 @@ bearerFormat: JWT type: oauth2 flow: implicit: - authorizationUrl: http://swagger.io/api/oauth/dialog + authorizationUrl: https://swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets @@ -3125,15 +3125,15 @@ This object can be extended with [Specification Extensions](#specificationExtens "type": "oauth2", "flow": { "implicit": { - "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "authorizationUrl": "https://swagger.io/api/oauth/dialog", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" } }, "authorizationCode": { - "authorizationUrl": "http://swagger.io/api/oauth/dialog", - "tokenUrl": "http://swagger.io/api/oauth/token", + "authorizationUrl": "https://swagger.io/api/oauth/dialog", + "tokenUrl": "https://swagger.io/api/oauth/token", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -3147,13 +3147,13 @@ This object can be extended with [Specification Extensions](#specificationExtens type: oauth2 flow: implicit: - authorizationUrl: http://swagger.io/api/oauth/dialog + authorizationUrl: https://swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets authorizationCode: - authorizationUrl: http://swagger.io/api/oauth/dialog - tokenUrl: http://swagger.io/api/oauth/token + authorizationUrl: https://swagger.io/api/oauth/dialog + tokenUrl: https://swagger.io/api/oauth/token scopes: write:pets: modify pets in your account read:pets: read your pets From 9d52588bec5cb9eecd03c45c7563006b5799b0e3 Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 16 Nov 2016 23:08:30 -0500 Subject: [PATCH 0123/1801] Added requestBodyDefinitions to componets --- versions/3.0.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8af2ba04d3..1513f67e06 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -394,14 +394,13 @@ Field Pattern | Type | Description | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. | [Responses Definitions Object](#responsesDefinitionsObject) | Reusable responses objects. | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. + | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold request body definitions to be reused across operations. Request Body definitions can be referenced to the ones defined here. | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. All the fixed fields declared above are objects that MUST contain keys that only use the following characters: `a-zA-Z0-9.-_\`. -Where it is necessary to namespace definition names the `.` character SHOULD be used to separate namespace segments of the name. -This namespacing mechanism is simply a naming convention and this specification defines no special behavior on namespaced identifiers. #### Paths Object @@ -667,7 +666,7 @@ parameters: description: ID of pet that needs to be updated required: true type: string -responseBody: +requestBody: content: 'application/x-www-form-urlencoded': schema: From b6e57913554fa2eeb81e3fd3e6e0e195d3dbcd66 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 18 Nov 2016 00:43:52 -0500 Subject: [PATCH 0124/1801] Tweak grammar and diction --- versions/3.0.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 646af49cab..1bcb547139 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -119,12 +119,11 @@ For example, if a field is said to have an array value, the JSON array represent } ``` -While the API is described using JSON it does not impose a JSON input/output to the API itself. +Even though the API is described with JSON, it is not required to use JSON for input or output. All field names in the specification are **case sensitive**. -The schema exposes two types of fields. -Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. +The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name. In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: @@ -1136,8 +1135,8 @@ items: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. -It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. -However, it is expected from the documentation to cover a successful operation response and any known errors. +It is not expected for the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. +However, it is expected for the documentation to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. From 71211ba6210b1bf136a08f29300c2b5e32443b95 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 17 Nov 2016 22:08:06 -0800 Subject: [PATCH 0125/1801] added parameter object updates for #840 --- versions/3.0.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 646af49cab..4acfd94a95 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -743,7 +743,36 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. -schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. + + +The content of the parameter is specified in one of two ways. By passing a schema and content-type, complex parameters may be serialized and passed: + +Field Name | Type | Description +---|:---:|--- +content | [Content Object](#contentObject) | The content of the request body. + +By defining a subset of JSON-schema properties: + +Field Name | Type | Description +---|:---:|--- +type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. If `type` is `"file"`, the [`consumes`](#operationConsumes) MUST be either `"multipart/form-data"`, `" application/x-www-form-urlencoded"` or both and the parameter MUST be [`in`](#parameterIn) `"formData"`. +format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. +items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. +collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
  • `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`. +default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. +maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. +minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. +maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. +minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. +pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. +maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. +minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. +uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. +enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. +multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. This object can be extended with [Specification Extensions](#specificationExtensions). From fd3e3ed8905bad2e860bf869f73fa26db6aedf5b Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 18 Nov 2016 11:37:45 -0500 Subject: [PATCH 0126/1801] Fixes based on PR comments --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e281c7d50f..5b3ce3821d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3061,7 +3061,7 @@ Field Name | Type | Validity | Description description | `string` | Any | A short description for security scheme. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. -scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the Authorization header as per [RFC 7235](https://tools.ietf.org/html/rfc7235). +scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. URL may be relative to location of OpenAPI document. @@ -3164,9 +3164,9 @@ Configuration details for a supported OAuth Flow ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. -tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. -refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This SHOULD be in the form of a URL. Url may be relative to location of OpenAPI document. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This SHOULD be in the form of a URL. scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. This object can be extended with [Specification Extensions](#specificationExtensions). From 79cd9fa43d0ffe4d8fa52b2a035c1a8b6377bf13 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 18 Nov 2016 13:15:40 -0500 Subject: [PATCH 0127/1801] uri template stuff --- versions/3.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index d834251391..e6690d248e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -758,6 +758,8 @@ path | escape | prefix | separator | explode | Value | Output /letters?value={value} | true | | , | false | [a,b,c] | /letters?value=a,b,c /letters?value={value} | true | | , | true | [a,b,c] | /letters?value=a&value=b,c + + This object can be extended with [Specification Extensions](#specificationExtensions). ##### Parameter Object Examples From 00073ec09f22b51185eb08eec00adcc191c6cd2b Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 18 Nov 2016 13:22:32 -0500 Subject: [PATCH 0128/1801] Added key regex --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ab3a1b54d3..3531582624 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -400,7 +400,7 @@ Field Pattern | Type | Description | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. -All the fixed fields declared above are objects that MUST contain keys that only use the following characters: `a-zA-Z0-9.-_\`. +All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. #### Paths Object From 5107b5f3f5b2787aad82f9ef440d260109629ff9 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 18 Nov 2016 13:26:09 -0500 Subject: [PATCH 0129/1801] Changed SHOULD to MUST for security URLs --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5b3ce3821d..3ee0d88bdb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3064,7 +3064,7 @@ Field Name | Type | Validity | Description scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. -openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. URL may be relative to location of OpenAPI document. +openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3164,9 +3164,9 @@ Configuration details for a supported OAuth Flow ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL. -tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL. -refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This SHOULD be in the form of a URL. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This MUST be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. This object can be extended with [Specification Extensions](#specificationExtensions). From 8a208a0236ddfbd3bd36f4b959725fbc5f9e01e7 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 18 Nov 2016 10:33:16 -0800 Subject: [PATCH 0130/1801] corrections per discussion --- versions/3.0.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4acfd94a95..520be00597 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -755,11 +755,10 @@ By defining a subset of JSON-schema properties: Field Name | Type | Description ---|:---:|--- -type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. If `type` is `"file"`, the [`consumes`](#operationConsumes) MUST be either `"multipart/form-data"`, `" application/x-www-form-urlencoded"` or both and the parameter MUST be [`in`](#parameterIn) `"formData"`. +type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. -collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
  • `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`. default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. From 17201ba3909a4159d1116beefc53c6f68958f6ef Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 21 Nov 2016 00:38:00 -0500 Subject: [PATCH 0131/1801] Update JSON reference to include YAML --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1bcb547139..2830191b3d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -119,7 +119,7 @@ For example, if a field is said to have an array value, the JSON array represent } ``` -Even though the API is described with JSON, it is not required to use JSON for input or output. +Even though the API is _described_ with JSON and/or YAML, it is not required to use either for its own input or output. All field names in the specification are **case sensitive**. From eed483f35ae4894f6208aaecaa8db74c30e15045 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 21 Nov 2016 23:26:15 -0500 Subject: [PATCH 0132/1801] Remove distracting sentence about API formats --- versions/3.0.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2830191b3d..beb1bb145b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -119,8 +119,6 @@ For example, if a field is said to have an array value, the JSON array represent } ``` -Even though the API is _described_ with JSON and/or YAML, it is not required to use either for its own input or output. - All field names in the specification are **case sensitive**. The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. From c8158669c4be945eb7300707e2f6f130921bd6a9 Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 21 Dec 2016 11:40:36 -0500 Subject: [PATCH 0133/1801] Updates to style parameter --- versions/3.0.md | 51 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 701899f1e3..512ec0c5e9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -748,7 +748,6 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. -allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. The content of the parameter is specified in one of two ways. By passing a schema and content-type, complex parameters may be serialized and passed: @@ -763,6 +762,8 @@ Field Name | Type | Description type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"object"`. format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. style | `string` | Describes how the parameter value will be serialized depending on the specified [`type`](#parameterType). +allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. @@ -779,21 +780,18 @@ Field Name | Type | Description enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. -In order to support some of the commonly used parameter serializations, a set of `style` values are defined. +In order to support alternate ways of serializing parameters, a set of `style` values are defined. `style` | [`type`](#dataTypeType) | `in` | Comments ----------- | ------ | -------- | -------- -matrix | `string`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) -exploded-matrix | `array`, `object` | `path` | Exploded path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) +matrix | `string`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `string`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -exploded-label | `object` | `path`| Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) form | `string`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) -exploded-form | `array`, `object` | `query` | Exploded form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) -space-delimited | `array` | `query`,`path` | This option replaces `collectionFormat` equal to `ssv` -pipe-delimited | `array` | `query`,`path` | This option replaces `collectionFormat` equal to `pipes` -exploded-object | `object` | `query` | Provides a simple way of rendering nested objects using form parameters +comma-delimited | `array` | `query`, `path` | Comma separated array values. This option replaces `collectionFormat` equal to `csv`. +space-delimited | `array` | `query`, `path` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. +pipe-delimited | `array` | `query`, `path` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. +deep-object | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. -comma-delimited ??? Examples: Assuming a parameter named `value` with one of the following values: @@ -805,18 +803,17 @@ Assuming a parameter named `value` with one of the following values: ``` The following table shows examples of how those values would be rendered. -[`style`](#dataTypeFormat) | `empty` | `string` | `array` | `object` ------------ | ------ | -------- | -------- | -------- -matrix | ;value | ;value=hello | ;value=blue,black,brown | ;value=x,100,y200 -exploded-matrix | n/a | n/a | ;value=blue;value=black;value=brown | ;x=100;y=100 -label | . | .hello | .blue.black.brown | .x.100.y.200 -exploded-label | n/a | n/a | n/a | .x=100.y=200 -form | . | value=hello | value=blue,black,brown | value=x,100,y,200 -exploded-form | n/a | n/a | value=blue&value=black&value=brown | x=100&y=200 -space-delimited | n/a | n/a | blue%20black%20brown | x%20100%20y%20200 -pipe-delimited | n/a | n/a | blue\|black\|brown | x\|100\|y\|200 -exploded-object | n/a | n/a | n/a | person[name]=Bob&person[lastname]=Brown - +[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` +----------- | ------ | -------- | -------- | --------|------- +matrix | false | ;value | ;value=hello | ;value=blue,black,brown | ;value=x,100,y200 +matrix | true | n/a | n/a | ;value=blue;value=black;value=brown | ;x=100;y=100 +label | false | . | .hello | .blue.black.brown | .x.100.y.200 +label | true | n/a | n/a | n/a | .x=100.y=200 +form | false | . | value=hello | value=blue,black,brown | value=x,100,y,200 +form | true | n/a | n/a | value=blue&value=black&value=brown | x=100&y=200 +space-delimited | false | n/a | n/a | blue%20black%20brown | x%20100%20y%20200 +pipe-delimited | false | n/a | n/a | blue\|black\|brown | x\|100\|y\|200 +deep-object | true | n/a | n/a | n/a | person[name]=Bob&person[lastname]=Brown This object can be extended with [Specification Extensions](#specificationExtensions). @@ -837,7 +834,7 @@ A header parameter with an array of 64 bit integer numbers: "format": "int64" } }, - "collectionFormat": "csv" + "style": "comma-delimited" } ``` @@ -851,7 +848,7 @@ schema: items: type: integer format: int64 - collectionFormat: csv +style: comma-delimited ``` A path parameter of a string value: @@ -889,7 +886,8 @@ An optional query parameter of a string value, allowing multiple values by repea "type": "string" } }, - "collectionFormat": "multi" + "style": "form", + "explode": true } ``` @@ -902,7 +900,8 @@ schema: type: array items: type: string - collectionFormat: multi +style: form +explode: true ``` A form data with file type for a file upload: From 40c135738a4094d9e9602648dcf896c1802a7311 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 10 Jan 2017 07:40:37 -0800 Subject: [PATCH 0134/1801] Fixed small xml sample --- versions/2.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/2.0.md b/versions/2.0.md index 2c638ce9c4..51f19b5b1d 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -1872,7 +1872,7 @@ Affecting both internal and external names: }, "xml": { "name": "aliens", - "wrapped": false + "wrapped": true } } } @@ -1887,7 +1887,7 @@ animals: name: animal xml: name: aliens - wrapped: false + wrapped: true ``` ```xml From 9e556a417b0cd9612b5643a6804d412fa2a018f0 Mon Sep 17 00:00:00 2001 From: drlukeangel Date: Wed, 11 Jan 2017 19:40:04 -0800 Subject: [PATCH 0135/1801] Garbage Text in description for Pets nothing major just some ipsum text clean up --- examples/v2.0/yaml/petstore-expanded.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/v2.0/yaml/petstore-expanded.yaml b/examples/v2.0/yaml/petstore-expanded.yaml index a5fee3ad9a..588759d91a 100644 --- a/examples/v2.0/yaml/petstore-expanded.yaml +++ b/examples/v2.0/yaml/petstore-expanded.yaml @@ -24,9 +24,6 @@ paths: get: description: | Returns all pets from the system that the user has access to - Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. - - Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. operationId: findPets parameters: - name: tags From 65e7d0b0bcf080a10c1764c3d45e6f352227bcc3 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 24 Jan 2017 13:11:35 -0500 Subject: [PATCH 0136/1801] Updates based on review --- versions/3.0.md | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 512ec0c5e9..cb9043b26e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -762,8 +762,8 @@ Field Name | Type | Description type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"object"`. format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. style | `string` | Describes how the parameter value will be serialized depending on the specified [`type`](#parameterType). -allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. +allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. @@ -787,33 +787,34 @@ In order to support alternate ways of serializing parameters, a set of `style` v matrix | `string`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `string`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) form | `string`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) -comma-delimited | `array` | `query`, `path` | Comma separated array values. This option replaces `collectionFormat` equal to `csv`. -space-delimited | `array` | `query`, `path` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. -pipe-delimited | `array` | `query`, `path` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. -deep-object | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. +commaDelimited | `array` | `query`, `path` | Comma separated array values. This option replaces `collectionFormat` equal to `csv`. +spaceDelimited | `array` | `query`, `path` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. +pipeDelimited | `array` | `query`, `path` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. +deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. -Examples: -Assuming a parameter named `value` with one of the following values: +##### Style Examples + +Assuming a parameter named `color` with one of the following values: ``` - string -> "hello" + string -> "blue" array -> ["blue","black","brown"] - object -> { "x" : 100, "y" :200 } + object -> { "R" : 100, "G" :200, "B" : 150 } ``` The following table shows examples of how those values would be rendered. [`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` ----------- | ------ | -------- | -------- | --------|------- -matrix | false | ;value | ;value=hello | ;value=blue,black,brown | ;value=x,100,y200 -matrix | true | n/a | n/a | ;value=blue;value=black;value=brown | ;x=100;y=100 -label | false | . | .hello | .blue.black.brown | .x.100.y.200 -label | true | n/a | n/a | n/a | .x=100.y=200 -form | false | . | value=hello | value=blue,black,brown | value=x,100,y,200 -form | true | n/a | n/a | value=blue&value=black&value=brown | x=100&y=200 -space-delimited | false | n/a | n/a | blue%20black%20brown | x%20100%20y%20200 -pipe-delimited | false | n/a | n/a | blue\|black\|brown | x\|100\|y\|200 -deep-object | true | n/a | n/a | n/a | person[name]=Bob&person[lastname]=Brown +matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 +matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 +label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 +label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 +form | false | color= | color=blue | color=blue,black,brown | color=x,100,y,200 +form | true | color= | color=blue | color=blue&color=black&color=brown | x=100&y=200 +spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 +pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 +deepObject | true | n/a | n/a | n/a | person[name]=Bob&person[lastname]=Brown This object can be extended with [Specification Extensions](#specificationExtensions). From 5ba0fd8caeb662f3f978ab49e290826ddd08c2e9 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 24 Jan 2017 13:45:59 -0500 Subject: [PATCH 0137/1801] Updates based on comments --- versions/3.0.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index cb9043b26e..415c58e29c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -784,12 +784,12 @@ In order to support alternate ways of serializing parameters, a set of `style` v `style` | [`type`](#dataTypeType) | `in` | Comments ----------- | ------ | -------- | -------- -matrix | `string`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) -label | `string`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -form | `string`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) -commaDelimited | `array` | `query`, `path` | Comma separated array values. This option replaces `collectionFormat` equal to `csv`. -spaceDelimited | `array` | `query`, `path` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. -pipeDelimited | `array` | `query`, `path` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. +matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) +label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) +form | `primitive`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) +commaDelimited | `array` | `query`, `path` | Comma seperated array values. This option replaces `collectionFormat` equal to `csv`. +spaceDelimited | `array` | `query`, `path` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. +pipeDelimited | `array` | `query`, `path` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. @@ -798,23 +798,23 @@ deepObject | `object` | `query` | Provides a simple way of rendering nested obje Assuming a parameter named `color` with one of the following values: ``` - string -> "blue" + primitive -> "blue" array -> ["blue","black","brown"] object -> { "R" : 100, "G" :200, "B" : 150 } ``` The following table shows examples of how those values would be rendered. -[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` +[`style`](#dataTypeFormat) | `explode` | `empty` | `primitive` | `array` | `object` ----------- | ------ | -------- | -------- | --------|------- matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 -form | false | color= | color=blue | color=blue,black,brown | color=x,100,y,200 -form | true | color= | color=blue | color=blue&color=black&color=brown | x=100&y=200 +form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 +form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 -deepObject | true | n/a | n/a | n/a | person[name]=Bob&person[lastname]=Brown +deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 This object can be extended with [Specification Extensions](#specificationExtensions). From 3a8fcbb2cad2516a49771997075cdfd38b5a8132 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 24 Jan 2017 13:53:20 -0500 Subject: [PATCH 0138/1801] Fixed camelCase in examples --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 415c58e29c..59127fdece 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -835,7 +835,7 @@ A header parameter with an array of 64 bit integer numbers: "format": "int64" } }, - "style": "comma-delimited" + "style": "commaDelimited" } ``` @@ -849,7 +849,7 @@ schema: items: type: integer format: int64 -style: comma-delimited +style: commaDelimited ``` A path parameter of a string value: From 9adb4aa5ede36785bfe725f7ef45a04818c8b59e Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 24 Jan 2017 14:00:38 -0500 Subject: [PATCH 0139/1801] changed primitive back to string in style example --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 59127fdece..ce2ea0268f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -798,13 +798,13 @@ deepObject | `object` | `query` | Provides a simple way of rendering nested obje Assuming a parameter named `color` with one of the following values: ``` - primitive -> "blue" + string -> "blue" array -> ["blue","black","brown"] object -> { "R" : 100, "G" :200, "B" : 150 } ``` The following table shows examples of how those values would be rendered. -[`style`](#dataTypeFormat) | `explode` | `empty` | `primitive` | `array` | `object` +[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` ----------- | ------ | -------- | -------- | --------|------- matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 From 33b79aa156bb4270adf50e0fba7d13d3e486f6ec Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 24 Jan 2017 14:32:47 -0500 Subject: [PATCH 0140/1801] Added commaDelimited example --- versions/3.0.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ce2ea0268f..68008996d9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -763,7 +763,7 @@ Field Name | Type | Description format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. style | `string` | Describes how the parameter value will be serialized depending on the specified [`type`](#parameterType). allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. @@ -788,8 +788,8 @@ matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defin label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) form | `primitive`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) commaDelimited | `array` | `query`, `path` | Comma seperated array values. This option replaces `collectionFormat` equal to `csv`. -spaceDelimited | `array` | `query`, `path` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. -pipeDelimited | `array` | `query`, `path` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. +spaceDelimited | `array` | `query` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. +pipeDelimited | `array` | `query` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. @@ -812,6 +812,7 @@ label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 +commaDelimited | false | n/a | n/a | blue,black,brown | R,100,G,200,B,150 spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 From b017b27b4cd48860d1bdf9cdcefd61f2f48bc19c Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 27 Jan 2017 15:43:35 -0500 Subject: [PATCH 0141/1801] Updated parameter to have schema as a child property --- versions/3.0.md | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 68008996d9..1e9a4f99ef 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -737,8 +737,6 @@ There are four possible parameter types. * Header - Custom headers that are expected as part of the request. * Cookie - Used to pass a specific cookie value to the API. -For complex parameter schemas, a serialization strategy is required. -For all types, a serialization strategy must be declared. ##### Fixed Fields Field Name | Type | Description @@ -748,39 +746,25 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. -The content of the parameter is specified in one of two ways. By passing a schema and content-type, complex parameters may be serialized and passed: +The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a `Style` and `Schema` can be used to describe the structure and syntax of the parameter. Field Name | Type | Description ---|:---:|--- -content | [Content Object](#contentObject) | The content of the request body. +style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. +allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -By defining a subset of JSON-schema properties: +For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. Field Name | Type | Description ---|:---:|--- -type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"object"`. -format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. -style | `string` | Describes how the parameter value will be serialized depending on the specified [`type`](#parameterType). -allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. -items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. -default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. - -In order to support alternate ways of serializing parameters, a set of `style` values are defined. +content | [Content Object](#contentObject) | The content of the request body. + +In order to support common ways of serializing simple parameters, a set of `style` values are defined. `style` | [`type`](#dataTypeType) | `in` | Comments ----------- | ------ | -------- | -------- From 73644ca2e2bf2134b4e30a4410b5327720721b2c Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 1 Feb 2017 11:39:07 -0800 Subject: [PATCH 0142/1801] documented `requestBody` --- versions/3.0.md | 181 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 180 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1e9a4f99ef..5d17f63199 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -580,7 +580,7 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -1124,6 +1124,185 @@ application/json: ``` +##### Considerations for file uploads + +In contrast with the 2.0 specification, describing `file` input/output content in OpenAPI is +described with the same semantics as any other schema type. Specifically: + +```yaml +# content transferred with base64 encoding +schema: + type: string + format: base64 + +# content transfered in binary (octet-stream): +schema: + type: string + format: binary + +# mutliple files: +schema: + type: array + items: + type: string + format: binary +``` + +Note that the above examples apply to either input payloads (i.e. file uploads) or response payloads. + + +A `requestBody` example for submitting a file in a `POST` operation therefore may look like the following: + +```yaml +requestBody: + # any media type is accepted, functionally equivalent to `*/*` + application/octet-stream: + content: + schema: + # a binary file of any type + type: string + format: binary +``` + +In addition, specific media types may be specified: + +```yaml +# multiple, specific media types may be specified: +requestBody: + # a binary file of type png or jpeg + content: + 'image/png, image/jpeg': + schema: + type: string + format: binary +``` + +##### Support for x-www-form-urlencoded request bodies + +To submit content using form url encoding via RFC 1866, the following +definition may be used: + +```yaml +requestBody: + content: + x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # complex types are stringified to support rfc1866 + type: object + properties: {} +``` + +Note that in the above example, the contents in the `requestBody` must be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be strigified as well. + +When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `deepObject`. + +##### Special Considerations for `mutlipart` content + +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supports mechanisms for multiple file uploads. + +When passing in `multipart` types, boundaries may be used to separate sections of the content being transferred--thus, the following default `Content-Type`s are defined for `multipart/*`: + +* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` +* If the property is complex, or an array of complex values, the default Content-Type is `application/json` +* If the property is a `type: string` with `format: binary` or `format: base64` (aka a file object), the default Content-Type is `application/octet-stream` + + +Examples: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # default Content-Type for objects is `application/json` + type: object + properties: {} + profileImage: + # default Content-Type for string/binary is `application/octet-stream` + type: string + format: binary + children: + # default Content-Type for arrays is based on the `inner` type (text/plain here) + type: array + items: + type: string + addresses: + # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example) + type: array + items: + type: '#/definitions/Address' +``` + +In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `mulitpart/*` request bodies. + +#### Encoding Object + +An object representing multipart region encoding for `requestBody` objects + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field must exist in the schema as a property. To avoid collisions with specification extensions, properties may not begin with `x-`. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +#### Encoding + +A single encoding definition applied to a single schema property + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +##### Encoding Object Examples + +```yaml +requestBody: + content: + multipart/mixed: + schema: + type: object + properties: + id: + # default is text/plain + type: string + format: uuid + address: + # default is application/json + type: object + properties: {} + historyMetadata: + # need to declare XML format! + description: metadata in XML format + type: object + properties: {} + profileImage: + # default is application/octet-stream, need to declare an image type only! + type: string + format: binary +encoding: + historyMetadata: + # require XML content-type in utf-8 encoding + contentType: application/xml; charset=utf-8 + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg +``` #### Items Object From 9cbcaa6adfa64dbb2043863005e3a0d919cffe89 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 1 Feb 2017 11:44:38 -0800 Subject: [PATCH 0143/1801] removed `file` type --- versions/3.0.md | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5d17f63199..13dfc58654 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -145,13 +145,11 @@ By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or ` Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. -An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file. - Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. -Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). +Types that are not accompanied by a `format` property follow their definition from the JSON Schema. The formats defined by the OAS are: @@ -742,7 +740,7 @@ There are four possible parameter types. Field Name | Type | Description ---|:---:|--- name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie". +in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. @@ -890,28 +888,6 @@ style: form explode: true ``` -A form data with file type for a file upload: -```json -{ - "name": "avatar", - "in": "formData", - "description": "The avatar of the user", - "required": true, - "schema": { - "type": "file" - } -} -``` - -```yaml -name: avatar -in: formData -description: The avatar of the user -required: true -schema: - type: file -``` - #### Request Body Object Describes a single request body. From f51b239bd71ebcf522f727c7359403ce10e87b9c Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 1 Feb 2017 11:49:56 -0800 Subject: [PATCH 0144/1801] fix #878 --- .../json/resources/resourceWithLinkedDefinitions_part1.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json b/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json index 127973717b..a79ee51499 100644 --- a/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json +++ b/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json @@ -24,13 +24,13 @@ "200": { "description": "pet response", "schema": { - "$ref": "#/definitions/Pet" + "$ref": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json#/definitions/Pet" } }, "default": { "description": "error payload", "schema": { - "$ref": "#/definitions/ErrorModel" + "$ref": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json#/definitions/ErrorModel" } } } From c5380d36498247cdad0f4192e0b4d0c23f69c8b5 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 1 Feb 2017 16:04:47 -0800 Subject: [PATCH 0145/1801] fix spelling --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 13dfc58654..dfa39e66e2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1116,7 +1116,7 @@ schema: type: string format: binary -# mutliple files: +# multiple files: schema: type: array items: From 0df060a4f1ff4cd437b4f3e8ad1655280963901e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 3 Feb 2017 11:09:35 -0800 Subject: [PATCH 0146/1801] applied feedback from OAI TDC call --- versions/3.0.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dfa39e66e2..50a1aee4c9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -527,7 +527,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "items": { "type": "string" }, - "style": "comma-delimited" + "style": "commaDelimited" } ] } @@ -578,7 +578,7 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -1115,18 +1115,10 @@ schema: schema: type: string format: binary - -# multiple files: -schema: - type: array - items: - type: string - format: binary ``` Note that the above examples apply to either input payloads (i.e. file uploads) or response payloads. - A `requestBody` example for submitting a file in a `POST` operation therefore may look like the following: ```yaml @@ -1230,9 +1222,7 @@ An object representing multipart region encoding for `requestBody` objects ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field must exist in the schema as a property. To avoid collisions with specification extensions, properties may not begin with `x-`. - -This object can be extended with [Specification Extensions](#specificationExtensions). +The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field must exist in the schema as a property. #### Encoding @@ -1242,6 +1232,9 @@ A single encoding definition applied to a single schema property Field Name | Type | Description ---|:---:|--- Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. +Style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the `style` property +explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. +Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. This object can be extended with [Specification Extensions](#specificationExtensions). From 46c32035f5e7112c7aef5366032e0c0f9d47f9c4 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 3 Feb 2017 11:13:19 -0800 Subject: [PATCH 0147/1801] applied feedback from OAI TDC call --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 50a1aee4c9..d222596152 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1232,6 +1232,7 @@ A single encoding definition applied to a single schema property Field Name | Type | Description ---|:---:|--- Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. +Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. Style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the `style` property explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. From 89bb140c3134ccfe526a4121b47bb81bd112acb5 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 3 Feb 2017 15:15:19 -0800 Subject: [PATCH 0148/1801] nitpick fixes --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d222596152..11b34d7faf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1213,7 +1213,7 @@ requestBody: type: '#/definitions/Address' ``` -In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `mulitpart/*` request bodies. +In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `mulitpart/*` and `x-www-form-urlencoded` request bodies. #### Encoding Object @@ -1231,7 +1231,7 @@ A single encoding definition applied to a single schema property ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. +contentType | `string` | **Required.** The content-type to use for encoding a specific property. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. Style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the `style` property explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. From 018cc27ee34f473611aba5171721d1ae20f2ed31 Mon Sep 17 00:00:00 2001 From: Darrel Date: Sun, 5 Feb 2017 12:31:57 -0800 Subject: [PATCH 0149/1801] Added clarification on the use of relative references in URLs --- versions/3.0.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1e9a4f99ef..e8747e73da 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -26,6 +26,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Format](#format) - [File Structure](#file-structure) - [Data Types](#data-types) + - [Relative References In Urls](#relativeReferences) - [Schema](#schema) - [OpenAPI Object](#openapi-object) - [Info Object](#info-object) @@ -169,6 +170,14 @@ date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc. dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) password | `string` | `password` | Used to hint UIs the input needs to be obscured. +### Relative References In URLs + +Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). +Relative references are resolved using the URLs defined in the [Servers array](#servers) as a Base URI. + +Relative references used in $ref are processed as per [JSON Schema](http://json-schema.org/latest/json-schema-core.html), i.e. using the URL of the current document as the base URI. + + ### Schema #### OpenAPI Object @@ -317,7 +326,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | A URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. +url | `string` | A absolute URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template From 0abf7f619b4cd1659181f6ea915b9c8e5e9e9d69 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 6 Feb 2017 16:13:32 -0800 Subject: [PATCH 0150/1801] remove duplicate --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 11b34d7faf..0c97e78ea8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1235,7 +1235,6 @@ Field Name | Type | Description Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. Style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the `style` property explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. -Content-Type | `string` | **Required.** The content-type to use for encoding a specific property. This object can be extended with [Specification Extensions](#specificationExtensions). From 0b0c283d9d4aef865ba5a5bfcbf95ecab32f33f9 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 9 Feb 2017 09:20:37 -0800 Subject: [PATCH 0151/1801] Changed JSON Reference href --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e8747e73da..c7656c8aea 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -175,8 +175,7 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). Relative references are resolved using the URLs defined in the [Servers array](#servers) as a Base URI. -Relative references used in $ref are processed as per [JSON Schema](http://json-schema.org/latest/json-schema-core.html), i.e. using the URL of the current document as the base URI. - +Relative references used in $ref are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), i.e. using the URL of the current document as the base URI. ### Schema From aa4f873d8ccd4d07b7638e6cfd0fd29931d307ea Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 10 Feb 2017 22:42:56 -0500 Subject: [PATCH 0152/1801] Fixes to parameter and requestBody --- versions/3.0.md | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2e792ae612..999e6cbf5a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -752,19 +752,19 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](# @parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a `Style` and `Schema` can be used to describe the structure and syntax of the parameter. +For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSchema) can be used to describe the structure and syntax of the parameter. Field Name | Type | Description ---|:---:|--- -style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. +style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. +For more complex scenarios a [`content`](#paramterContent) object can be used to define the media-type and schema of the parameter. Field Name | Type | Description ---|:---:|--- @@ -776,8 +776,8 @@ In order to support common ways of serializing simple parameters, a set of `styl ----------- | ------ | -------- | -------- matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -form | `primitive`, `array`, `object` | `query`| Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8) -commaDelimited | `array` | `query`, `path` | Comma seperated array values. This option replaces `collectionFormat` equal to `csv`. +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` equal to `csv`. +simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). spaceDelimited | `array` | `query` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. pipeDelimited | `array` | `query` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. @@ -802,7 +802,8 @@ label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 -commaDelimited | false | n/a | n/a | blue,black,brown | R,100,G,200,B,150 +simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 +simple | true | n/a | n/a | blue,black,brown | R=100,G=200,B=150 spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 @@ -896,6 +897,28 @@ style: form explode: true ``` +A free-form query parameter, allowing undefined parameters of a specific type: +```json +{ + "in": "query", + "name": "freeForm", + "type": "object", + "additionalProperties": { + "type": "integer" + }, + "style": "form" +} +``` + +```yaml +in: query +name: freeForm +type: object +additionalProperties: + type: integer +style: form +``` + #### Request Body Object Describes a single request body. @@ -1176,7 +1199,7 @@ requestBody: Note that in the above example, the contents in the `requestBody` must be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be strigified as well. -When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `deepObject`. +When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. ##### Special Considerations for `mutlipart` content @@ -1239,10 +1262,10 @@ A single encoding definition applied to a single schema property ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | **Required.** The content-type to use for encoding a specific property. -Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -Style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the `style` property -explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. +contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. +Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. This object can be extended with [Specification Extensions](#specificationExtensions). From 75ec035be04a579dd6305b11cbf14bbeab7f611d Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 10 Feb 2017 23:20:51 -0500 Subject: [PATCH 0153/1801] Fix simple exploded --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 999e6cbf5a..bd113b4184 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -803,7 +803,7 @@ label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 -simple | true | n/a | n/a | blue,black,brown | R=100,G=200,B=150 +simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150 spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 From ea3a68a6b6d118cab2d3d3e295f087e0e36d8bd4 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Thu, 16 Feb 2017 13:08:57 -0800 Subject: [PATCH 0154/1801] [ToC] Add Server and indent Contact and License Looks like I missed the Server object when generating the original ToC Also indenting Contact and License since they are children of the Host object and not used elsewhere Signed-off-by: Rob Dolin --- versions/3.0.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2e792ae612..bbd5bac085 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -31,8 +31,9 @@ Additional utilities can also take advantage of the resulting files, such as tes - [OpenAPI Object](#openapi-object) - [Info Object](#info-object) - [Host Object](#host-object) - - [Contact Object](#contact-object) - - [License Object](#license-object) + - [Contact Object](#contact-object) + - [License Object](#license-object) + - [Server Object](#server-object) - [Components Object](#components-object) - [Paths Object](#paths-object) - [Path Item Object](#path-item-object) From 2988a1162ee1180df5587e4632ac108d006514f0 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 16 Feb 2017 14:03:34 -0800 Subject: [PATCH 0155/1801] minor doc updates for #589 --- versions/3.0.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2e792ae612..397536523f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1350,12 +1350,16 @@ items: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. -It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. -However, it is expected from the documentation to cover a successful operation response and any known errors. +It is not expected from the documentation to necessarily cover all possible HTTP +response codes, since they may not be known in advance. However, it is expected +from the documentation to cover a successful operation response and any +known errors. -The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. +The `default` MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification. -The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. +The `Responses Object` MUST contain at least one response code, and it +SHOULD be the response for a successful operation call. ##### Fixed Fields Field Name | Type | Description @@ -1417,14 +1421,15 @@ default: ``` #### Response Object -Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. +Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. -content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. +content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. @@ -1432,9 +1437,10 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -`*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` +`*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` -Representations may take the form of a wildcard (`*`) to designate any `Content-Type`, or a regular expression for matching a specific type +Representations may take the form of a wildcard (`*`) to designate any `Content-Type`, +or a regular expression for matching a specific type This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1492,7 +1498,7 @@ representations: type: string ``` -Response with headers: +Plain text response with headers: ```json { From 322d7704b019689a45ff7cf68a05d7d44abd5592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Collignon=20=5BIoT=2Ebzh=5D?= Date: Fri, 17 Feb 2017 16:20:14 +0100 Subject: [PATCH 0156/1801] Fix a typo --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbd5bac085..d2931f98e7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -344,7 +344,7 @@ servers: description: Production server ``` -The following shows how templates an be used for a server configuration +The following shows how templates can be used for a server configuration ```yaml servers: From 6e6c4f68faac7d85fd47dd54d6ac7a8097b9e3d8 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 17 Feb 2017 17:18:42 -0500 Subject: [PATCH 0157/1801] Callback review and preliminary message expression syntax --- versions/3.0.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bbd5bac085..2587d03b76 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1555,15 +1555,70 @@ description: object created #### Callback Object -A container for possible out-of band callbacks from an operation. A callback may be returned from an operation, calling back to the path specified in the operation object. +A map of possible out-of band callbacks related to the parent operation. Each value in the map is an [operation object](#operationObject) that describes a request that may be initiated by the API provider and the responses expected. The key value used to identify callback object is an expression, that when evaluated at runtime, identifies a URL to used for the callback operation. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback payload structure +Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). +##### Key Expression + +The key used to identify the callback object is also an expression that can be evaluated on the runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be "$request.body.url". However, the expression syntax enables accessing the complete HTTP message and reaching into any payload that can map to an object/array/property data model. + +The expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = target source *( "." bind-token [ index ]] ) + target = ("$request." | "$response.") + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body" *( index | "." name ) + index = "[" *(digit) "]" + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + +Given the following HTTP request: + +```http +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 +Host: example.org +Content-Type: application/json +Content-Length: 123 + +{ + "failedurl" : "http://clientdomain.com/failed" + "successurls : [ + "http://clientdomain.com/fast", + "http://clientdomain.com/medium", + "http://clientdomain.com/slow" + ] +} + +201 Created +Location: http://example.org/subscription/1 + +``` + +Here are the examples of how the various expressions evaluate, assuming a the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. + +Expression | Value +---|:--- +$request.path.eventType | myevent +$request.query.queryUrl | http://clientdomain.com/stillrunning +$request.header.content-Type | application/json +$request.body.failed | http://clientdomain.com/stillrunning +$request.body.successurls[2] | http://clientdomain.com/medium +$response.header.Location | http://example.org/subscription/1 + ##### Callback Object Example @@ -1572,7 +1627,7 @@ A callback to the URL specified by the `url` parameter in the request ```yaml myWebhook: - '$request.url': + '$request.body.url': post: body: name: postResponse From 4197f43faf1eb674dc14d264d33a0a480aef22be Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 20 Feb 2017 15:47:59 -0500 Subject: [PATCH 0158/1801] Updates to align links and callbacks --- versions/3.0.md | 110 ++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7cbc3f5d0d..93738797c7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1561,38 +1561,26 @@ description: object created #### Callback Object -A map of possible out-of band callbacks related to the parent operation. Each value in the map is an [operation object](#operationObject) that describes a request that may be initiated by the API provider and the responses expected. The key value used to identify callback object is an expression, that when evaluated at runtime, identifies a URL to used for the callback operation. +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is an [operation object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback request and expected responses +Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). ##### Key Expression -The key used to identify the callback object is also an expression that can be evaluated on the runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be "$request.body.url". However, the expression syntax enables accessing the complete HTTP message and reaching into any payload that can map to an object/array/property data model. +The key used to identify the callback object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be "$request.body(/url)". +However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed. +This includes accessing any part of a body that can be accessed using a JSONPointer [RFC6901](https://tools.ietf.org/html/rfc6901). -The expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax -``` - expression = target source *( "." bind-token [ index ]] ) - target = ("$request." | "$response.") - source = ( header-reference | query-reference | path-reference | body-reference ) - header-reference = "header." token - query-reference = "query." name - path-reference = "path." name - body-reference = "body" *( index | "." name ) - index = "[" *(digit) "]" - name = *( char ) - char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) - token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) -``` - -The `name` identifier is case-sensitive, whereas `token` is not. - -Given the following HTTP request: +For example, given the following HTTP request: ```http POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 @@ -1618,11 +1606,13 @@ Here are the examples of how the various expressions evaluate, assuming a the ca Expression | Value ---|:--- +$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +$method | POST $request.path.eventType | myevent $request.query.queryUrl | http://clientdomain.com/stillrunning $request.header.content-Type | application/json -$request.body.failed | http://clientdomain.com/stillrunning -$request.body.successurls[2] | http://clientdomain.com/medium +$request.body(/failed) | http://clientdomain.com/stillrunning +$request.body(/successurls/2) | http://clientdomain.com/medium $response.header.Location | http://example.org/subscription/1 @@ -1633,7 +1623,7 @@ A callback to the URL specified by the `url` parameter in the request ```yaml myWebhook: - '$request.body.url': + '$request.body(/url)': post: body: name: postResponse @@ -1746,7 +1736,7 @@ Field Name | Type | Description href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. -headers | Link Headers Object | an Object representing headers to pass to the linked resource. +headers | Link Headers Object | an Object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1757,7 +1747,7 @@ Because of the potential for name clashes, consider the `href` syntax as the pre #### Response Payload Values -Payload values are only available in parseable response payloads which match the advertised media-type. +Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can map to the object/array/property model syntax used by variable expressions. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. @@ -1800,23 +1790,41 @@ color: ["red", "green", "blue"] The variables generated can be used in locations prescribed by the definition. -### Variable substitution +### Variable substitution In all cases, _variables_ from request and responses may be substituted for link generation. -The table below designates the source of the substitution value and the syntax for accessing it: +The table below provides examples of variable expressions and examples of their use in a value: -Source Location | reference identifier | example value | example reference | notes ----|:---|:---|:---|:--- +Source Location | variable expression | example reference | notes +---|:---|:---|:--- HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation -Requested content type | `$accepts` | `/users/3?format={$accepts}` | -Request parameter | `$request` | `/users/{$request.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers -Request body | `$requestBody` | `/users/{$requestBody.user.uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` | +Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers +Request body | `$request.body` | `/users/{$request.body(/user/uuid)}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself Request URL | `$url` | `/track?url={$url}` | -Response value | `$response` | `{$response.uuid}` | Only the payload in the response can be accessed with the `$response` syntax -Response header | `$responseHeader` | `{$responseHeader.Server}` | Single header values only are available. +Response value | `$response.body` | `{$response.body(/uuid)}` | Only the payload in the response can be accessed with the `$response` syntax. +Response header | `$response.header` | `{$response.header.Server}` | From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. For responses, the response payload may be used with the `$response` syntax. -For both requests and responses, values will be substituted in the link in sections designated with the `$request` or `$response` keyword, surrounded by curly brackets `{}`. +For both requests and responses, values will be substituted in the link in sections designated with a variable expression, surrounded by curly brackets `{}`. + +The variable expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = ( "$url" | "$method" | "$request." [ source ] | "$response." [ source ]) + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body(" fragment ")" + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) with any instances of `(` or `)` escaped + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + ### Request parameter example Computing a link from a request operation like such: @@ -1848,10 +1856,10 @@ Can be used in a link like this: ```yaml Addresses: - href: '/users/{$request.id}/department' + href: '/users/{$request.path.id}/department' ``` -Where the `$request.id` is the value passed in the request to `/users/{id}`. +Where the `$request.path.id` is the value passed in the request to `/users/{id}`. For a `id` value of `10101110`, the generated link would be: ```yaml @@ -1862,7 +1870,7 @@ href: '/users/10101110/department' ```yaml Addresses: - href: '/users/{$response.uuid}/address' + href: '/users/{$response.body(/uuid)}/address' ``` Where the `$response.uuid` from the example above would yield the target: @@ -1876,7 +1884,7 @@ And the array example: ```yaml ColorSelection: - href: 'http://colors.my-server.com/colors/{$response.color}' + href: 'http://colors.my-server.com/colors/{$response.body(/color)}' ``` Would produce the following links: @@ -2034,26 +2042,26 @@ components: # returns array of '#/components/definitions/repository' operationId: getRepositoriesByOwner parameters: - username: $response.username + username: $response.body(/username) UserRepository: # returns '#/components/definitions/repository' operationId: getRepository parameters: - username: $response.owner.username - slug: $response.slug + username: $response.body(/owner/username) + slug: $response.body.slug RepositoryPullRequests: # returns '#/components/definitions/pullrequest' operationId: getPullRequestsByRepository params: - username: $response.owner.username - slug: $response.slug + username: $response.body(/owner/username) + slug: $response.body(/slug) PullRequestMerge: # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge operationId: mergePullRequest parameters: - username: $response.user.username # Should be $response.author.username? - slug: $response.repository.slug - pid: $response.id + username: $response.body(/user/username) # Should be $response.author.username? + slug: $response.body(/repository/slug) + pid: $response.body(/id) definitions: user: type: object @@ -2089,7 +2097,7 @@ components: links: UserRepositories: # returns array of '#/components/definitions/repository' - href: '/2.0/repositories/{$response.username}' + href: '/2.0/repositories/{$response.body(/username)}' ``` or an absolute `href`: @@ -2099,7 +2107,7 @@ components: links: UserRepositories: # returns array of '#/components/definitions/repository' - href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.username}' + href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body(/username)}' ``` @@ -2131,7 +2139,7 @@ components: UserCommitHistory: operationId: userCommitHistory parameters: - username: $response.user.username + username: $response.body(/user/username) page: 0 ``` From 5d93c5469c8a7fcf62324b5b63eb3e4b465ca629 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 20 Feb 2017 15:56:23 -0800 Subject: [PATCH 0159/1801] added clarification for examples --- versions/3.0.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fb5e32c04b..f8889fee8b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -765,7 +765,7 @@ Field Name | Type | Description allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. +For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. Note that because the `content` object provides the appropriate serialization between examples and content serialization strategies, the `example` is not allowed in the simple `schema` scenario. Field Name | Type | Description ---|:---:|--- @@ -1068,8 +1068,8 @@ Each content type object provides schema and examples for a the media type ident Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the content type. -example | [Example Object](#exampleObject) | Example of the content type. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type +example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the _content_ type. ##### Patterned Fields Field Pattern | Type | Description @@ -1102,10 +1102,10 @@ application/json: schema: $ref: "#/definitions/Pet" examples: + # converted directly from YAML to JSON - name: Fluffy petType: Cat - - name: Rover - petType: Frog + - {"name": "Rover", "petType": "Frog"} ``` @@ -2153,13 +2153,15 @@ description: Pets operations #### Examples Object -Anywhere an `example` may be given, allow a $ref object. -This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`. +Anywhere an `example` may be given, a JSON Reference may be used, with the +explicit restriction that examples having a JSON format with object named +`$ref` are not allowed. This does mean that `example`, structurally, can be +either a string primitive or an object, similar to `additionalProperties`. -In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. - -In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. -Tooling Specifications may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. +In all cases, the payload is expected to be compatible with the type schema +for the value that it is accompanying. Tooling implementations may choose to +validate compatibility automatically, and reject the example value(s) if they +are not compatible. ```yaml # in a model @@ -2181,20 +2183,18 @@ definitions: - {"bar": "baz"} 'application/xml': examples: - - - $ref: 'http://foo.bar#/examples/address-example.xml' + - $ref: 'http://foo.bar#/examples/address-example.xml' 'text/plain': examples: - - - $ref: 'http://foo.bar#/examples/address-example.txt' + - $ref: 'http://foo.bar#/examples/address-example.txt' # in a parameter parameters: - - name: 'zip' + - name: 'zipCode' in: 'query' type: 'string' - format: 'zip' + format: 'zip-code' example: $ref: 'http://foo.bar#/examples/zip-example' # in a response, note the plural `examples`: From 3ec85a2521f9d4404a881356c66fb8e63962854f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 20 Feb 2017 16:39:36 -0800 Subject: [PATCH 0160/1801] fixed zip example --- versions/3.0.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index f8889fee8b..23bebf5ddb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2193,10 +2193,11 @@ definitions: parameters: - name: 'zipCode' in: 'query' - type: 'string' - format: 'zip-code' - example: - $ref: 'http://foo.bar#/examples/zip-example' + schema: + type: 'string' + format: 'zip-code' + example: + $ref: 'http://foo.bar#/examples/zip-example' # in a response, note the plural `examples`: responses: 200: From 61ac60c9d23852ee50b40ba42434929204c6883a Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 20 Feb 2017 18:20:55 -0800 Subject: [PATCH 0161/1801] Updated Schema Object --- versions/3.0.md | 65 ++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fb5e32c04b..5e424bb67b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2260,18 +2260,14 @@ $ref: 'definitions.yaml#/Pet' The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. -This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. -On top of this subset, there are extensions provided by this specification to allow for more complete documentation. +This object is an extended subset of the [JSON Schema Specification Draft 4](http://json-schema.org/). Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. The following properties are taken directly from the JSON Schema definition and follow the same specifications: -- $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) -- format (See [Data Type Formats](#dataTypeFormat) for further details) + - title -- description ([CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation) -- default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) - multipleOf - maximum - exclusiveMaximum @@ -2287,25 +2283,32 @@ The following properties are taken directly from the JSON Schema definition and - minProperties - required - enum -- type - -The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. -Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead. -- items -- allOf -- oneOf -- anyOf -- not -- properties -- additionalProperties + +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. +- type - Value MUST be a string. Multiple types via an array are not supported. +- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present of the `type` is `array`. +- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). +- additionalProperties - Value can be boolean or object. If object, definition MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). +- $ref - As a [Reference Object](#referenceObject). +- description ([CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation). +- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. +- default - Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object. + +Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. Other than the JSON Schema subset fields, the following fields may be used for further schema documentation. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. -readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as `readOnly` being `true` SHOULD NOT be in the `required` list of the defined schema. Default value is `false`. +nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. +discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. See [Composition and Inheritance](#schemaComposition) for more details. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but MUST NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. @@ -2314,7 +2317,7 @@ Field Name | Type | Description This object can be extended with [Specification Extensions](#specificationExtensions). -###### Composition and Inheritance (Polymorphism) +###### Composition and Inheritance (Polymorphism) The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. @@ -2323,7 +2326,9 @@ While composition offers model extensibility, it does not imply a hierarchy betw To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. -The value of the chosen property has to be the friendly name given to the model under the `definitions` property. +There are are two ways to define the value of a discriminator for an inheriting instance. +- Use the definition's name. +- Override the definition's name by overriding the property with a new value. If exists, this takes precedence over the definition's name. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. ###### XML Modeling @@ -2335,8 +2340,6 @@ The [XML Object](#xmlObject) contains additional information about the available ###### Primitive Sample -Unlike previous versions of Swagger, OpenAPI Schema definitions can be used to describe primitive and arrays as well. - ```json { "type": "string", @@ -2362,7 +2365,7 @@ format: email "type": "string" }, "address": { - "$ref": "#/definitions/Address" + "$ref": "#/components/definitions/Address" }, "age": { "type": "integer", @@ -2381,7 +2384,7 @@ properties: name: type: string address: - $ref: '#/definitions/Address' + $ref: '#/components/definitions/Address' age: type: integer format: int32 @@ -2413,7 +2416,7 @@ For a string to model mapping: { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ComplexModel" + "$ref": "#/components/definitions/ComplexModel" } } ``` @@ -2421,7 +2424,7 @@ For a string to model mapping: ```yaml type: object additionalProperties: - $ref: '#/definitions/ComplexModel' + $ref: '#/components/definitions/ComplexModel' ``` ###### Model with Example @@ -2599,7 +2602,7 @@ definitions: ] }, "Cat": { - "description": "A representation of a cat", + "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", "allOf": [ { "$ref": "#/definitions/Pet" @@ -2626,7 +2629,7 @@ definitions: ] }, "Dog": { - "description": "A representation of a dog", + "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", "allOf": [ { "$ref": "#/definitions/Pet" @@ -2665,7 +2668,7 @@ definitions: required: - name - petType - Cat: + Cat: ## "Cat" will be used as the discriminator value description: A representation of a cat allOf: - $ref: '#/definitions/Pet' @@ -2682,7 +2685,7 @@ definitions: - aggressive required: - huntingSkill - Dog: + Dog: ## "Dog" will be used as the discriminator value description: A representation of a dog allOf: - $ref: '#/definitions/Pet' From 507049f98482bb097aff2f3d67e1fb5f1ab08623 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 20 Feb 2017 18:46:28 -0800 Subject: [PATCH 0162/1801] Minor XML Sample fix --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fb5e32c04b..b271aba2ae 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2992,7 +2992,7 @@ Affecting both internal and external names: }, "xml": { "name": "aliens", - "wrapped": false + "wrapped": true } } } @@ -3007,7 +3007,7 @@ animals: name: animal xml: name: aliens - wrapped: false + wrapped: true ``` ```xml From 4068d0097778f9add9fe035f8c4ca0529fed996f Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 20 Feb 2017 22:06:43 -0500 Subject: [PATCH 0163/1801] Fixed property name of callbacks --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 93738797c7..8dc62da0d2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -589,7 +589,7 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation. +callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. @@ -1559,7 +1559,7 @@ Response with no return value: description: object created ``` -#### Callback Object +#### Callbacks Object A map of possible out-of band callbacks related to the parent operation. Each value in the map is an [operation object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses. From 94305bacc2169b87360d392256b6fbe3ccd0c632 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 20 Feb 2017 19:21:53 -0800 Subject: [PATCH 0164/1801] Updated Header Object, Removed Items Object --- versions/3.0.md | 122 +++++++++++------------------------------------- 1 file changed, 26 insertions(+), 96 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index b271aba2ae..c14192967d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -43,7 +43,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Request Body Object](#request-body-object) - [Content Object](#content-object) - [Content Type Object](#content-type-object) - - [Items Object](#items-object) - [Responses Object](#responses-object) - [Response Object](#response-object) - [Headers Object](#headers-object) @@ -1282,71 +1281,6 @@ encoding: contentType: image/png, image/jpeg ``` -#### Items Object - -A limited subset of JSON-Schema's items object. -It is used by parameter definitions. - -##### Fixed Fields -Field Name | Type | Description ----|:---:|--- -type | `string` | **Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed. -format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. -items | [Items Object](#itemsObject) | **Required if [`type`](#itemsType) is "array".** Describes the type of items in the array. -collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. -default | * | Declares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#itemsType) for the data type. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. - -This object can be extended with [Specification Extensions](#specificationExtensions). - -##### Items Object Examples - -Items must be of type string and have the minimum length of 2 characters: - -```json -{ - "type": "string", - "minLength": 2 -} -``` - -```yaml -type: string -minLength: 2 -``` - -An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive): - -```json -{ - "type": "array", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 63 - } -} -``` - -```yaml -type: array -items: - type: integer - minimum: 0 - maximum: 63 -``` - #### Responses Object A container for the expected responses of an operation. @@ -1606,15 +1540,21 @@ Rate-limit headers: { "X-Rate-Limit-Limit": { "description": "The number of allowed requests in the current period", - "type": "integer" + "schema": { + "type": "integer" + } }, "X-Rate-Limit-Remaining": { "description": "The number of remaining requests in the current period", - "type": "integer" + "schema": { + "type": "integer" + } }, "X-Rate-Limit-Reset": { "description": "The number of seconds left in the current period", - "type": "integer" + "schema": { + "type": "integer" + } } } ``` @@ -1622,13 +1562,16 @@ Rate-limit headers: ```yaml X-Rate-Limit-Limit: description: The number of allowed requests in the current period - type: integer + schema: + type: integer X-Rate-Limit-Remaining: description: The number of remaining requests in the current period - type: integer + schema: + type: integer X-Rate-Limit-Reset: description: The number of seconds left in the current period - type: integer + schema: + type: integer ``` #### Examples Object @@ -2084,28 +2027,12 @@ In the above, the link for `UserCommitHistory` points to the operation `getUserC #### Header Object -Field Name | Type | Description ----|:---:|--- -description | `string` | A short description of the header. -type | `string` | **Required.** The type of the object. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. -format | `string` | The extending format for the previously mentioned [`type`](#stType). See [Data Type Formats](#dataTypeFormat) for further details. -items | [Items Object](#itemsObject) | **Required if [`type`](#stType) is "array".** Describes the type of items in the array. -collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. -default | * | Declares the value of the header that the server will use if none is provided. (Note: "default" has no meaning for required headers.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#headerDefault) for the header. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. +The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes: -This object can be extended with [Specification Extensions](#specificationExtensions). +1. `name` MUST NOT be specified, it is given in the [Headers Object](#headersObject). +1. `in` MUST NOT be specified, it is implicitly in `header`. +1. All traits that are affected by the location MUST follow the location of `header` (for example, [`style`](#parameterStyle)). +1. `required` is by default `true`. ##### Header Object Example @@ -2114,13 +2041,16 @@ A simple header with of an integer type: ```json { "description": "The number of allowed requests in the current period", - "type": "integer" + "schema": { + "type": "integer" + } } ``` ```yaml description: The number of allowed requests in the current period -type: integer +schema: + type: integer ``` #### Tag Object @@ -2708,7 +2638,7 @@ See examples for expected behavior. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within the Items Object (`items`), it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. +name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. namespace | `string` | The URL of the namespace definition. Value SHOULD be in the form of a URL. prefix | `string` | The prefix to be used for the [name](#xmlName). attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. From bc9da3180d3903cbfc96baa0e8c6fdae537696cf Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 21 Feb 2017 11:44:41 -0500 Subject: [PATCH 0165/1801] Fixed callback example --- versions/3.0.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8dc62da0d2..18332e35dd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1625,10 +1625,12 @@ A callback to the URL specified by the `url` parameter in the request myWebhook: '$request.body(/url)': post: - body: - name: postResponse - schema: - $ref: '#/definitions/SomePayload' + requestBody: + description: Callback payload + content: + 'application/json' + schema: + $ref: '#/components/definitions/SomePayload' responses: 200: description: webhook successfully processed an no retries will be performed From d16249768e64d6fd8f58419994f341e9156fc201 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 21 Feb 2017 11:32:12 -0800 Subject: [PATCH 0166/1801] fixes per @OAI/TDC discussion --- versions/3.0.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 23bebf5ddb..330442c4ed 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -764,8 +764,13 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. -For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. Note that because the `content` object provides the appropriate serialization between examples and content serialization strategies, the `example` is not allowed in the simple `schema` scenario. +For more complex scenarios a `content` object can be used to define the media-type +and schema of the parameter. This option is mutually exclusive with the simple scenario +above. When `example` or `examples` are provided in conjunction with the `schema` object, +the example must follow the prescribed serialization strategy for the parameter. Field Name | Type | Description ---|:---:|--- @@ -1068,8 +1073,8 @@ Each content type object provides schema and examples for a the media type ident Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type -example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the _content_ type. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description From 6a9f40e2bb265a82d22af8ea46cad4b5f3405be3 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 21 Feb 2017 11:37:10 -0800 Subject: [PATCH 0167/1801] added version clarification --- versions/3.0.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index b271aba2ae..897230f14b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -74,12 +74,13 @@ Additional utilities can also take advantage of the resulting files, such as tes ## Revision History Version | Date | Notes ---- | --- | --- -2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative -2.0 | 2014-09-08 | Release of Swagger 2.0 -1.2 | 2014-03-14 | Initial release of the formal document. -1.1 | 2012-08-22 | Release of Swagger 1.1 -1.0 | 2011-08-10 | First release of the Swagger Specification +--- | --- | --- +3.0.0 | 2017-02-28 | Implementor's draft of the 3.0 specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification ## Definitions @@ -221,7 +222,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). +version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ may evolve at an entirely different rate. This object can be extended with [Specification Extensions](#specificationExtensions). From 546f43710247326eb8cfa65d1c081488c26ff7c2 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 13:02:47 -0800 Subject: [PATCH 0168/1801] Headers updates - Removed headers being required by default. - Added note about header names being case insensitive. --- versions/3.0.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index c14192967d..32d68d8033 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -740,7 +740,7 @@ A unique parameter is defined by a combination of a [name](#parameterName) and [ There are four possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. -* Header - Custom headers that are expected as part of the request. +* Header - Custom headers that are expected as part of the request. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. * Cookie - Used to pass a specific cookie value to the API. @@ -1279,7 +1279,7 @@ encoding: profileImage: # only accept png/jpeg contentType: image/png, image/jpeg -``` +```fi #### Responses Object @@ -1525,7 +1525,7 @@ myWebhook: #### Headers Object -Lists the headers that can be sent as part of a response. +Lists the headers that can be sent as part of a response. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. ##### Patterned Fields Field Pattern | Type | Description @@ -2032,7 +2032,6 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje 1. `name` MUST NOT be specified, it is given in the [Headers Object](#headersObject). 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST follow the location of `header` (for example, [`style`](#parameterStyle)). -1. `required` is by default `true`. ##### Header Object Example From 506cc7810fd22e9a3fa60a6d8345a4ab3c2814ca Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 13:10:06 -0800 Subject: [PATCH 0169/1801] oops --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 32d68d8033..91fd36279b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1279,7 +1279,7 @@ encoding: profileImage: # only accept png/jpeg contentType: image/png, image/jpeg -```fi +``` #### Responses Object From b268c06de2d3f7d4781151de61429e8759cedd8a Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 21 Feb 2017 17:20:49 -0500 Subject: [PATCH 0170/1801] Updates to Callback/Links based on meeting --- versions/3.0.md | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 18332e35dd..53d08edc5d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1575,7 +1575,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Key Expression The key used to identify the callback object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be "$request.body(/url)". +A simple example might be `$request.body#/url`. However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSONPointer [RFC6901](https://tools.ietf.org/html/rfc6901). @@ -1611,8 +1611,8 @@ $method | POST $request.path.eventType | myevent $request.query.queryUrl | http://clientdomain.com/stillrunning $request.header.content-Type | application/json -$request.body(/failed) | http://clientdomain.com/stillrunning -$request.body(/successurls/2) | http://clientdomain.com/medium +$request.body#/failed | http://clientdomain.com/stillrunning +$request.body#/successurls/2 | http://clientdomain.com/medium $response.header.Location | http://example.org/subscription/1 @@ -1623,7 +1623,7 @@ A callback to the URL specified by the `url` parameter in the request ```yaml myWebhook: - '$request.body(/url)': + '$request.body#/url': post: requestBody: description: Callback payload @@ -1735,11 +1735,11 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- -href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. -operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. -parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. -headers | Link Headers Object | an Object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. -description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). +href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. +parameters | [Link Parameters Object](#linkParameters) | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. +headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. +description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1749,7 +1749,7 @@ Because of the potential for name clashes, consider the `href` syntax as the pre #### Response Payload Values -Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can map to the object/array/property model syntax used by variable expressions. +Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. @@ -1801,10 +1801,10 @@ Source Location | variable expression | example reference | notes HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` | Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers -Request body | `$request.body` | `/users/{$request.body(/user/uuid)}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself Request URL | `$url` | `/track?url={$url}` | -Response value | `$response.body` | `{$response.body(/uuid)}` | Only the payload in the response can be accessed with the `$response` syntax. -Response header | `$response.header` | `{$response.header.Server}` | +Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax. +Response header | `$response.header` | `{$response.header.Server}` | Single header values only are available From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. For responses, the response payload may be used with the `$response` syntax. @@ -1818,8 +1818,8 @@ The variable expression is defined by the following [ABNF](https://tools.ietf.or header-reference = "header." token query-reference = "query." name path-reference = "path." name - body-reference = "body(" fragment ")" - fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) with any instances of `(` or `)` escaped + body-reference = "body#" fragment + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) name = *( char ) char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) @@ -1872,7 +1872,7 @@ href: '/users/10101110/department' ```yaml Addresses: - href: '/users/{$response.body(/uuid)}/address' + href: '/users/{$response.body#/uuid}/address' ``` Where the `$response.uuid` from the example above would yield the target: @@ -1886,7 +1886,7 @@ And the array example: ```yaml ColorSelection: - href: 'http://colors.my-server.com/colors/{$response.body(/color)}' + href: 'http://colors.my-server.com/colors/{$response.body#/color}' ``` Would produce the following links: @@ -2044,26 +2044,26 @@ components: # returns array of '#/components/definitions/repository' operationId: getRepositoriesByOwner parameters: - username: $response.body(/username) + username: $response.body#/username UserRepository: # returns '#/components/definitions/repository' operationId: getRepository parameters: - username: $response.body(/owner/username) - slug: $response.body.slug + username: $response.body#/owner/username + slug: $response.body#/slug RepositoryPullRequests: # returns '#/components/definitions/pullrequest' operationId: getPullRequestsByRepository params: - username: $response.body(/owner/username) - slug: $response.body(/slug) + username: $response.body#/owner/username + slug: $response.body#/slug PullRequestMerge: # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge operationId: mergePullRequest parameters: - username: $response.body(/user/username) # Should be $response.author.username? - slug: $response.body(/repository/slug) - pid: $response.body(/id) + username: $response.body#/user/username # Should be $response.author.username? + slug: $response.body#/repository/slug + pid: $response.body#/id definitions: user: type: object @@ -2099,7 +2099,7 @@ components: links: UserRepositories: # returns array of '#/components/definitions/repository' - href: '/2.0/repositories/{$response.body(/username)}' + href: '/2.0/repositories/{$response.body#/username}' ``` or an absolute `href`: @@ -2109,11 +2109,11 @@ components: links: UserRepositories: # returns array of '#/components/definitions/repository' - href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body(/username)}' + href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body#/username}' ``` -### Link Parameters +### Link Parameters Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these may be dynamic depending on the response itself. @@ -2141,7 +2141,7 @@ components: UserCommitHistory: operationId: userCommitHistory parameters: - username: $response.body(/user/username) + username: $response.body#/user/username page: 0 ``` From 17fdf10a0d1cb5b444cb9513e28bcba418ec7eca Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 21 Feb 2017 17:25:08 -0500 Subject: [PATCH 0171/1801] Almost missed Marsh's comment. --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 53d08edc5d..2b846e5a8e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1589,8 +1589,8 @@ Content-Type: application/json Content-Length: 123 { - "failedurl" : "http://clientdomain.com/failed" - "successurls : [ + "failedUrl" : "http://clientdomain.com/failed" + "successUrls : [ "http://clientdomain.com/fast", "http://clientdomain.com/medium", "http://clientdomain.com/slow" @@ -1611,8 +1611,8 @@ $method | POST $request.path.eventType | myevent $request.query.queryUrl | http://clientdomain.com/stillrunning $request.header.content-Type | application/json -$request.body#/failed | http://clientdomain.com/stillrunning -$request.body#/successurls/2 | http://clientdomain.com/medium +$request.body#/failedUrl | http://clientdomain.com/stillrunning +$request.body#/successUrls/2 | http://clientdomain.com/medium $response.header.Location | http://example.org/subscription/1 From 7648c729cb27e1ad62e8fb2e4b6afe0e2624eb13 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 14:41:08 -0800 Subject: [PATCH 0172/1801] MOAR updates --- versions/3.0.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5e424bb67b..6a9df2dd73 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -144,14 +144,15 @@ By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or ` ### Data Types -Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). -Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. +Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft Wright 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2) (also known as, JSON Schema Draft 05). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a value. +Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Draft 05. Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. -Types that are not accompanied by a `format` property follow their definition from the JSON Schema. +Types that are not accompanied by a `format` property follow their definition from the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` was not specified. + The formats defined by the OAS are: @@ -2214,8 +2215,8 @@ definitions: A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. -The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. -For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported. +The Reference Object is a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. +For this specification, only [External references](https://tools.ietf.org/html/draft-wright-json-schema-00#section-8.2.2) are supported ([Internal references](https://tools.ietf.org/html/draft-wright-json-schema-00#section-8.2.1) are not supported). ##### Fixed Fields Field Name | Type | Description @@ -2260,9 +2261,9 @@ $ref: 'definitions.yaml#/Pet' The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. -This object is an extended subset of the [JSON Schema Specification Draft 4](http://json-schema.org/). +This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/), also known as JSON Schema Draft 05. -Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). +Further information about the properties can be found in [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. The following properties are taken directly from the JSON Schema definition and follow the same specifications: @@ -2290,11 +2291,11 @@ The following properties are taken from the JSON Schema definition but their def - oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. -- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present of the `type` is `array`. +- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). - additionalProperties - Value can be boolean or object. If object, definition MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- $ref - As a [Reference Object](#referenceObject). -- description ([CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation). +- $ref - A [Reference Object](#referenceObject). +- description - [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object. @@ -2307,8 +2308,8 @@ Field Name | Type | Description ---|:---:|--- nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. See [Composition and Inheritance](#schemaComposition) for more details. -readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. -writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but MUST NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. From f459807ae2b0b3c54e00f393f2e7d5aef0fb96ea Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 19:14:30 -0800 Subject: [PATCH 0173/1801] MOAR updates - Removed hyphen - Updated naming convention to reference only Wright Draft 00 - Simplified explanation of JSON Reference resolution --- versions/3.0.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6a9df2dd73..4b37b71cb6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -144,8 +144,8 @@ By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or ` ### Data Types -Primitive data types in the OAS are based on the types supported by the [JSON-Schema Draft Wright 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2) (also known as, JSON Schema Draft 05). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a value. -Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Draft 05. +Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a value. +Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. Primitives have an optional modifier property `format`. OAS uses several known formats to more finely define the data type being used. @@ -2216,7 +2216,8 @@ A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. The Reference Object is a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. -For this specification, only [External references](https://tools.ietf.org/html/draft-wright-json-schema-00#section-8.2.2) are supported ([Internal references](https://tools.ietf.org/html/draft-wright-json-schema-00#section-8.2.1) are not supported). + +For this specification, reference resolution is done as defined by the JSON Reference specification and not by the JSON Schema specification. ##### Fixed Fields Field Name | Type | Description @@ -2261,7 +2262,7 @@ $ref: 'definitions.yaml#/Pet' The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. -This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/), also known as JSON Schema Draft 05. +This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). Further information about the properties can be found in [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. From 3fc3a6c648bcb1b347109540aa96e717656e301e Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 19:20:46 -0800 Subject: [PATCH 0174/1801] Complete rework of JSON Reference --- versions/3.0.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4b37b71cb6..eaf87093ae 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2212,10 +2212,9 @@ definitions: #### Reference Object -A simple object to allow referencing other definitions in the specification. -It can be used to reference parameters and responses that are defined at the top level for reuse. +A simple object to allow referencing other definitions in the specification, internally and externally. -The Reference Object is a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. +The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. For this specification, reference resolution is done as defined by the JSON Reference specification and not by the JSON Schema specification. @@ -2228,12 +2227,12 @@ Field Name | Type | Description ```json { - "$ref": "#/definitions/Pet" + "$ref": "#/components/definitions/Pet" } ``` ```yaml -$ref: '#/definitions/Pet' +$ref: '#/components/definitions/Pet' ``` ##### Relative Schema File Example @@ -2244,7 +2243,7 @@ $ref: '#/definitions/Pet' ``` ```yaml -$ref: 'Pet.yaml' +$ref: Pet.yaml ``` ##### Relative Files With Embedded Schema Example @@ -2255,7 +2254,7 @@ $ref: 'Pet.yaml' ``` ```yaml -$ref: 'definitions.yaml#/Pet' +$ref: definitions.yaml#/Pet ``` #### Schema Object From 0edaf0ab2b22233d3b56385758613c05392e0315 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 21 Feb 2017 20:24:17 -0800 Subject: [PATCH 0175/1801] Changed explode default value --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bd113b4184..095eb01012 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -760,7 +760,7 @@ For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSch Field Name | Type | Description ---|:---:|--- style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. The default value is false. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. @@ -776,7 +776,7 @@ In order to support common ways of serializing simple parameters, a set of `styl ----------- | ------ | -------- | -------- matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` equal to `csv`. +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` value. simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). spaceDelimited | `array` | `query` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. pipeDelimited | `array` | `query` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. @@ -1265,7 +1265,7 @@ Field Name | Type | Description contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. -explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. The default value is false. +explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 810a63dbca9617d5a2cbc15f43917f989f863ee6 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 22 Feb 2017 09:17:31 -0500 Subject: [PATCH 0176/1801] Fix invalid JSON to use dpouble quotes; use "name": consistently in JSON --- versions/3.0.md | 98 +++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 91fd36279b..ba73dda2a5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -116,7 +116,7 @@ For example, if a field is said to have an array value, the JSON array represent ```json { - "field" : [...] + "field": [...] } ``` @@ -432,8 +432,8 @@ This object can be extended with [Specification Extensions](#specificationExtens "responses": { "200": { "description": "A list of pets.", - "content" : { - "application/json" : { + "content": { + "application/json": { "schema": { "type": "array", "items": { @@ -516,7 +516,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "default": { "description": "error payload", "content": { - "text/html" : { + "text/html": { "schema": { "$ref": "#/definitions/ErrorModel" } @@ -614,7 +614,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "type": "string" } ], - "requestBody" : { + "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { @@ -637,16 +637,16 @@ This object can be extended with [Specification Extensions](#specificationExtens "responses": { "200": { "description": "Pet updated.", - "content" : { - "application/json" : {}, - "application/xml" : {} + "content": { + "application/json": {}, + "application/xml": {} } }, "405": { "description": "Invalid input", - "content" : { - "application/json" : {}, - "application/xml" : {} + "content": { + "application/json": {}, + "application/xml": {} } } }, @@ -790,7 +790,7 @@ Assuming a parameter named `color` with one of the following values: ``` string -> "blue" array -> ["blue","black","brown"] - object -> { "R" : 100, "G" :200, "B" : 150 } + object -> { "R": 100, "G": 200, "B": 150 } ``` The following table shows examples of how those values would be rendered. @@ -921,35 +921,29 @@ A request body with a referenced model definition. ```json { "description": "user to add to the system", - "content" : { - "application/json" : { + "content": { + "application/json": { "schema": { - "$ref": "#/definitions/User" - }, - "examples": [ - { "$ref": 'http://foo.bar#/examples/address-example.json'} - ] + "$ref": "#/definitions/User" + }, + "examples": [ "http://foo.bar/examples/user-example.json" ] }, - "application/xml" : { - "schema": { + "application/xml": { + "schema": { "$ref": "#/definitions/User" }, - "examples": [ - { "$ref": 'http://foo.bar#/examples/address-example.xml'} - ] + "examples": [ "http://foo.bar/examples/user-example.xml" ] }, - "text/plain" : { - "examples": [ - { "$ref": 'http://foo.bar#/examples/address-example.txt'} - ] + "text/plain": { + "examples": [ "http://foo.bar/examples/user-example.txt" ] }, "*": { - "example": { - $ref: "http://foo.bar#/examples/address-example.whatever" + "schema": { + "$ref": "http://foo.bar/examples/user-example.whatever" } + } } -} -``` +}``` ```yaml description: user to add to the system @@ -1010,7 +1004,7 @@ Each key in the content object is the media-type of the [Content Type Object](#c ##### Content Examples ```js -"content" : { +"content": { "application/json": { "schema": { "type": "array", @@ -1023,13 +1017,13 @@ Each key in the content object is the media-type of the [Content Type Object](#c [] ] }, - "application/xml" : { - "examples" : [ + "application/xml": { + "examples": [ "", "" ] }, - "text/plain" : { + "text/plain": { "Bob,Diane,Mary,Bill", "" } @@ -1085,12 +1079,12 @@ A content type description. "$ref": "#/definitions/Pet" }, "examples": [{ - "name" : "Fluffy", - "petType" : "Cat" + "name": "Fluffy", + "petType": "Cat" }, { - "name" : "Rover", - "petType" : "Frog" + "name": "Rover", + "petType": "Frog" }] } } @@ -1319,8 +1313,8 @@ A 200 response for successful operation and a default response for others (imply { "200": { "description": "a pet to be returned", - "content" : { - "application/json" : { + "content": { + "application/json": { "schema": { "$ref": "#/definitions/Pet" } @@ -1329,8 +1323,8 @@ A 200 response for successful operation and a default response for others (imply }, "default": { "description": "Unexpected error", - "content" : { - "application/json" : { + "content": { + "application/json": { "schema": { "$ref": "#/definitions/ErrorModel" } @@ -1386,8 +1380,8 @@ Response of an array of a complex type: ```json { "description": "A complex object array response", - "content" : { - "application/json" : { + "content": { + "application/json": { "schema": { "type": "array", "items": { @@ -1414,8 +1408,8 @@ Response with a string type: ```json { "description": "A simple string response", - "content" : { - "text/plain" : { + "content": { + "text/plain": { "schema": { "type": "string" } @@ -1438,7 +1432,7 @@ Plain text response with headers: ```json { "description": "A simple string response", - "content" : { + "content": { "text/plain": { "schema": { "type": "string" @@ -3224,7 +3218,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { "type": "http", - "scheme" : "basic" + "scheme": "basic" } ``` @@ -3254,8 +3248,8 @@ in: header ```json { "type": "scheme", - "scheme" : "bearer", - "bearerFormat" : "JWT", + "scheme": "bearer", + "bearerFormat": "JWT", } ``` From 025b5192b5ee2643ffca617fbaee2b6f6a3615f2 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 22 Feb 2017 11:31:03 -0500 Subject: [PATCH 0177/1801] Fix example (both JSON and YAML) --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ba73dda2a5..23d1a28b12 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -938,7 +938,7 @@ A request body with a referenced model definition. "examples": [ "http://foo.bar/examples/user-example.txt" ] }, "*": { - "schema": { + "example": { "$ref": "http://foo.bar/examples/user-example.whatever" } } @@ -962,7 +962,7 @@ content: examples: - 'http://foo.bar/examples/user-example.txt' '*': - schema: + example: $ref: 'http://foo.bar/examples/user-example.whatever' ``` From b73e7cd9fe4edeacae6df3f12499b26aa01ea927 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 22 Feb 2017 11:34:54 -0500 Subject: [PATCH 0178/1801] Fix example to use */* (both JSON and YAML) --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 23d1a28b12..2582c67a3c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -937,7 +937,7 @@ A request body with a referenced model definition. "text/plain": { "examples": [ "http://foo.bar/examples/user-example.txt" ] }, - "*": { + "*/*": { "example": { "$ref": "http://foo.bar/examples/user-example.whatever" } @@ -961,7 +961,7 @@ content: 'text/plain': examples: - 'http://foo.bar/examples/user-example.txt' - '*': + '*/*': example: $ref: 'http://foo.bar/examples/user-example.whatever' ``` From 885bda5dc0dc19cbb1d542d0cccedeb5e1172f14 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Wed, 22 Feb 2017 08:51:34 -0800 Subject: [PATCH 0179/1801] [Introduction] Clarify languages Clarifies that languages are programming languages (ex: Java, Ruby, etc.) as opposed to spoken languages (English, Spanish, etc.) Signed-off-by: Rob Dolin --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 91fd36279b..ac1acef17d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -11,7 +11,7 @@ The OpenAPI Specification is licensed under [The Apache License, Version 2.0](ht The OpenAPI Specification is a project used to describe and document RESTful APIs. The OpenAPI Specification defines a set of files required to describe such an API. -These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. +These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various programming languages. Additional utilities can also take advantage of the resulting files, such as testing tools. ## Table of Contents From 58a57ff0371bda9fb433e66adc2d916cf7d4a23e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 22 Feb 2017 09:11:40 -0800 Subject: [PATCH 0180/1801] clarified FID --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 897230f14b..df420b256f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -75,7 +75,7 @@ Additional utilities can also take advantage of the resulting files, such as tes Version | Date | Notes --- | --- | --- -3.0.0 | 2017-02-28 | Implementor's draft of the 3.0 specification +3.0.0-rc0 | 2017-02-28 | Implementor's draft of the 3.0 specification 2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative 2.0 | 2014-09-08 | Release of Swagger 2.0 1.2 | 2014-03-14 | Initial release of the formal document. From 283006cce3b817c6c9d98c9f8b8d5f7647152d5c Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 22 Feb 2017 09:27:27 -0800 Subject: [PATCH 0181/1801] updated must ~~> should per @OAI/tdc --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 330442c4ed..57823f81cf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1074,7 +1074,7 @@ Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object _should_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description From 9e6f58692600a09b88a6e9c0ac3568a9ef1bbe17 Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 22 Feb 2017 13:25:43 -0500 Subject: [PATCH 0182/1801] Fixing spaces and capitals for Ron --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2b846e5a8e..1a31113a46 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1562,13 +1562,13 @@ description: object created #### Callbacks Object A map of possible out-of band callbacks related to the parent operation. -Each value in the map is an [operation object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses. +Each value in the map is an [Operation Object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An operation object used to define a callback request and expected responses +Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An Operation Object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1577,7 +1577,7 @@ This object can be extended with [Specification Extensions](#specificationExtens The key used to identify the callback object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed. -This includes accessing any part of a body that can be accessed using a JSONPointer [RFC6901](https://tools.ietf.org/html/rfc6901). +This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). For example, given the following HTTP request: From 7d0ae2dd6dbfba5bafd26113e6919468213f875a Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 22 Feb 2017 11:28:43 -0800 Subject: [PATCH 0183/1801] Even MOAR changes - clarified additionalProperties - clarified default - changed the definition of $ref --- versions/3.0.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index eaf87093ae..20829a2ed2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2293,11 +2293,12 @@ The following properties are taken from the JSON Schema definition but their def - not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- additionalProperties - Value can be boolean or object. If object, definition MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- $ref - A [Reference Object](#referenceObject). +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - description - [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. -- default - Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"`` but cannot be `1`. + +Alternatively, any time a Scheme Object can be used, a [Reference Object](#referenceObject) can be used in place. This allows referencing definitions in place of defining them inline. Effectively, it is the `$ref` property in JSON Schema but follows the same guidelines and restrictions as the Reference Object. For example, additional properties alongside a `$ref` SHALL be ignored. Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. From 18f041c15ecec002b3c1c240928d6dd7a6896507 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 22 Feb 2017 14:36:22 -0500 Subject: [PATCH 0184/1801] Remove ambiguity about info.version In [OpenAPI.next versions/3.0.md](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#infoObject) `info.version` is marked **Requried**, then the second sentence starts "While not required, ". Some may be confused and think this starts a contradiction. I suggest not adding this sentence at all, as it only raises additional questions (is "application API === "API definition"?) I propose more concise rephrasing. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 044452942a..53e2b6dd52 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -221,7 +221,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ may evolve at an entirely different rate. +version | `string` | **Required** The version of the API (not to be confused with the OpenAPI specification version or the implementation version which may evolve at different rates). This object can be extended with [Specification Extensions](#specificationExtensions). From 5b64060c6d6a5a1d445d4c164f51295e277d33e5 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 22 Feb 2017 14:35:58 -0800 Subject: [PATCH 0185/1801] Hopefully last updates --- versions/3.0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 20829a2ed2..2b9e08a012 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2214,7 +2214,7 @@ definitions: A simple object to allow referencing other definitions in the specification, internally and externally. -The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. +The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. For this specification, reference resolution is done as defined by the JSON Reference specification and not by the JSON Schema specification. @@ -2223,6 +2223,8 @@ Field Name | Type | Description ---|:---:|--- $ref | `string` | **Required.** The reference string. +This object cannot be extended with additional properties and any properties added SHALL be ignored. + ##### Reference Object Example ```json @@ -2298,7 +2300,7 @@ The following properties are taken from the JSON Schema definition but their def - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"`` but cannot be `1`. -Alternatively, any time a Scheme Object can be used, a [Reference Object](#referenceObject) can be used in place. This allows referencing definitions in place of defining them inline. Effectively, it is the `$ref` property in JSON Schema but follows the same guidelines and restrictions as the Reference Object. For example, additional properties alongside a `$ref` SHALL be ignored. +Alternatively, any time a Scheme Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions in place of defining them inline. Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. From 5edd89e437d838aac58400860483f266a569c428 Mon Sep 17 00:00:00 2001 From: Darrel Date: Wed, 22 Feb 2017 18:02:35 -0500 Subject: [PATCH 0186/1801] Fixes for Example object --- versions/3.0.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 520992c254..851b46cfdb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -765,7 +765,7 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples Array must be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type @@ -1646,21 +1646,15 @@ X-Rate-Limit-Reset: type: integer ``` -#### Examples Object +#### Example Object Allows sharing examples for operation requests and responses. -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -{[media type](#mediaTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like. - -##### Examples Array Example +##### Example Example Example representation for application/json media type of a Pet data type: ```json -[ { "name": "Puma", "type": "Dog", @@ -1668,16 +1662,16 @@ Example representation for application/json media type of a Pet data type: "gender": "Female", "breed": "Mixed" } -] ``` ```yaml -- - name: Puma - type: Dog - color: Black - gender: Female - breed: Mixed + +name: Puma +type: Dog +color: Black +gender: Female +breed: Mixed + ``` #### Links Object From d84d386b1b896ceeeb86f19f304add90ecb7a323 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 23 Feb 2017 13:38:25 -0500 Subject: [PATCH 0187/1801] Changed should to SHOULD --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 851b46cfdb..b6223ed3bd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -765,8 +765,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples Array must be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. +examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples Array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1092,8 +1092,8 @@ Each content type object provides schema and examples for a the media type ident Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object _should_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description From ef81333d7bf7bfb11f1a285b84dcbef7fcda20c9 Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 21:37:54 -0800 Subject: [PATCH 0188/1801] removing (obsolete?) Host Object reference removing (obsolete?) Host Object reference --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 520992c254..3796fc2f86 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -30,7 +30,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Schema](#schema) - [OpenAPI Object](#openapi-object) - [Info Object](#info-object) - - [Host Object](#host-object) - [Contact Object](#contact-object) - [License Object](#license-object) - [Server Object](#server-object) From 62d296c4f7d5652b2e48eb6432113307cd382ac9 Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 21:46:31 -0800 Subject: [PATCH 0189/1801] Clients should refrain from usage of the declared operation. Grammar: Clients should refrain from usage of the declared operation. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 520992c254..4592f1acb7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -591,7 +591,7 @@ Field Name | Type | Description requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. -deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. +deprecated | `boolean` | Declares this operation to be deprecated. Clients should refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. From 5246f291b9f79ff75cad53e8f057cfc1a2c3808f Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 21:49:01 -0800 Subject: [PATCH 0190/1801] typo ever -> every --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 01bbd8fa38..dd7c0d6fe1 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -27,7 +27,7 @@ The specification _will change_ from the original 2.0 version. We should typica - Use labels for the workflow of specification changes. For example, this may be labeled as `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, `needs approval`. These labels must be assigned by project committers - An issue will be opened for each feature change. Embedded in the issue OR ideally linked in a file via pull-request (PR), a document should be supplied for use cases for the change - A PR will be used to describe the _proposed_ solution, and linked to the original issue - - Not all committers will contribute to ever single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel + - Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel - When the OpenApi.next spec is complete and approved for release, the branch will be merged to master. ## Approving Changes From 5388cd4d9d1a44b3c347be6b19065ff812fb5165 Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 22:18:04 -0800 Subject: [PATCH 0191/1801] Consumers should refrain from usage of the declared operation. Consumers should refrain from usage of the declared operation. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4592f1acb7..ac1729616f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -591,7 +591,7 @@ Field Name | Type | Description requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. -deprecated | `boolean` | Declares this operation to be deprecated. Clients should refrain from usage of the declared operation. Default value is `false`. +deprecated | `boolean` | Declares this operation to be deprecated. Consumers should refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. From 411da1192e5f341ddcb6fb5ba39f1deee8ca959f Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 22:29:06 -0800 Subject: [PATCH 0192/1801] backtick formatting typo backtick formatting typo --- versions/3.0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 3796fc2f86..6614f0adc4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -973,7 +973,8 @@ A request body with a referenced model definition. } } } -}``` +} +``` ```yaml description: user to add to the system From d2870f420d1560fb2d11278df3d84e386fee8042 Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 22:43:37 -0800 Subject: [PATCH 0193/1801] ordering typo in example? Not sure if this is a typo or I'm just a bit lost and it's possible to nest the media type like that --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0e03353ab4..d04fadb134 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1156,9 +1156,9 @@ A `requestBody` example for submitting a file in a `POST` operation therefore ma ```yaml requestBody: - # any media type is accepted, functionally equivalent to `*/*` - application/octet-stream: - content: + content: + application/octet-stream: + # any media type is accepted, functionally equivalent to `*/*` schema: # a binary file of any type type: string @@ -1170,9 +1170,9 @@ In addition, specific media types may be specified: ```yaml # multiple, specific media types may be specified: requestBody: - # a binary file of type png or jpeg content: 'image/png, image/jpeg': + # a binary file of type png or jpeg schema: type: string format: binary From 4f9fe251014038597583396aaa5ef323bf1944d4 Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Thu, 23 Feb 2017 23:02:05 -0800 Subject: [PATCH 0194/1801] grammar grammar --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0e03353ab4..57f73a9b29 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1682,9 +1682,9 @@ Example representation for application/json media type of a Pet data type: #### Links Object The links object represents a set of possible design-time links for a response. -The presence of a link does not guarantee the caller's ability to successfully call invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. +The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. -As opposed to _dynamic_ links--that is, links provided **in** the response payload, the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. +As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. For computing links, and providing instructions to execute them, a mechanism is defined for accessing values in a response and using them as variables while invoking the linked operation. From 54a5911874e4e2e70b9834c54c107f12b66c344e Mon Sep 17 00:00:00 2001 From: Paul Hill Date: Fri, 24 Feb 2017 00:34:43 -0800 Subject: [PATCH 0195/1801] typo: scheme -> schema typo: scheme -> schema --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0e03353ab4..8373e2591d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1870,7 +1870,7 @@ As with all links, it at the the clients' discretion to follow them, and permiss ### Example -The example below shows how relationships in the BitBucket API can be represented with the proposed OAI link scheme. This example uses `operationId` values to link responses to possible operations. +The example below shows how relationships in the BitBucket API can be represented with the link schema. This example uses `operationId` values to link responses to possible operations. ```yaml paths: @@ -2319,7 +2319,7 @@ The following properties are taken from the JSON Schema definition but their def - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"`` but cannot be `1`. -Alternatively, any time a Scheme Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions in place of defining them inline. +Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions in place of defining them inline. Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. From c93883ebf2780c35b9bd2b6269f53ef3e2ef71f1 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Fri, 24 Feb 2017 10:04:13 -0800 Subject: [PATCH 0196/1801] [Spec] Suggestions from Liz Lynch Incorporates some suggestions from Liz Lynch: * OpenAPI Specification (OAS) early and then OAS further on * "a OAS" to "an OAS" * Remove first three bullets from ToC Signed-off-by: Rob Dolin --- versions/3.0.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 48c85dcfe3..49d20b522a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -4,22 +4,19 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). -The OpenAPI Specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). +This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). ## Introduction -The OpenAPI Specification is a project used to describe and document RESTful APIs. +The OpenAPI Specification (OAS) is a project used to describe and document RESTful APIs. -The OpenAPI Specification defines a set of files required to describe such an API. +The OAS defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. ## Table of Contents -- [OpenAPI Specification](#openapi-specification) -- [Introduction](#introduction) -- [Table of Contents](#table-of-contents) - [Revision History](#revision-history) - [Definitions](#definitions) - [Specification](#specification) From 61f914d37049ff1ce1ec7cdc9ca95790fcfd6926 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Fri, 24 Feb 2017 10:10:10 -0800 Subject: [PATCH 0197/1801] [File Structure] Clarify name convention is optional Liz Lynch found wording confusing. Use "MAY" to indicate this is optional. Signed-off-by: Rob Dolin --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 48c85dcfe3..f893fed5c3 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -139,7 +139,7 @@ The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or `openapi.yaml`. +By convention, the OpenAPI Specification (OAS) file MAY be named `openapi.json` or `openapi.yaml`. ### Data Types From 91761e5baf471a9e33ae0248ffae3963f2f085f2 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Fri, 24 Feb 2017 10:18:26 -0800 Subject: [PATCH 0198/1801] [Format] Suggested edits from Liz Lynch * Replace "a OAS" with "an OAS" * Remove extra text from array description * Hyperlink to YAML Failsafe schema ruleset Signed-off-by: Rob Dolin --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 48c85dcfe3..37de341962 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -109,10 +109,10 @@ The HTTP Status Codes are used to indicate the status of the executed operation. ### Format -The files describing the RESTful API in accordance with the OpenAPI Specification are represented as JSON objects and conform to the JSON standards. -YAML, being a superset of JSON, can be used as well to represent a OAS (OpenAPI Specification) file. +The files describing the RESTful API in accordance with this specification are represented as JSON objects and conform to the JSON standards. +YAML, being a superset of JSON, can be used as well to represent an OAS file. -For example, if a field is said to have an array value, the JSON array representation will be used: +For example, if a field has an array value, the JSON array representation will be used: ```json { @@ -131,7 +131,7 @@ Patterned fields can have multiple occurrences as long as each has a unique name In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) -- Keys used in YAML maps MUST be limited to a scalar string, as defined by the YAML Failsafe schema ruleset +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346) ### File Structure From 0f4eaeb02c3b16a17119125e672f4f28d1959a2c Mon Sep 17 00:00:00 2001 From: David Biesack Date: Fri, 24 Feb 2017 13:55:06 -0500 Subject: [PATCH 0199/1801] --amend --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 53e2b6dd52..fceab9129f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -221,7 +221,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** The version of the API (not to be confused with the OpenAPI specification version or the implementation version which may evolve at different rates). +version | `string` | **Required** The version of the API. Is it suggested that the `info.version` value correspond to the version of the API definition (not to be confused with the [OpenAPI specification version](#oasVersion).) In practice, the version of the API _implementation_ (not specified here) may evolve at an entirely different rate. This object can be extended with [Specification Extensions](#specificationExtensions). From 16c3cfac15dd0e06c415ad115c99e99f839625df Mon Sep 17 00:00:00 2001 From: David Biesack Date: Fri, 24 Feb 2017 14:04:32 -0500 Subject: [PATCH 0200/1801] --amend --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index fceab9129f..417191da6c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -221,7 +221,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** The version of the API. Is it suggested that the `info.version` value correspond to the version of the API definition (not to be confused with the [OpenAPI specification version](#oasVersion).) In practice, the version of the API _implementation_ (not specified here) may evolve at an entirely different rate. +version | `string` | **Required** The version of the API definition (which is distinct from the [OpenAPI specification version](#oasVersion) or the API implementation version which may evolve at different rates.) This object can be extended with [Specification Extensions](#specificationExtensions). From af1724499c9032010a67f19ef4fed2f3000e1cf9 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 26 Feb 2017 18:09:18 -0800 Subject: [PATCH 0201/1801] Updated keywords --- versions/3.0.md | 81 ++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1fb9bccf4e..bb9ef288dc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -84,7 +84,7 @@ Path templating refers to the usage of curly braces ({}) to mark a section of a ##### Media Types Media type definitions are spread across several resources. -The media type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). +The media type definitions SHOULD be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). Some examples of possible media type definitions: ``` @@ -184,24 +184,24 @@ It combines what previously was the Resource Listing and API Declaration (versio Field Name | Type | Description ---|:---:|--- -openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. -tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. +tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. This object can be extended with [Specification Extensions](#specificationExtensions). #### OpenAPI Version String -The version string signifies the version of the OpenAPI Specification that the document complies to. The format for this string _must_ be `major`.`minor`.`patch`. The `patch` _may_ be suffixed by a hyphen and extra alphanumeric characters. +The version string signifies the version of the OpenAPI Specification that the document complies to. The format for this string MUST be `major`.`minor`.`patch`. The `patch` MAY be suffixed by a hyphen and extra alphanumeric characters. -A `major`.`minor` shall be used to designate the OpenAPI Specification version, and will be considered compatible with the OpenAPI Specification specified by that `major`.`minor` version. The patch version will not be considered by tooling, making no distinction between `3.0.0` and `3.0.1`. +A `major`.`minor` SHALL be used to designate the OpenAPI Specification version, and will be considered compatible with the OpenAPI Specification specified by that `major`.`minor` version. The patch version will not be considered by tooling, making no distinction between `3.0.0` and `3.0.1`. -In subsequent versions of the OpenAPI Specification, care will be given such that increments of the `minor` version should not interfere with operations of tooling developed to a lower minor version. Thus a hypothetical `3.1.0` specification should be usable with tooling designed for `3.0.0`. +In subsequent versions of the OpenAPI Specification, care will be given such that increments of the `minor` version SHOULD NOT interfere with operations of tooling developed to a lower minor version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. #### Info Object @@ -218,7 +218,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ may evolve at an entirely different rate. +version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ MAY evolve at an entirely different rate. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -410,7 +410,7 @@ All the fixed fields declared above are objects that MUST use keys that match th Holds the relative paths to the individual endpoints. The path is appended to the [`Server Object`](#serverObject) in order to construct -the full URL. The Paths may be empty, due to [ACL constraints](#securityFiltering). +the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields @@ -465,7 +465,7 @@ This object can be extended with [Specification Extensions](#specificationExtens #### Path Item Object Describes the operations available on a single path. -A Path Item may be empty, due to [ACL constraints](#securityFiltering). +A Path Item MAY be empty, due to [ACL constraints](#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. ##### Fixed Fields @@ -584,10 +584,10 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers. +requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. -deprecated | `boolean` | Declares this operation to be deprecated. Consumers should refrain from usage of the declared operation. Default value is `false`. +deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. @@ -749,7 +749,7 @@ Field Name | Type | Description in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. - deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage. + deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](# @parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. @@ -759,10 +759,10 @@ Field Name | Type | Description ---|:---:|--- style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. -allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array MUST be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object MUST be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1090,7 +1090,7 @@ Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object _should_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description @@ -1196,7 +1196,7 @@ requestBody: properties: {} ``` -Note that in the above example, the contents in the `requestBody` must be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be strigified as well. +Note that in the above example, the contents in the `requestBody` MUST be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be strigified as well. When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. @@ -1204,7 +1204,7 @@ When passing complex objects in the `x-www-form-urlencoded` content type, the de It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supports mechanisms for multiple file uploads. -When passing in `multipart` types, boundaries may be used to separate sections of the content being transferred--thus, the following default `Content-Type`s are defined for `multipart/*`: +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred--thus, the following default `Content-Type`s are defined for `multipart/*`: * If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` * If the property is complex, or an array of complex values, the default Content-Type is `application/json` @@ -1252,7 +1252,7 @@ An object representing multipart region encoding for `requestBody` objects ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field must exist in the schema as a property. +The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field MUST exist in the schema as a property. #### Encoding @@ -1307,8 +1307,7 @@ encoding: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. -It is not expected from the documentation to necessarily cover all possible HTTP -response codes, since they may not be known in advance. However, it is expected +It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors. @@ -1328,7 +1327,7 @@ It can be used to cover undeclared responses. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1396,7 +1395,7 @@ Field Pattern | Type | Description ---|:---:|--- `*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` -Representations may take the form of a wildcard (`*`) to designate any `Content-Type`, +Representations MAY take the form of a wildcard (`*`) to designate any `Content-Type`, or a regular expression for matching a specific type This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1692,7 +1691,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the definitions name. -The link shall reference a single Link Object, or a JSON Reference to a single link object +The link SHALL reference a single Link Object, or a JSON Reference to a single link object. ### Link Object @@ -1701,22 +1700,22 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS. +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing Operation Object in the OAS. parameters | [Link Parameters Object](#linkParameters) | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). This object can be extended with [Specification Extensions](#specificationExtensions). -Locating a linked resource may be performed by either a `href` or `operationId`. -In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document. +Locating a linked resource MAY be performed by either a `href` or `operationId`. +In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. #### Response Payload Values Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. -In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition. +In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition. ### Example @@ -1765,7 +1764,7 @@ Source Location | variable expression | example reference | notes ---|:---|:---|:--- HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` | -Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers +Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters MUST be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself Request URL | `$url` | `/track?url={$url}` | Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax. @@ -2057,7 +2056,7 @@ components: $ref: '#/components/definitions/user' ``` -As references to `operationId` may not be possible (the `operationId` is an optional value), references may also be made through a relative `href`: +As references to `operationId` MAY NOT be possible (the `operationId` is an optional value), references MAY also be made through a relative `href`: ```yaml components: @@ -2080,7 +2079,7 @@ components: ### Link Parameters Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. -Many operations require parameters to be passed, and these may be dynamic depending on the response itself. +Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. To specify parameters required by the operation, we can use a **Link Parameters Object**. This object contains parameter names along with static or dynamic values: @@ -2169,13 +2168,13 @@ description: Pets operations #### Examples Object -Anywhere an `example` may be given, a JSON Reference may be used, with the +Anywhere an `example` may be given, a JSON Reference MAY be used, with the explicit restriction that examples having a JSON format with object named `$ref` are not allowed. This does mean that `example`, structurally, can be either a string primitive or an object, similar to `additionalProperties`. In all cases, the payload is expected to be compatible with the type schema -for the value that it is accompanying. Tooling implementations may choose to +for the value that it is accompanying. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. @@ -2320,7 +2319,7 @@ Alternatively, any time a Schema Object can be used, a [Reference Object](#refer Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. -Other than the JSON Schema subset fields, the following fields may be used for further schema documentation. +Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation: ##### Fixed Fields Field Name | Type | Description @@ -2333,7 +2332,7 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. examples | Any | An array of free-formed properties to include examples for this schema. - deprecated | `boolean` | Specifies that a schema is deprecated and should be transitioned out of usage. + deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -2725,7 +2724,7 @@ definitions: A metadata object that allows for more fine-tuned XML model definitions. -When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property should be used to add that information. +When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. ##### Fixed Fields @@ -3495,7 +3494,7 @@ When a list of Security Requirement Objects is defined on the [Open API object]( Field Pattern | Type | Description ---|:---:|--- -{name} | [`string`] | Each name must correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. ##### Security Requirement Object Examples @@ -3542,12 +3541,12 @@ The extensions may or may not be supported by the available tooling, but those m ### Security Filtering -Some objects in the OpenAPI Specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. +Some objects in the OpenAPI Specification MAY be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. The reasoning behind it is to allow an additional layer of access control over the documentation itself. -While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization. Two examples for this: -1. The [Paths Object](#pathsObject) may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. -2. The [Path Item Object](#pathItemObject) may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. +1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. From 88098008fb845d410864e2571a5daa4c94ff12f2 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 26 Feb 2017 18:30:07 -0800 Subject: [PATCH 0202/1801] Update JSON Schema links to IETF docs --- versions/2.0.md | 84 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/versions/2.0.md b/versions/2.0.md index 51f19b5b1d..8b9b9525cb 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -75,7 +75,7 @@ By convention, the Swagger specification file is named `swagger.json`. ### Data Types -Primitive data types in the Swagger Specification are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. +Primitive data types in the Swagger Specification are based on the types supported by the [JSON-Schema Draft 4](https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4. An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file. @@ -596,19 +596,19 @@ Field Name | Type | Description allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`. items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array. collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
  • `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`. -default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. +default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter. +maximum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +exclusiveMaximum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +minimum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +exclusiveMinimum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +maxLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +minLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +pattern | `string` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +maxItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +minItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +uniqueItems | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +enum | [*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +multipleOf | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. ##### Patterned Fields @@ -776,19 +776,19 @@ Field Name | Type | Description format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details. items | [Items Object](#itemsObject) | **Required if [`type`](#itemsType) is "array".** Describes the type of items in the array. collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. -default | * | Declares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#itemsType) for the data type. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. +default | * | Declares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](#itemsType) for the data type. +maximum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +exclusiveMaximum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +minimum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +exclusiveMinimum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +maxLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +minLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +pattern | `string` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +maxItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +minItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +uniqueItems | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +enum | [*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +multipleOf | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. ##### Patterned Objects @@ -1080,19 +1080,19 @@ Field Name | Type | Description format | `string` | The extending format for the previously mentioned [`type`](#stType). See [Data Type Formats](#dataTypeFormat) for further details. items | [Items Object](#itemsObject) | **Required if [`type`](#stType) is "array".** Describes the type of items in the array. collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are:
  • `csv` - comma separated values `foo,bar`.
  • `ssv` - space separated values `foo bar`.
  • `tsv` - tab separated values `foo\tbar`.
  • `pipes` - pipe separated values foo|bar.
Default value is `csv`. -default | * | Declares the value of the header that the server will use if none is provided. (Note: "default" has no meaning for required headers.) See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#headerDefault) for the header. -maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17. -minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21. -maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26. -minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29. -pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33. -maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42. -minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45. -uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49. -enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76. -multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14. +default | * | Declares the value of the header that the server will use if none is provided. (Note: "default" has no meaning for required headers.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](#headerDefault) for the header. +maximum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +exclusiveMaximum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +minimum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +exclusiveMinimum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +maxLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +minLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +pattern | `string` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +maxItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +minItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +uniqueItems | `boolean` | https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +enum | [*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +multipleOf | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. ##### Patterned Objects @@ -1150,7 +1150,7 @@ description: Pets operations A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse. -The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported. +The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. For this specification, only [canonical dereferencing](https://tools.ietf.org/html/draft-zyp-json-schema-04#section-7.2.3) is supported. ##### Fixed Fields Field Name | Type | Description @@ -1195,7 +1195,7 @@ $ref: 'definitions.yaml#/Pet' The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. -Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. +Further information about the properties can be found in [JSON Schema Core](https://tools.ietf.org/html/draft-zyp-json-schema-04) and [JSON Schema Validation](https://tools.ietf.org/html/draft-fge-json-schema-validation-00). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. The following properties are taken directly from the JSON Schema definition and follow the same specifications: - $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) From de4e554753dc795afe12887be847d336fd6b4e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Feb 2017 16:50:45 +0100 Subject: [PATCH 0203/1801] Issue #663: use `location` instead of `type` uniformly. --- versions/3.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bb9ef288dc..8f1deebb48 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -735,11 +735,11 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). -There are four possible parameter types. -* Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. -* Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. -* Header - Custom headers that are expected as part of the request. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. -* Cookie - Used to pass a specific cookie value to the API. +There are four possible parameter locations (as specified with the `in` field): +* path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. +* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +* header - Custom headers that are expected as part of the request. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +* cookie - Used to pass a specific cookie value to the API. ##### Fixed Fields @@ -748,9 +748,9 @@ Field Name | Type | Description name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. +required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](# @parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. +allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSchema) can be used to describe the structure and syntax of the parameter. From bc294050ec20a0508f7b580829936218a829955a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 12 Dec 2016 20:43:07 +0100 Subject: [PATCH 0204/1801] =?UTF-8?q?make=20path=20=E2=86=92=20URL=20resol?= =?UTF-8?q?ution=20clearer.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You can't append a string to an object (at least not with a canonical result), so we should make clear that we want to append to the `url` field of the server object (possibly after filling in the templates there). The highlighting of "appended" makes it clearer that there is no relative URL resolution as mentioned in https://github.com/OAI/OpenAPI-Specification/issues/843#issuecomment-261575257. --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bb9ef288dc..062a639d82 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -408,15 +408,15 @@ All the fixed fields declared above are objects that MUST use keys that match th #### Paths Object -Holds the relative paths to the individual endpoints. -The path is appended to the [`Server Object`](#serverObject) in order to construct +Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`Server Object`](#serverObject) in order to construct the full URL. [Path templating](#pathTemplating) is allowed. +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. This object can be extended with [Specification Extensions](#specificationExtensions). From b45fc43360ee547ff30bfd9b106fea4f9b1e48ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Feb 2017 17:11:20 +0100 Subject: [PATCH 0205/1801] =?UTF-8?q?Typo=20fixes:=20seperate=20=E2=86=92?= =?UTF-8?q?=20separate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bb9ef288dc..233868955c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -758,7 +758,7 @@ For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSch Field Name | Type | Description ---|:---:|--- style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array MUST be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. @@ -782,8 +782,8 @@ matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defin label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` value. simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). -spaceDelimited | `array` | `query` | Space seperated array values. This option replaces `collectionFormat` equal to `ssv`. -pipeDelimited | `array` | `query` | Pipe seperated array values. This option replaces `collectionFormat` equal to `pipes`. +spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. +pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. @@ -1264,7 +1264,7 @@ Field Name | Type | Description contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. -explode | `boolean` | When this is true, property values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From f6f9d14d0ad91eed3b21053d461c94f4c901b573 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 11:42:14 -0500 Subject: [PATCH 0206/1801] Added missing component identifiers --- versions/3.0.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1fb9bccf4e..61a7fff386 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -395,14 +395,14 @@ All objects defined within the components object will have no effect on the API Field Pattern | Type | Description ---|:---:|--- - | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. - | [Responses Definitions Object](#responsesDefinitionsObject) | Reusable responses objects. - | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. - | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold request body definitions to be reused across operations. Request Body definitions can be referenced to the ones defined here. - | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. - | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. - | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. - | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. + definitions | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. + responses | [Responses Definitions Object](#responsesDefinitionsObject) | Reusable responses objects. + parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. + requestBodies | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold request body definitions to be reused across operations. Request Body definitions can be referenced to the ones defined here. + responseHeaders | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. + securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. + links | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. + callbacks | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. From 9f63b9b4b808e53d58d97db1751b32b8e0f885dd Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 08:45:01 -0800 Subject: [PATCH 0207/1801] [Schema] Clarify that not required -> optional Signed-off-by: Rob Dolin --- versions/3.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 233868955c..13936eee1b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -175,6 +175,8 @@ Relative references used in $ref are processed as per [JSON Reference](https://t ### Schema +In the following description, if an object is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. + #### OpenAPI Object This is the root document object for the API specification. From 7787b963e88bc419193504582aa879986a57b909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Feb 2017 17:46:24 +0100 Subject: [PATCH 0208/1801] Mention that Content objects can also be in parameters or response headers. --- versions/3.0.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index bb9ef288dc..e0c15fb8e9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -772,7 +772,7 @@ the example must follow the prescribed serialization strategy for the parameter. Field Name | Type | Description ---|:---:|--- -content | [Content Object](#contentObject) | The content of the request body. +content | [Content Object](#contentObject) | The content of the parameter. In order to support common ways of serializing simple parameters, a set of `style` values are defined. @@ -1025,7 +1025,8 @@ content: #### Content Object -Describes a set of supported content types. A content object can be used in [requestBody](#requestBody) and [response objects](#responseObject). +Describes a set of supported content types. A content object can be used in [requestBody](#requestBody), +[parameter objects](#parameterObject), [header objects](#headerObject), and [response objects](#responseObject). Each key in the content object is the media-type of the [Content Type Object](#contentTypeObject). From 2e785820a7c688429cae6cf04e36fc1d17e8304f Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 08:54:36 -0800 Subject: [PATCH 0209/1801] [ToC] Update to use internal anchors This updates the ToC through the [Info Object](#infoObject) and its children to use the internal anchors in the document (instead of GitHub-generated anchors) Signed-off-by: Rob Dolin --- versions/3.0.md | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 233868955c..353a541a17 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -17,18 +17,20 @@ Additional utilities can also take advantage of the resulting files, such as tes ## Table of Contents -- [Revision History](#revision-history) - [Definitions](#definitions) + - [Path Templating](#pathTemplating) + - [Media Types](#mediaTypes) + - [HTTP Status Codes](#httpCodes) - [Specification](#specification) - [Format](#format) - - [File Structure](#file-structure) - - [Data Types](#data-types) - - [Relative References In Urls](#relativeReferences) + - [File Structure](#fileStructure) + - [Data Types](#dataTypes) + - [Relative References In Urls](#relativeReferences) - [Schema](#schema) - - [OpenAPI Object](#openapi-object) - - [Info Object](#info-object) - - [Contact Object](#contact-object) - - [License Object](#license-object) + - [OpenAPI Object](#oasObject) + - [Info Object](#infoObject) + - [Contact Object](#contactObject) + - [License Object](#licenseObject) - [Server Object](#server-object) - [Components Object](#components-object) - [Paths Object](#paths-object) @@ -62,21 +64,11 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Security Requirement Object](#security-requirement-object) - [Specification Extensions](#specification-extensions) - [Security Filtering](#security-filtering) +- [Appendix A: Revision History](#revisionHistory) -## Revision History - -Version | Date | Notes ---- | --- | --- -3.0.0-rc0 | 2017-02-28 | Implementor's draft of the 3.0 specification -2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative -2.0 | 2014-09-08 | Release of Swagger 2.0 -1.2 | 2014-03-14 | Initial release of the formal document. -1.1 | 2012-08-22 | Release of Swagger 1.1 -1.0 | 2011-08-10 | First release of the Swagger Specification - ## Definitions ##### Path Templating @@ -130,7 +122,7 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346) -### File Structure +### File Structure The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. @@ -138,7 +130,7 @@ This is applicable for `$ref` fields in the specification as follows from the [J By convention, the OpenAPI Specification (OAS) file is named `openapi.json` or `openapi.yaml`. -### Data Types +### Data Types Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a value. Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. @@ -3550,3 +3542,14 @@ Two examples for this: 1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. 2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. + +## Appendix A: Revision History + +Version | Date | Notes +--- | --- | --- +3.0.0-rc0 | 2017-02-28 | Implementor's draft of the 3.0 specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification From 3534328067b649d8f42f598d0844374bc7d569ba Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 11:57:45 -0500 Subject: [PATCH 0210/1801] Fixes based on review comments --- versions/3.0.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 3da0429101..17dc0b99d1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -761,8 +761,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate seperate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the example provided by the the schema. +examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1089,12 +1089,8 @@ Each content type object provides schema and examples for a the media type ident Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -<<<<<<< HEAD -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. -======= -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. ->>>>>>> refs/remotes/origin/OpenAPI.next -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. +examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description @@ -1648,7 +1644,7 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation requests and responses. +Allows sharing examples for operation requests and responses. This object can either be a freeform object, array or primitive value. To represent examples of media types that cannot naturally represented in the OpenAPI definition, a string value can be used to contain the example with escaping where necessary. ##### Example Example From 1e1352a78771b63af0de13cbd9737ee3a044c4f3 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 08:59:54 -0800 Subject: [PATCH 0211/1801] [Info Object Example] Update description Removes duplicative use of word "server" Changes "Petstore" to "pet store" since "Petstore" is not a proper noun Signed-off-by: Rob Dolin --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 233868955c..f3748b9a3a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -227,7 +227,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { "title": "Swagger Sample App", - "description": "This is a sample server Petstore server.", + "description": "This is a sample server for a pet store.", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", @@ -244,7 +244,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```yaml title: Swagger Sample App -description: This is a sample server Petstore server. +description: This is a sample server for a pet store. termsOfService: http://swagger.io/terms/ contact: name: API Support From 16ffc187d2f11b52781a696af0c161c8156be6b2 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 09:20:01 -0800 Subject: [PATCH 0212/1801] [File name] use RECOMMENDED Updating per discussion with TDC Signed-off-by: Rob Dolin --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index f893fed5c3..89280d59c5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -139,7 +139,7 @@ The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, the OpenAPI Specification (OAS) file MAY be named `openapi.json` or `openapi.yaml`. +By convention, it is RECOMMENDED that the OpenAPI Specification (OAS) file be named `openapi.json` or `openapi.yaml`. ### Data Types From d885db197e163ddb24717bd96d6c646509bcabc9 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 11:21:54 -0800 Subject: [PATCH 0213/1801] [Schema] Clarify required / optional Signed-off-by: Rob Dolin --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 13936eee1b..418c59a1b9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -175,7 +175,7 @@ Relative references used in $ref are processed as per [JSON Reference](https://t ### Schema -In the following description, if an object is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. +In the following description, if a field, a property, or an object is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. #### OpenAPI Object From edba37685b4d1e6f02e83ea010624219879c2886 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 11:35:39 -0800 Subject: [PATCH 0214/1801] [Schema] Update required/optional to just field Signed-off-by: Rob Dolin --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 418c59a1b9..e28536272d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -175,7 +175,7 @@ Relative references used in $ref are processed as per [JSON Reference](https://t ### Schema -In the following description, if a field, a property, or an object is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. +In the following description, if a field is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. #### OpenAPI Object From 86f5f76f3e1be6a9cb1a9abf50ec978fb1c9d47a Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 15:14:30 -0500 Subject: [PATCH 0215/1801] Fixed components anchors --- versions/3.0.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9dce975c8d..297359220b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -395,14 +395,14 @@ All objects defined within the components object will have no effect on the API Field Pattern | Type | Description ---|:---:|--- - definitions | [Definitions Object](#definitionsObject) | A hash containing payload definitions for the specification. - responses | [Responses Definitions Object](#responsesDefinitionsObject) | Reusable responses objects. - parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. - requestBodies | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold request body definitions to be reused across operations. Request Body definitions can be referenced to the ones defined here. - responseHeaders | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. - securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. - links | [Link Definitions Object](#linksDefinitionsObject) | Link definitions to reuse across the specification. - callbacks | [Callback Definitions Object](#callbacksDefinitionsObject) | Callback definitions to reuse across the specification. + definitions | [Definitions Object](#definitionsObject) | An object to hold reusable [schema objects](#schemaObject). + responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold reusable [responses objects](#responseObject). + parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold reusable [parameter objects](#parameterObject). + requestBodies | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold reusable [request body objects](#requestBodyObject). + responseHeaders | Response Headers Definitions Object | An object to hold reusable [response headers objects](#headersObject). + securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | An object to hold reusable security definition objects. + links | Link Definitions Object | An object to hold reusable [link objects](#linkObject). + callbacks | Callback Definitions Object | An object to hold reusable [callbacks objects](#callbacksObject). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. From 53a8ec761c928de177d04e853312c5c07e9d5495 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 15:16:54 -0500 Subject: [PATCH 0216/1801] Removed broken link --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d3613294f0..5500fe7034 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -394,7 +394,7 @@ Field Pattern | Type | Description definitions | [Definitions Object](#definitionsObject) | An object to hold reusable [schema objects](#schemaObject). responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold reusable [responses objects](#responseObject). parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold reusable [parameter objects](#parameterObject). - requestBodies | [Request Body Definitions Object](#requestBodyDefinitionsObject) | An object to hold reusable [request body objects](#requestBodyObject). + requestBodies | Request Body Definitions Object | An object to hold reusable [request body objects](#requestBodyObject). responseHeaders | Response Headers Definitions Object | An object to hold reusable [response headers objects](#headersObject). securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | An object to hold reusable security definition objects. links | Link Definitions Object | An object to hold reusable [link objects](#linkObject). From 707b1fe823302ee279e4f13deab592d68abe2711 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 15:22:04 -0500 Subject: [PATCH 0217/1801] More link fixes --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5500fe7034..cd538298ac 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -396,7 +396,7 @@ Field Pattern | Type | Description parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold reusable [parameter objects](#parameterObject). requestBodies | Request Body Definitions Object | An object to hold reusable [request body objects](#requestBodyObject). responseHeaders | Response Headers Definitions Object | An object to hold reusable [response headers objects](#headersObject). - securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | An object to hold reusable security definition objects. + securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | An object to hold reusable [security scheme objects](#securitySchemeObject). links | Link Definitions Object | An object to hold reusable [link objects](#linkObject). callbacks | Callback Definitions Object | An object to hold reusable [callbacks objects](#callbacksObject). @@ -1685,7 +1685,7 @@ Field Pattern | Type | Description The link SHALL reference a single Link Object, or a JSON Reference to a single link object. -### Link Object +### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description From 4ad1438c041fb8a075c4c057cb86569a792561c9 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 16:38:23 -0500 Subject: [PATCH 0218/1801] Removal of independent definitions objects --- versions/3.0.md | 399 +++++++++++++++++++++--------------------------- 1 file changed, 172 insertions(+), 227 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd538298ac..4e05f6a3a7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -391,17 +391,180 @@ All objects defined within the components object will have no effect on the API Field Pattern | Type | Description ---|:---:|--- - definitions | [Definitions Object](#definitionsObject) | An object to hold reusable [schema objects](#schemaObject). - responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold reusable [responses objects](#responseObject). - parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold reusable [parameter objects](#parameterObject). - requestBodies | Request Body Definitions Object | An object to hold reusable [request body objects](#requestBodyObject). - responseHeaders | Response Headers Definitions Object | An object to hold reusable [response headers objects](#headersObject). - securityDefinitions| [Security Definitions Object](#securityDefinitionsObject) | An object to hold reusable [security scheme objects](#securitySchemeObject). - links | Link Definitions Object | An object to hold reusable [link objects](#linkObject). - callbacks | Callback Definitions Object | An object to hold reusable [callbacks objects](#callbacksObject). + definitions | Map[`string`, [Schema Objects](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Responses Objects](#responseObject)] | An object to hold reusable [Responses Objects](#responseObject). This does *not* define global operation responses. + parameters | Map[`string`, [Parameter Objects](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). This does *not* define global operation parameters. + examples | Map[`string`, [Example Objects](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [RequestBody objects](#requestBodyObject)] | An object to hold reusable [RequestBody objects](#requestBodyObject). + responseHeaders | Map[`string`,[Response Headers objects](#headersObject)] | An object to hold reusable [Response Headers objects](#headersObject). + securityDefinitions| Map[`string`, [Security Scheme objects](#securitySchemeObject)] | An object to hold reusable [Security Scheme objects](#securitySchemeObject). + links | Map[`string`, [Link Objects](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callbacks Objects](#callbacksObject)] | An object to hold reusable [Callbacks Objects](#callbacksObject). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. +Examples: + +``` +User +User_1 +User_Name +user-name +my.org.User +my\org\User +``` + +##### Definitions Object Example + +```json +"components": { + "definitions": { + { + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + } + } + }, + "parameters": { + "skipParam": { + "name": "skip", + "in": "query", + "description": "number of items to skip", + "required": true, + "type": "integer", + "format": "int32" + }, + "limitParam": { + "name": "limit", + "in": "query", + "description": "max records to return", + "required": true, + "type": "integer", + "format": "int32" + } + }, + "responses": { + "NotFound": { + "description": "Entity not found." + }, + "IllegalInput": { + "description": "Illegal input for operation." + }, + "GeneralError": { + "description": "General Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/definitions/GeneralError" + } + } + } + } + }, + "securityDefinitions": { + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "flow": { + "implicit": { + "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + } + } +} +``` + +```yaml +components: + definitions: + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + type: integer + format: int32 + limitParam: + name: limit + in: query + description: max records to return + required: true + type: integer + format: int32 + responses: + NotFound: + description: Entity not found. + IllegalInput: + description: Illegal input for operation. + GeneralError: + description: General Error + content: + application/json + schema: + $ref: '#/definitions/GeneralError' + securityDefinitions: + api_key: + type: apiKey + name: api_key + in: header + petstore_auth: + type: oauth2 + flow: + implicit: + authorizationUrl: http://swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + #### Paths Object Holds the relative paths to the individual endpoints and their operations. @@ -3064,224 +3227,6 @@ animals: ``` -#### Definitions Object - -An object to hold schemas for data types that can be consumed and produced by operations. -These data types can be primitives, arrays or models. - -##### Patterned Fields - -Field Pattern | Type | Description ----|:---:|--- -{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines. - -Examples: - -``` -User -User_1 -User_Name -user-name -my.org.User -my\org\User -``` - -##### Definitions Object Example - -```json -{ - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - } - } -} -``` - -```yaml -Category: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string -Tag: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string -``` - -#### Parameters Definitions Object - -An object to hold parameters to be reused across operations. -Parameter definitions can be referenced to the ones defined here. - -This does *not* define global operation parameters. - -##### Patterned Fields - -Field Pattern | Type | Description ----|:---:|--- -{name} | [Parameter Object](#parameterObject) | A single parameter definition, mapping a "name" to the parameter it defines. - -##### Parameters Definition Object Example - -```json -{ - "skipParam": { - "name": "skip", - "in": "query", - "description": "number of items to skip", - "required": true, - "type": "integer", - "format": "int32" - }, - "limitParam": { - "name": "limit", - "in": "query", - "description": "max records to return", - "required": true, - "type": "integer", - "format": "int32" - } -} -``` - -```yaml -skipParam: - name: skip - in: query - description: number of items to skip - required: true - type: integer - format: int32 -limitParam: - name: limit - in: query - description: max records to return - required: true - type: integer - format: int32 -``` - - -#### Responses Definitions Object - -An object to hold responses to be reused across operations. -Response definitions can be referenced to the ones defined here. - -This does *not* define global operation responses. - -##### Patterned Fields - -Field Pattern | Type | Description ----|:---:|--- -{name} | [Response Object](#responseObject) | A single response definition, mapping a "name" to the response it defines. - -##### Responses Definitions Object Example - -```json -{ - "NotFound": { - "description": "Entity not found." - }, - "IllegalInput": { - "description": "Illegal input for operation." - }, - "GeneralError": { - "description": "General Error", - "schema": { - "$ref": "#/definitions/GeneralError" - } - } -} -``` - -```yaml -NotFound: - description: Entity not found. -IllegalInput: - description: Illegal input for operation. -GeneralError: - description: General Error - schema: - $ref: '#/definitions/GeneralError' -``` - -#### Security Definitions Object - -A declaration of the security schemes available to be used in the specification. -This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme. - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -{name} | [Security Scheme Object](#securitySchemeObject) | A single security scheme definition, mapping a "name" to the scheme it defines. - -##### Security Definitions Object Example - -```json -{ - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "header" - }, - "petstore_auth": { - "type": "oauth2", - "flow": { - "implicit": { - "authorizationUrl": "http://swagger.io/api/oauth/dialog", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - } - } - } -} -``` - -```yaml -api_key: - type: apiKey - name: api_key - in: header -petstore_auth: - type: oauth2 - flow: - implicit: - authorizationUrl: http://swagger.io/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets -``` - #### Security Scheme Object Allows the definition of a security scheme that can be used by the operations. @@ -3474,7 +3419,7 @@ read:pets: read your pets #### Security Requirement Object Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#securityDefinitionsObject). +The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#componentsSecurityDefinitions) under the [Components Object](#componentsObject). Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where there multiple query parameters or HTTP headers are required to convey security information. From dee224a5aaeb73dc33fa63a3bb934ea5b502d04c Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 27 Feb 2017 17:02:44 -0500 Subject: [PATCH 0219/1801] Updates based on Ron's feedback --- versions/3.0.md | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4e05f6a3a7..177c0813b5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -57,10 +57,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Reference Object](#reference-object) - [Schema Object](#schema-object) - [XML Object](#xml-object) - - [Definitions Object](#definitions-object) - - [Parameters Definitions Object](#parameters-definitions-object) - - [Responses Definitions Object](#responses-definitions-object) - - [Security Definitions Object](#security-definitions-object) - [Security Scheme Object](#security-scheme-object) - [Scopes Object](#scopes-object) - [Security Requirement Object](#security-requirement-object) @@ -384,26 +380,26 @@ This object can be extended with [Specification Extensions](#specificationExtens #### Components Object Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. ##### Fixed Fields Field Pattern | Type | Description ----|:---:|--- - definitions | Map[`string`, [Schema Objects](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). - responses | Map[`string`, [Responses Objects](#responseObject)] | An object to hold reusable [Responses Objects](#responseObject). This does *not* define global operation responses. - parameters | Map[`string`, [Parameter Objects](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). This does *not* define global operation parameters. - examples | Map[`string`, [Example Objects](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). - requestBodies | Map[`string`, [RequestBody objects](#requestBodyObject)] | An object to hold reusable [RequestBody objects](#requestBodyObject). - responseHeaders | Map[`string`,[Response Headers objects](#headersObject)] | An object to hold reusable [Response Headers objects](#headersObject). - securityDefinitions| Map[`string`, [Security Scheme objects](#securitySchemeObject)] | An object to hold reusable [Security Scheme objects](#securitySchemeObject). - links | Map[`string`, [Link Objects](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). - callbacks | Map[`string`, [Callbacks Objects](#callbacksObject)] | An object to hold reusable [Callbacks Objects](#callbacksObject). +---|:---|--- + definitions | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Responses Objects](#responseObject). + parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). + examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [RequestBody Object](#requestBodyObject)] | An object to hold reusable [RequestBody objects](#requestBodyObject). + responseHeaders | Map[`string`, [Response Header object](#headersObject)] | An object to hold reusable [Response Headers objects](#headersObject). + securityDefinitions| Map[`string`, [Security Scheme object](#securitySchemeObject)] | An object to hold reusable [Security Scheme objects](#securitySchemeObject). + links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callbacks Object](#callbacksObject)] | An object to hold reusable [Callbacks Objects](#callbacksObject). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. -Examples: +Field Name Examples: ``` User @@ -419,7 +415,6 @@ my\org\User ```json "components": { "definitions": { - { "Category": { "type": "object", "properties": { From 5c07dcbdb621e273fbd666d76248a2ebfaed0596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Feb 2017 23:34:31 +0100 Subject: [PATCH 0220/1801] typo fixes redone. I did run aspell over this (ignoring a lot of words ... it looks like there isn't a markdown filter yet for it). (Omitted some fixes which were noted as unnecessary by @Webron.) --- versions/3.0.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index a699922811..8f118cec85 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -116,7 +116,7 @@ While the API is described using JSON it does not impose a JSON input/output to All field names in the specification are **case sensitive**. The schema exposes two types of fields. -Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. +Fixed fields, which have a declared name, and Patterned fields, which declare a regular expression pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name. In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: @@ -1138,7 +1138,7 @@ schema: type: string format: base64 -# content transfered in binary (octet-stream): +# content transferred in binary (octet-stream): schema: type: string format: binary @@ -1188,16 +1188,16 @@ requestBody: type: string format: uuid address: - # complex types are stringified to support rfc1866 + # complex types are stringified to support RFC1866 type: object properties: {} ``` -Note that in the above example, the contents in the `requestBody` MUST be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be strigified as well. +Note that in the above example, the contents in the `requestBody` MUST be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be stringified as well. When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. -##### Special Considerations for `mutlipart` content +##### Special Considerations for `multipart` content It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supports mechanisms for multiple file uploads. @@ -1240,7 +1240,7 @@ requestBody: type: '#/definitions/Address' ``` -In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `mulitpart/*` and `x-www-form-urlencoded` request bodies. +In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. #### Encoding Object @@ -1528,7 +1528,7 @@ This object can be extended with [Specification Extensions](#specificationExtens The key used to identify the callback object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. -However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed. +However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). @@ -1704,7 +1704,7 @@ Because of the potential for name clashes, consider the `href` syntax as the pre #### Response Payload Values -Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id. +Payload values are only available in parsable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition. @@ -1747,7 +1747,7 @@ color: ["red", "green", "blue"] The variables generated can be used in locations prescribed by the definition. -### Variable substitution +### Variable substitution In all cases, _variables_ from request and responses may be substituted for link generation. The table below provides examples of variable expressions and examples of their use in a value: @@ -3385,8 +3385,8 @@ Field Name | Type | Description ---|:---:|---|--- implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow -clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenApi 2.0. -authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenApi 2.0. +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. This object can be extended with [Specification Extensions](#specificationExtensions). From 3694e8f16da85ef8ac64a3fb754883c5124e8dcd Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 27 Feb 2017 16:46:10 -0800 Subject: [PATCH 0221/1801] Fix multipart encoding example --- versions/3.0.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8f118cec85..4d8d04bab7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1088,6 +1088,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +encoding | [Encoding Object](#encodingObject) | Encoding of the content type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. ##### Patterned Fields Field Pattern | Type | Description @@ -1291,13 +1292,13 @@ requestBody: # default is application/octet-stream, need to declare an image type only! type: string format: binary -encoding: - historyMetadata: - # require XML content-type in utf-8 encoding - contentType: application/xml; charset=utf-8 - profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg + encoding: + historyMetadata: + # require XML content-type in utf-8 encoding + contentType: application/xml; charset=utf-8 + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg ``` #### Responses Object From cb501456359ebe472a1d39ca379232bb621a1d2e Mon Sep 17 00:00:00 2001 From: David Biesack Date: Mon, 27 Feb 2017 19:58:00 -0500 Subject: [PATCH 0222/1801] Update description of version in Info Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 417191da6c..84a20a79dd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -221,7 +221,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** The version of the API definition (which is distinct from the [OpenAPI specification version](#oasVersion) or the API implementation version which may evolve at different rates.) +version | `string` | **Required** The version of the API definition (which is distinct from the OpenAPI specification version or the API implementation version.) This object can be extended with [Specification Extensions](#specificationExtensions). From 946df36a31ddfbd023851d581d389f86b5fdd71f Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 27 Feb 2017 18:02:25 -0800 Subject: [PATCH 0223/1801] Misc errata * Removed last(?) Vendor Extension references * Title casing on headings * Commas, minor grammatical fixes, and small consistency issues * Minor wordsmithing --- versions/3.0.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8f118cec85..49ff69dc00 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -111,7 +111,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` -While the API is described using JSON it does not impose a JSON input/output to the API itself. +While the API is described using JSON, it does not impose a JSON input/output to the API itself. All field names in the specification are **case sensitive**. @@ -214,7 +214,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ MAY evolve at an entirely different rate. +version | `string` | **Required.** Provides the version of the application API (not to be confused with the specification version). While not required, is it suggested that the `info.version` value correspond to the version of the API definition. In practice, the version of the API _implementation_ MAY evolve at an entirely different rate. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -311,7 +311,7 @@ url: http://www.apache.org/licenses/LICENSE-2.0.html #### Server Object -An object representing a Server. +An object representing a list of one or more servers. ##### Fixed Fields @@ -579,7 +579,7 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. @@ -757,7 +757,7 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type @@ -935,7 +935,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- `*` | [Schema Object](#schemaObject) | The schema defining the request body. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Request Body Examples @@ -1092,7 +1092,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. ##### Content Type Examples @@ -1747,7 +1747,7 @@ color: ["red", "green", "blue"] The variables generated can be used in locations prescribed by the definition. -### Variable substitution +### Variable Substitution In all cases, _variables_ from request and responses may be substituted for link generation. The table below provides examples of variable expressions and examples of their use in a value: @@ -1783,7 +1783,7 @@ The variable expression is defined by the following [ABNF](https://tools.ietf.or The `name` identifier is case-sensitive, whereas `token` is not. -### Request parameter example +### Request Parameter Example Computing a link from a request operation like such: ```yaml @@ -1823,7 +1823,7 @@ For a `id` value of `10101110`, the generated link would be: href: '/users/10101110/department' ``` -### Response payload example +### Response Payload Example ```yaml Addresses: @@ -3067,7 +3067,7 @@ animals: #### Definitions Object An object to hold schemas for data types that can be consumed and produced by operations. -These data types can be primitives, arrays or models. +These data types can be primitives, arrays, or models. ##### Patterned Fields @@ -3293,7 +3293,7 @@ Field Name | Type | Validity | Description type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. -in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`. +in | `string` | `apiKey` | **Required.** The location of the API key. Valid values are `"query"` or `"header"`. scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. @@ -3546,7 +3546,7 @@ Two examples for this: Version | Date | Notes --- | --- | --- -3.0.0-rc0 | 2017-02-28 | Implementor's draft of the 3.0 specification +3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification 2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative 2.0 | 2014-09-08 | Release of Swagger 2.0 1.2 | 2014-03-14 | Initial release of the formal document. From 3c08335bbd0403ac58bde7f7d11c74d61761e67a Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Feb 2017 19:44:33 -0800 Subject: [PATCH 0224/1801] fix example, followup to #932 --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4d8d04bab7..22bc64aea4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1297,8 +1297,8 @@ requestBody: # require XML content-type in utf-8 encoding contentType: application/xml; charset=utf-8 profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg + # only accept png/jpeg + contentType: image/png, image/jpeg ``` #### Responses Object From 35d68ac7fdcfdadd7df52af6364fc0f1d8ee2e1e Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 20:26:44 -0800 Subject: [PATCH 0225/1801] [ToC] Finish updating to internal anchors Update ToC anchor links to use the document's internal anchors instead of the GitHub ones Signed-off-by: Rob Dolin --- versions/3.0.md | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1c367d7529..ca3f3d225d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -33,39 +33,39 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Info Object](#infoObject) - [Contact Object](#contactObject) - [License Object](#licenseObject) - - [Server Object](#server-object) - - [Components Object](#components-object) - - [Paths Object](#paths-object) - - [Path Item Object](#path-item-object) - - [Operation Object](#operation-object) - - [External Documentation Object](#external-documentation-object) - - [Parameter Object](#parameter-object) - - [Request Body Object](#request-body-object) - - [Content Object](#content-object) - - [Content Type Object](#content-type-object) - - [Responses Object](#responses-object) - - [Response Object](#response-object) - - [Headers Object](#headers-object) - - [Examples Object](#examples-object) - - [Links Object](#links-object) - - [Link Object](#link-object) - - [Variable substitution](#variable-substitution) - - [Link Parameters](#link-parameters) - - [Header Object](#header-object) - - [Tag Object](#tag-object) - - [Examples Object](#examples-object) - - [Reference Object](#reference-object) - - [Schema Object](#schema-object) - - [XML Object](#xml-object) - - [Definitions Object](#definitions-object) - - [Parameters Definitions Object](#parameters-definitions-object) - - [Responses Definitions Object](#responses-definitions-object) - - [Security Definitions Object](#security-definitions-object) - - [Security Scheme Object](#security-scheme-object) - - [Scopes Object](#scopes-object) - - [Security Requirement Object](#security-requirement-object) - - [Specification Extensions](#specification-extensions) - - [Security Filtering](#security-filtering) + - [Server Object](#serverObject) + - [Components Object](#componentsObject) + - [Paths Object](#pathsObject) + - [Path Item Object](#pathItemObject) + - [Operation Object](#operationObject) + - [External Documentation Object](#externalDocumentationObject) + - [Parameter Object](#parameterObject) + - [Request Body Object](#requestBodyObject) + - [Content Object](#contentObject) + - [Content Type Object](#contentTypeObject) + - [Responses Object](#responsesObject) + - [Response Object](#responseObject) + - [Headers Object](#headersObject) + - [Examples Object](#examplesObject) + - [Links Object](#linksObject) + - [Link Object](#linkObject) + - [Variable substitution](#variableSubstitution) + - [Link Parameters](#linkParameters) + - [Header Object](#headerObject) + - [Tag Object](#tagObject) + - [Examples Object](#examplesObject) + - [Reference Object](#referenceObject) + - [Schema Object](#schemaObject) + - [XML Object](#xmlObject) + - [Definitions Object](#definitionsObject) + - [Parameters Definitions Object](#parametersDefinitionsObject) + - [Responses Definitions Object](#responsesDefinitionsObject) + - [Security Definitions Object](#securityDefinitionsObject) + - [Security Scheme Object](#securitySchemeObject) + - [Scopes Object](#scopesObject) + - [Security Requirement Object](#securityRequirementObject) + - [Specification Extensions](#specificationExtensions) + - [Security Filtering](#securityFiltering) - [Appendix A: Revision History](#revisionHistory) From 9e02002acb81bc98b7df90dad09d18158669dbe5 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 20:30:32 -0800 Subject: [PATCH 0226/1801] [HTTP Status Codes] Clean-up Two edits: * Remove extraneous `initially` * One sentence per line Signed-off-by: Rob Dolin --- versions/3.0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1c367d7529..93e46156fd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -94,7 +94,8 @@ Some examples of possible media type definitions: application/vnd.github.v3.patch ``` ##### HTTP Status Codes -The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are initially defined by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). ## Specification From 2a84465616b21591d6013bc3d8ef8adccfbb3a83 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 20:34:15 -0800 Subject: [PATCH 0227/1801] [Data Types] Clean-up Two edits: * Add colon ":" * One sentence per line Signed-off-by: Rob Dolin --- versions/3.0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1c367d7529..51761afde0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -134,10 +134,12 @@ By convention, it is RECOMMENDED that the OpenAPI Specification (OAS) file be na ### Data Types -Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a value. +Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). +Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. +`null` is not supported as a value. Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. -Primitives have an optional modifier property `format`. +Primitives have an optional modifier property: `format`. OAS uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. From 816574dbcf0696f6bd79386476a1dba2fb4c3246 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 00:15:32 -0500 Subject: [PATCH 0228/1801] Fixes to callback objects, components and references --- versions/3.0.md | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 177c0813b5..b53e0d5978 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -392,10 +392,10 @@ Field Pattern | Type | Description parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). requestBodies | Map[`string`, [RequestBody Object](#requestBodyObject)] | An object to hold reusable [RequestBody objects](#requestBodyObject). - responseHeaders | Map[`string`, [Response Header object](#headersObject)] | An object to hold reusable [Response Headers objects](#headersObject). + headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). securityDefinitions| Map[`string`, [Security Scheme object](#securitySchemeObject)] | An object to hold reusable [Security Scheme objects](#securitySchemeObject). links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). - callbacks | Map[`string`, [Callbacks Object](#callbacksObject)] | An object to hold reusable [Callbacks Objects](#callbacksObject). + callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Object](#callbackObject). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. @@ -915,8 +915,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. +examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1244,8 +1244,8 @@ Each content type object provides schema and examples for a the media type ident Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. ##### Patterned Fields Field Pattern | Type | Description @@ -1672,24 +1672,36 @@ description: object created #### Callbacks Object A map of possible out-of band callbacks related to the parent operation. -Each value in the map is an [Operation Object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses. +Each value in the map is an [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -Callback name | [Callback Operation Object](#operationObject) | [Operation Object](#operationObject) | An Operation Object used to define a callback request and expected responses +{name} | [Callback Object](#callbackObject) | [Reference Object](#ReferenceObject) | A Callback Object used to define a callback request and expected responses + +This object can be extended with [Specification Extensions](#specificationExtensions). + +#### Callback Object + +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{expression} | [Path Item Object](#pathItemObject) | An Path Item Object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). ##### Key Expression -The key used to identify the callback object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +The key used to identify the Path Item Object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). - For example, given the following HTTP request: ```http @@ -1748,12 +1760,12 @@ myWebhook: #### Headers Object -Lists the headers that can be sent as part of a response. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +Lists the headers that can be sent in a response or forwarded via a link. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [Header Object](#headerObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. +{name} | [Header Object](#headerObject) | [Reference Object](#referenceObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. ##### Headers Object Example @@ -1850,7 +1862,7 @@ Field Name | Type | Description ---|:---:|--- href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing Operation Object in the OAS. -parameters | [Link Parameters Object](#linkParameters) | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. +parameters | [Link Parameters Object](#linkParameters) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). From affac835367502a8a1218e6d4386a63b105ca4bc Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 21:15:48 -0800 Subject: [PATCH 0229/1801] Update "swagger" to more generic Replaces references to Swagger UI or Swagger CodeGen with more generic descriptions. Also updates swagger.io URLs in examples to example.com URLs Signed-off-by: Rob Dolin --- versions/3.0.md | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1c367d7529..c19145199a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -12,7 +12,7 @@ The OpenAPI Specification (OAS) is a project used to describe and document RESTf The OpenAPI Specification defines a set of files required to describe such an API. -These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various programming languages. +These files can then be used by documentation generation tools to display the API and code generation tools to generate clients in various programming languages. Additional utilities can also take advantage of the resulting files, such as testing tools. @@ -203,7 +203,7 @@ In subsequent versions of the OpenAPI Specification, care will be given such tha #### Info Object The object provides metadata about the API. -The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. +The metadata can be used by the clients if needed, and can be presented in editing or documentation generation tools for convenience. ##### Fixed Fields @@ -223,13 +223,13 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { - "title": "Swagger Sample App", + "title": "Sample Pet Store App", "description": "This is a sample server for a pet store.", - "termsOfService": "http://swagger.io/terms/", + "termsOfService": "http://example.com/terms/", "contact": { "name": "API Support", - "url": "http://www.swagger.io/support", - "email": "support@swagger.io" + "url": "http://www.example.com/support", + "email": "support@example.com" }, "license": { "name": "Apache 2.0", @@ -240,13 +240,13 @@ This object can be extended with [Specification Extensions](#specificationExtens ``` ```yaml -title: Swagger Sample App +title: Sample Pet Store App description: This is a sample server for a pet store. -termsOfService: http://swagger.io/terms/ +termsOfService: http://example.com/terms/ contact: name: API Support - url: http://www.swagger.io/support - email: support@swagger.io + url: http://www.example.com/support + email: support@example.com license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html @@ -272,15 +272,15 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { "name": "API Support", - "url": "http://www.swagger.io/support", - "email": "support@swagger.io" + "url": "http://www.example.com/support", + "email": "support@example.com" } ``` ```yaml name: API Support -url: http://www.swagger.io/support -email: support@swagger.io +url: http://www.example.com/support +email: support@example.com ``` #### License Object @@ -576,7 +576,7 @@ Describes a single API operation on a path. Field Name | Type | Description ---|:---:|--- tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. -summary | `string` | A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. +summary | `string` | A short summary of what the operation does. For maximum readability in editing or documentation generation tools, this field SHOULD be less than 120 characters. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. @@ -717,13 +717,13 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { "description": "Find more info here", - "url": "https://swagger.io" + "url": "https://example.com" } ``` ```yaml description: Find more info here -url: https://swagger.io +url: https://example.com ``` #### Parameter Object @@ -2826,7 +2826,7 @@ In this example, a full model definition is shown. "name": { "type": "string", "xml": { - "namespace": "http://swagger.io/schema/sample", + "namespace": "http://example.com/schema/sample", "prefix": "sample" } } @@ -2847,13 +2847,13 @@ Person: name: type: string xml: - namespace: http://swagger.io/schema/sample + namespace: http://example.com/schema/sample prefix: sample ``` ```xml - example + example ``` @@ -3258,7 +3258,7 @@ Field Pattern | Type | Description "type": "oauth2", "flow": { "implicit": { - "authorizationUrl": "http://swagger.io/api/oauth/dialog", + "authorizationUrl": "http://example.com/api/oauth/dialog", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -3278,7 +3278,7 @@ petstore_auth: type: oauth2 flow: implicit: - authorizationUrl: http://swagger.io/api/oauth/dialog + authorizationUrl: http://example.com/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets @@ -3358,7 +3358,7 @@ bearerFormat: JWT "type": "oauth2", "flow": { "implicit": { - "authorizationUrl": "https://swagger.io/api/oauth/dialog", + "authorizationUrl": "https://example.com/api/oauth/dialog", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -3372,7 +3372,7 @@ bearerFormat: JWT type: oauth2 flow: implicit: - authorizationUrl: https://swagger.io/api/oauth/dialog + authorizationUrl: https://example.com/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets @@ -3413,15 +3413,15 @@ This object can be extended with [Specification Extensions](#specificationExtens "type": "oauth2", "flow": { "implicit": { - "authorizationUrl": "https://swagger.io/api/oauth/dialog", + "authorizationUrl": "https://example.com/api/oauth/dialog", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" } }, "authorizationCode": { - "authorizationUrl": "https://swagger.io/api/oauth/dialog", - "tokenUrl": "https://swagger.io/api/oauth/token", + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" @@ -3435,13 +3435,13 @@ This object can be extended with [Specification Extensions](#specificationExtens type: oauth2 flow: implicit: - authorizationUrl: https://swagger.io/api/oauth/dialog + authorizationUrl: https://example.com/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets authorizationCode: - authorizationUrl: https://swagger.io/api/oauth/dialog - tokenUrl: https://swagger.io/api/oauth/token + authorizationUrl: https://example.com/api/oauth/dialog + tokenUrl: https://example.com/api/oauth/token scopes: write:pets: modify pets in your account read:pets: read your pets From 42b1cfe0bfd01ae0123f146a3cdf9cdae2669209 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 27 Feb 2017 21:31:32 -0800 Subject: [PATCH 0230/1801] [Operation Update Example] Remove empty field The `description` in the example is empty. Since it is not a required field, this PR removes it. Signed-off-by: Rob Dolin --- versions/3.0.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 33b240bac4..55a7aa7182 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -601,7 +601,6 @@ This object can be extended with [Specification Extensions](#specificationExtens "pet" ], "summary": "Updates a pet in the store with form data", - "description": "", "operationId": "updatePetWithForm", "parameters": [ { @@ -663,7 +662,6 @@ This object can be extended with [Specification Extensions](#specificationExtens tags: - pet summary: Updates a pet in the store with form data -description: '' operationId: updatePetWithForm parameters: - name: petId From ae7045b743abb26235c6623d8c3f89dfa2b99f6b Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 27 Feb 2017 21:42:00 -0800 Subject: [PATCH 0231/1801] reverting server changes At @webron's suggestion, to be tackled in a separate PR since example needs to be addressed. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 49ff69dc00..9046e79bdf 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -311,7 +311,7 @@ url: http://www.apache.org/licenses/LICENSE-2.0.html #### Server Object -An object representing a list of one or more servers. +An object representing a Server. ##### Fixed Fields From 9b036bbbc4928eb1ce53fe802564feddcd5836ef Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Feb 2017 21:47:32 -0800 Subject: [PATCH 0232/1801] Fixed encoding stuff --- versions/3.0.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 55a7aa7182..b91286a965 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1247,28 +1247,14 @@ In scenarios where more control is needed over the Content-Type for `multipart` #### Encoding Object -An object representing multipart region encoding for `requestBody` objects +An object representing multipart region encoding for `requestBody` objects. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -The property to apply encoding to | [Encoding Property](#encodingProperty) | [Encoding](#encoding) | The field name to apply special encoding attributes to. This field MUST exist in the schema as a property. +{property} | [Encoding Property Object](#encodingPropertyObject) | [Encoding](#encoding) | The property name to which the special encoding are applied. This field MUST exist in the schema as a property. -#### Encoding - -A single encoding definition applied to a single schema property - -##### Fixed Fields -Field Name | Type | Description ----|:---:|--- -contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. -Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. -explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. - -This object can be extended with [Specification Extensions](#specificationExtensions). - -##### Encoding Object Examples +##### Encoding Object Example ```yaml requestBody: @@ -1303,6 +1289,20 @@ requestBody: contentType: image/png, image/jpeg ``` +#### Encoding Property Object + +A single encoding definition applied to a single schema property. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. +Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. + +This object can be extended with [Specification Extensions](#specificationExtensions). + #### Responses Object A container for the expected responses of an operation. From 8e1e8419ae7d512e0cde5f124a1b15ba783663a5 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Feb 2017 21:59:43 -0800 Subject: [PATCH 0233/1801] made types great again --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b91286a965..287bc9a037 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1252,7 +1252,7 @@ An object representing multipart region encoding for `requestBody` objects. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{property} | [Encoding Property Object](#encodingPropertyObject) | [Encoding](#encoding) | The property name to which the special encoding are applied. This field MUST exist in the schema as a property. +{property} | [Encoding Property Object](#encodingPropertyObject) | The property name to which the special encoding are applied. This field MUST exist in the schema as a property. ##### Encoding Object Example From 3a0827944babd8cb6157269b5984adf0b99ec464 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Feb 2017 22:24:33 -0800 Subject: [PATCH 0234/1801] fixed server example, anchors throughout the doc --- versions/3.0.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9d633a9d95..243680ee3f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -185,7 +185,7 @@ Field Name | Type | Description ---|:---:|--- openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. +servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. @@ -329,7 +329,14 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Server Object Example -The following shows how multiple hosts can be described in the Server Object array +A single server would be described as: + +```yaml +url: https://development.gigantic-server.com/v1 +description: Development server +``` + +The following shows how multiple hosts can be described, for example, at the OpenAPI Object's `servers`(#oasServers): ```yaml servers: @@ -341,7 +348,7 @@ servers: description: Production server ``` -The following shows how templates can be used for a server configuration +The following shows how templates can be used for a server configuration: ```yaml servers: @@ -483,7 +490,7 @@ Field Name | Type | Description head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. -servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. +servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). @@ -589,7 +596,7 @@ Field Name | Type | Description callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. -servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. +servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. This object can be extended with [Specification Extensions](#specificationExtensions). From 205fc564aaa7ba6d2759a1870912271e75e75640 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Feb 2017 22:30:34 -0800 Subject: [PATCH 0235/1801] host->server --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 243680ee3f..1692e90092 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -336,7 +336,7 @@ url: https://development.gigantic-server.com/v1 description: Development server ``` -The following shows how multiple hosts can be described, for example, at the OpenAPI Object's `servers`(#oasServers): +The following shows how multiple servers can be described, for example, at the OpenAPI Object's `servers`(#oasServers): ```yaml servers: From 8d9716850249a1a1f90efe67be3158cc0ec35b38 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 09:42:02 -0500 Subject: [PATCH 0236/1801] Text cleanup --- versions/3.0.md | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2d71556dc5..ffffecb4a7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -50,7 +50,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Links Object](#linksObject) - [Link Object](#linkObject) - [Variable substitution](#variableSubstitution) - - [Link Parameters](#linkParameters) + - [Link Parameters](#linkParametersObject) - [Header Object](#headerObject) - [Tag Object](#tagObject) - [Examples Object](#examplesObject) @@ -384,7 +384,7 @@ This object can be extended with [Specification Extensions](#specificationExtens #### Components Object Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. ##### Fixed Fields @@ -392,14 +392,14 @@ All objects defined within the components object will have no effect on the API Field Pattern | Type | Description ---|:---|--- definitions | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). - responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Responses Objects](#responseObject). + responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). - requestBodies | Map[`string`, [RequestBody Object](#requestBodyObject)] | An object to hold reusable [RequestBody objects](#requestBodyObject). + requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). - securityDefinitions| Map[`string`, [Security Scheme object](#securitySchemeObject)] | An object to hold reusable [Security Scheme objects](#securitySchemeObject). + securityDefinitions| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). - callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Object](#callbackObject). + callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Objects](#callbackObject). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. @@ -451,16 +451,20 @@ my\org\User "in": "query", "description": "number of items to skip", "required": true, - "type": "integer", - "format": "int32" + "schema": { + "type": "integer", + "format": "int32" + } }, "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, - "type": "integer", - "format": "int32" + "schema" : { + "type": "integer", + "format": "int32" + } } }, "responses": { @@ -528,15 +532,17 @@ components: in: query description: number of items to skip required: true - type: integer - format: int32 + schema: + type: integer + format: int32 limitParam: name: limit in: query description: max records to return required: true - type: integer - format: int32 + schema: + type: integer + format: int32 responses: NotFound: description: Entity not found. @@ -1675,7 +1681,7 @@ description: object created #### Callbacks Object A map of possible out-of band callbacks related to the parent operation. -Each value in the map is an [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. +Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. ##### Patterned Fields @@ -1694,13 +1700,13 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{expression} | [Path Item Object](#pathItemObject) | An Path Item Object used to define a callback request and expected responses +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). ##### Key Expression -The key used to identify the Path Item Object is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). @@ -1865,7 +1871,7 @@ Field Name | Type | Description ---|:---:|--- href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing Operation Object in the OAS. -parameters | [Link Parameters Object](#linkParameters) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. +parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). @@ -2241,7 +2247,7 @@ components: ``` -### Link Parameters +### Link Parameters Object Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. From 988603888fc5f26cdaeea2ee6f134cf44534b83e Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 10:13:00 -0500 Subject: [PATCH 0237/1801] Rename Content Type Object to Media Type Object --- versions/3.0.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9d633a9d95..ff12ac8cde 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -42,7 +42,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Parameter Object](#parameterObject) - [Request Body Object](#requestBodyObject) - [Content Object](#contentObject) - - [Content Type Object](#contentTypeObject) + - [Media Type Object](#mediaTypeObject) - [Responses Object](#responsesObject) - [Response Object](#responseObject) - [Headers Object](#headersObject) @@ -759,8 +759,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. +examples | [[Example Object](#exampleObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1023,10 +1023,10 @@ content: #### Content Object -Describes a set of supported content types. A content object can be used in [requestBody](#requestBody), +Describes a set of supported media types. A content object can be used in [requestBody](#requestBody), [parameter objects](#parameterObject), [header objects](#headerObject), and [response objects](#responseObject). -Each key in the content object is the media-type of the [Content Type Object](#contentTypeObject). +Each key in the content object is the media-type of the [Media Type Object](#mediaTypeObject). ##### Content Examples @@ -1081,25 +1081,24 @@ content: - "Bob,Diane,Mary,Bill" ``` -#### Content Type Object -Each content type object provides schema and examples for a the media type identified by its key. Content Type objects can be used in a [content object](#contentObject). +#### Media Type Object +Each media type object provides schema and examples for a the media type identified by its key. Media Type objects can be used in a [content object](#contentObject). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. -examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -encoding | [Encoding Object](#encodingObject) | Encoding of the content type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. +schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +examples | [Examples Array](#examplesArray) | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the media type is `multipart`. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. -##### Content Type Examples +##### Media Type Examples -A content type description. ```js { "application/json": { From d8a11ac8abf0d36acce1a4028f74ad10fb682f34 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 12:55:53 -0500 Subject: [PATCH 0238/1801] Updated capitalization and slashed some hyphens --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ff12ac8cde..57ebfd0f2e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1023,10 +1023,10 @@ content: #### Content Object -Describes a set of supported media types. A content object can be used in [requestBody](#requestBody), -[parameter objects](#parameterObject), [header objects](#headerObject), and [response objects](#responseObject). +Describes a set of supported media types. A Content Object can be used in [Request Body Object](#requestBody), +[Parameter Objects](#parameterObject), [Header Objects](#headerObject), and [Response Objects](#responseObject). -Each key in the content object is the media-type of the [Media Type Object](#mediaTypeObject). +Each key in the Content Object is the media type of the [Media Type Object](#mediaTypeObject). ##### Content Examples @@ -1082,7 +1082,7 @@ content: ``` #### Media Type Object -Each media type object provides schema and examples for a the media type identified by its key. Media Type objects can be used in a [content object](#contentObject). +Each Media Type Object provides schema and examples for a the media type identified by its key. Media Type Objects can be used in a [Content Object](#contentObject). ##### Fixed Fields Field Name | Type | Description @@ -1090,7 +1090,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. examples | [Examples Array](#examplesArray) | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the media type is `multipart`. +encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The Encoding Object SHOULD only apply to `requestBody` objects when the media type is `multipart`. ##### Patterned Fields Field Pattern | Type | Description From 92b8028ed9b31ffa4aafa275edc279eb5ad68ebb Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 13:08:20 -0500 Subject: [PATCH 0239/1801] Merged Marsh's content-type changes in this PR --- versions/3.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4da70e3015..5379c64263 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -933,7 +933,7 @@ Field Name | Type | Description examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. -For more complex scenarios a `content` object can be used to define the media-type +For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario above. When `example` or `examples` are provided in conjunction with the `schema` object, the example must follow the prescribed serialization strategy for the parameter. @@ -1453,7 +1453,7 @@ requestBody: format: binary encoding: historyMetadata: - # require XML content-type in utf-8 encoding + # require XML Content-Type in utf-8 encoding contentType: application/xml; charset=utf-8 profileImage: # only accept png/jpeg @@ -1467,9 +1467,9 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The content-type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. +contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | The content-type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +style | `string` | The Content-Type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1890,7 +1890,7 @@ Because of the potential for name clashes, consider the `href` syntax as the pre #### Response Payload Values -Payload values are only available in parsable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id. +Payload values are only available in parsable response payloads which match the advertised media type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition. @@ -2255,7 +2255,7 @@ components: ### Link Parameters Object -Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media-type options, security requirements, response and error payloads. +Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. To specify parameters required by the operation, we can use a **Link Parameters Object**. @@ -2364,7 +2364,7 @@ definitions: example: $ref: http://foo.bar#/examples/name-example -# in a request body, note the plural `examples` as the content-type is set to `*`: +# in a request body, note the plural `examples` as the Content-Type is set to `*`: requestBody: content: 'application/json': From dc10386921ced7032228690c71ea381e80150f8b Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 12:44:30 -0800 Subject: [PATCH 0240/1801] Fixed server templates and all things relative --- versions/3.0.md | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 3ebe16b2fd..1554fbf9fd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -31,9 +31,11 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Schema](#schema) - [OpenAPI Object](#oasObject) - [Info Object](#infoObject) - - [Contact Object](#contactObject) - - [License Object](#licenseObject) + - [Contact Object](#contactObject) + - [License Object](#licenseObject) - [Server Object](#serverObject) + - [Server Variables Object](#serverVariablesObject) + - [Server Variable Object](#serverVariableObject) - [Components Object](#componentsObject) - [Paths Object](#pathsObject) - [Path Item Object](#pathItemObject) @@ -159,12 +161,12 @@ date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc. dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) password | `string` | `password` | Used to hint UIs the input needs to be obscured. -### Relative References In URLs +### Relative References in URLs Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). -Relative references are resolved using the URLs defined in the [Servers array](#servers) as a Base URI. +Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. -Relative references used in $ref are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), i.e. using the URL of the current document as the base URI. +Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), i.e. using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). ### Schema @@ -317,9 +319,9 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | A absolute URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are _optional_ and specified by the [Host Template Parameter](#hostTemplateParameter) syntax. Template substitutions will be made when a variable is named in `{`brackets`}`. -description | `string` | An optional string describing the host designated by the URL. -templates | [Templates Object](#hostTemplatesObject) | An object holding templates for substitution in the URL template +url | `string` | A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +description | `string` | An optional string describing the host designated by the URL. +variables | [Server Variables Object](#serverVariablesObject) | An object holding variables for substitution in the URL template. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -344,13 +346,13 @@ servers: description: Production server ``` -The following shows how templates can be used for a server configuration: +The following shows how variables can be used for a server configuration: ```yaml servers: - url: https://{username}.gigantic-server.com:{port}/{basePath} description: The production API server - templates: + variables: username: # note! no enum here means it is an open value default: demo @@ -365,26 +367,26 @@ servers: default: v2 ``` -#### Host Templates Object +#### Server Variables Object ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - [variable name] | [Host Template Parameter](#hostTemplateParameter) | A parameter to be used for substitution in the URL template. + {name} | [Server Variable Object](#serverVariableObject) | A variable to be used for substitution in a Server's URL template. This object can be extended with [Specification Extensions](#specificationExtensions). -#### Host Template +#### Server Variable Object -An object representing a Host URL template +An object representing a Server Variable for server URL template substituion. Field Name | Type | Description ---|:---:|--- -enum | [Possible Values] | An enumeration of primitive type values to be used if the substitution options are from a limited set. -default | [Default Value] | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. -description | `string` | An optional description for the template parameter +enum | [ `primitive` ] | An enumeration of primitive type values to be used if the substitution options are from a limited set. +default | `primitive` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +description | `string` | An optional description for the server variable. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -580,8 +582,7 @@ components: #### Paths Object Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct -the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). +The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). ##### Patterned Fields From 1eab1bbc6d633c8bd1ad90843a1affec87aa5059 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 16:21:50 -0500 Subject: [PATCH 0241/1801] Renamed some components for consistency --- versions/3.0.md | 136 ++++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5379c64263..7f7cb8344f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -27,7 +27,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Format](#format) - [File Structure](#fileStructure) - [Data Types](#dataTypes) - - [Relative References In Urls](#relativeReferences) + - [Relative References In URLs](#relativeReferences) - [Schema](#schema) - [OpenAPI Object](#oasObject) - [Info Object](#infoObject) @@ -49,8 +49,8 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Examples Object](#examplesObject) - [Links Object](#linksObject) - [Link Object](#linkObject) - - [Variable substitution](#variableSubstitution) - - [Link Parameters](#linkParametersObject) + - [Variable Substitution](#variableSubstitution) + - [Link Parameters Object](#linkParametersObject) - [Header Object](#headerObject) - [Tag Object](#tagObject) - [Examples Object](#examplesObject) @@ -159,7 +159,7 @@ date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc. dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) password | `string` | `password` | Used to hint UIs the input needs to be obscured. -### Relative References In URLs +### Relative References in URLs Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). Relative references are resolved using the URLs defined in the [Servers array](#servers) as a Base URI. @@ -398,13 +398,13 @@ All objects defined within the components object will have no effect on the API Field Pattern | Type | Description ---|:---|--- - definitions | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). + schemas | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). - securityDefinitions| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). + securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Objects](#callbackObject). @@ -421,11 +421,11 @@ my.org.User my\org\User ``` -##### Definitions Object Example +##### Components Object Example ```json "components": { - "definitions": { + "schemas": { "Category": { "type": "object", "properties": { @@ -486,13 +486,13 @@ my\org\User "content": { "application/json": { "schema": { - "$ref": "#/definitions/GeneralError" + "$ref": "#/components/schemas/GeneralError" } } } } }, - "securityDefinitions": { + "securitySchemes": { "api_key": { "type": "apiKey", "name": "api_key", @@ -516,7 +516,7 @@ my\org\User ```yaml components: - definitions: + schemas: Category: type: object properties: @@ -560,8 +560,8 @@ components: content: application/json schema: - $ref: '#/definitions/GeneralError' - securityDefinitions: + $ref: '#/components/schemas/GeneralError' + securitySchemas: api_key: type: apiKey name: api_key @@ -606,7 +606,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "schema": { "type": "array", "items": { - "$ref": "#/definitions/pet" + "$ref": "#/components/schemas/pet" } } } @@ -630,7 +630,7 @@ This object can be extended with [Specification Extensions](#specificationExtens schema: type: array items: - $ref: '#/definitions/pet' + $ref: '#/components/schemas/pet' ``` #### Path Item Object @@ -676,7 +676,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "schema": { "type": "array", "items": { - "$ref": "#/definitions/Pet" + "$ref": "#/components/schemas/Pet" } } } @@ -687,7 +687,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "content": { "text/html": { "schema": { - "$ref": "#/definitions/ErrorModel" + "$ref": "#/components/schemas/ErrorModel" } } } @@ -723,13 +723,13 @@ get: schema: type: array items: - $ref: '#/definitions/Pet' + $ref: '#/components/schemas/Pet' default: description: error payload content: 'text/html': schema: - $ref: '#/definitions/ErrorModel' + $ref: '#/components/schemas/ErrorModel' parameters: - name: id in: path @@ -1120,13 +1120,13 @@ A request body with a referenced model definition. "content": { "application/json": { "schema": { - "$ref": "#/definitions/User" + "$ref": "#/components/schemas/User" }, "examples": [ "http://foo.bar/examples/user-example.json" ] }, "application/xml": { "schema": { - "$ref": "#/definitions/User" + "$ref": "#/components/schemas/User" }, "examples": [ "http://foo.bar/examples/user-example.xml" ] }, @@ -1147,12 +1147,12 @@ description: user to add to the system content: 'application/json': schema: - $ref: '#/definitions/User' + $ref: '#/components/schemas/User' examples: - 'http://foo.bar/examples/user-example.json' 'application/xml': schema: - $ref: '#/definitions/User' + $ref: '#/components/schemas/User' examples: - 'http://foo.bar/examples/user-example.xml' 'text/plain': @@ -1275,7 +1275,7 @@ Field Pattern | Type | Description { "application/json": { "schema": { - "$ref": "#/definitions/Pet" + "$ref": "#/components/schemas/Pet" }, "examples": [{ "name": "Fluffy", @@ -1292,7 +1292,7 @@ Field Pattern | Type | Description ```yaml application/json: schema: - $ref: "#/definitions/Pet" + $ref: "#/components/schemas/Pet" examples: # converted directly from YAML to JSON - name: Fluffy @@ -1411,7 +1411,7 @@ requestBody: # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example) type: array items: - type: '#/definitions/Address' + type: '#/components/schemas/Address' ``` In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. @@ -1514,7 +1514,7 @@ A 200 response for successful operation and a default response for others (imply "content": { "application/json": { "schema": { - "$ref": "#/definitions/Pet" + "$ref": "#/components/schemas/Pet" } } } @@ -1524,7 +1524,7 @@ A 200 response for successful operation and a default response for others (imply "content": { "application/json": { "schema": { - "$ref": "#/definitions/ErrorModel" + "$ref": "#/components/schemas/ErrorModel" } } } @@ -1538,13 +1538,13 @@ A 200 response for successful operation and a default response for others (imply content: application/json: schema: - $ref: '#/definitions/Pet' + $ref: '#/components/schemas/Pet' default: description: Unexpected error content: application/json: schema: - $ref: '#/definitions/ErrorModel' + $ref: '#/components/schemas/ErrorModel' ``` #### Response Object @@ -1583,7 +1583,7 @@ Response of an array of a complex type: "schema": { "type": "array", "items": { - "$ref": "#/definitions/VeryComplexType" + "$ref": "#/components/schemas/VeryComplexType" } } } @@ -1598,7 +1598,7 @@ content: schema: type: array items: - $ref: '#/definitions/VeryComplexType' + $ref: '#/components/schemas/VeryComplexType' ``` Response with a string type: @@ -1768,7 +1768,7 @@ myWebhook: content: 'application/json' schema: - $ref: '#/components/definitions/SomePayload' + $ref: '#/components/schemas/SomePayload' responses: 200: description: webhook successfully processed an no retries will be performed @@ -1867,7 +1867,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the definitions name. +link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. @@ -2061,7 +2061,7 @@ paths: content: application/json: schema: - $ref: '#/components/definitions/user' + $ref: '#/components/schemas/user' links: userRepositories: $ref: '#/components/links/UserRepositories' @@ -2081,7 +2081,7 @@ paths: schema: type: array items: - $ref: '#/components/definitions/repository' + $ref: '#/components/schemas/repository' links: userRepository: $ref: '#/components/links/UserRepository' @@ -2103,7 +2103,7 @@ paths: content: application/json: schema: - $ref: '#/components/definitions/repository' + $ref: '#/components/schemas/repository' links: repositoryPullRequests: $ref: '#/components/links/RepositoryPullRequests' @@ -2134,7 +2134,7 @@ paths: schema: type: array items: - $ref: '#/components/definitions/pullrequest' + $ref: '#/components/schemas/pullrequest' /2.0/repositories/{username}/{slug}/pullrequests/{pid}: get: operationId: getPullRequestsById @@ -2157,7 +2157,7 @@ paths: content: application/json: schema: - $ref: '#/components/definitions/pullrequest' + $ref: '#/components/schemas/pullrequest' links: $ref: '#/components/links/PullRequestMerge' /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: @@ -2182,18 +2182,18 @@ paths: components: links: UserRepositories: - # returns array of '#/components/definitions/repository' + # returns array of '#/components/schemas/repository' operationId: getRepositoriesByOwner parameters: username: $response.body#/username UserRepository: - # returns '#/components/definitions/repository' + # returns '#/components/schemas/repository' operationId: getRepository parameters: username: $response.body#/owner/username slug: $response.body#/slug RepositoryPullRequests: - # returns '#/components/definitions/pullrequest' + # returns '#/components/schemas/pullrequest' operationId: getPullRequestsByRepository params: username: $response.body#/owner/username @@ -2205,7 +2205,7 @@ components: username: $response.body#/user/username # Should be $response.author.username? slug: $response.body#/repository/slug pid: $response.body#/id - definitions: + schemas: user: type: object properties: @@ -2219,7 +2219,7 @@ components: slug: type: string owner: - $ref: '#/components/definitions/user' + $ref: '#/components/schemas/user' pullrequest: type: object properties: @@ -2228,9 +2228,9 @@ components: title: type: string repository: - $ref: '#/components/definitions/repository' + $ref: '#/components/schemas/repository' author: - $ref: '#/components/definitions/user' + $ref: '#/components/schemas/user' ``` As references to `operationId` MAY NOT be possible (the `operationId` is an optional value), references MAY also be made through a relative `href`: @@ -2239,7 +2239,7 @@ As references to `operationId` MAY NOT be possible (the `operationId` is an opti components: links: UserRepositories: - # returns array of '#/components/definitions/repository' + # returns array of '#/components/schemas/repository' href: '/2.0/repositories/{$response.body#/username}' ``` @@ -2249,7 +2249,7 @@ or an absolute `href`: components: links: UserRepositories: - # returns array of '#/components/definitions/repository' + # returns array of '#/components/schemas/repository' href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body#/username}' ``` @@ -2357,7 +2357,7 @@ are not compatible. ```yaml # in a model -definitions: +schemas: properties: name: type: string @@ -2369,7 +2369,7 @@ definitions: content: 'application/json': schema: - $ref: '#/definitions/Address' + $ref: '#/components/schemas/Address' examples: - {"foo": "bar"} - {"bar": "baz"} @@ -2397,7 +2397,7 @@ definitions: content: application/json: schema: - $ref: '#/definitions/SuccessResponse' + $ref: '#/components/schemas/SuccessResponse' example: $ref: http://foo.bar#/examples/address-example.json ``` @@ -2421,12 +2421,12 @@ This object cannot be extended with additional properties and any properties add ```json { - "$ref": "#/components/definitions/Pet" + "$ref": "#/components/schemas/Pet" } ``` ```yaml -$ref: '#/components/definitions/Pet' +$ref: '#/components/schemas/Pet' ``` ##### Relative Schema File Example @@ -2561,7 +2561,7 @@ format: email "type": "string" }, "address": { - "$ref": "#/components/definitions/Address" + "$ref": "#/components/schemas/Address" }, "age": { "type": "integer", @@ -2580,7 +2580,7 @@ properties: name: type: string address: - $ref: '#/components/definitions/Address' + $ref: '#/components/schemas/Address' age: type: integer format: int32 @@ -2612,7 +2612,7 @@ For a string to model mapping: { "type": "object", "additionalProperties": { - "$ref": "#/components/definitions/ComplexModel" + "$ref": "#/components/schemas/ComplexModel" } } ``` @@ -2620,7 +2620,7 @@ For a string to model mapping: ```yaml type: object additionalProperties: - $ref: '#/components/definitions/ComplexModel' + $ref: '#/components/schemas/ComplexModel' ``` ###### Model with Example @@ -2711,7 +2711,7 @@ examples: ```json { - "definitions": { + "schemas": { "ErrorModel": { "type": "object", "required": [ @@ -2732,7 +2732,7 @@ examples: "ExtendedErrorModel": { "allOf": [ { - "$ref": "#/definitions/ErrorModel" + "$ref": "#/components/schemas/ErrorModel" }, { "type": "object", @@ -2752,7 +2752,7 @@ examples: ``` ```yaml -definitions: +schemas: ErrorModel: type: object required: @@ -2767,7 +2767,7 @@ definitions: maximum: 600 ExtendedErrorModel: allOf: - - $ref: '#/definitions/ErrorModel' + - $ref: '#/components/schemas/ErrorModel' - type: object required: - rootCause @@ -2780,7 +2780,7 @@ definitions: ```json { - "definitions": { + "schemas": { "Pet": { "type": "object", "discriminator": "petType", @@ -2801,7 +2801,7 @@ definitions: "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", "allOf": [ { - "$ref": "#/definitions/Pet" + "$ref": "#/components/schemas/Pet" }, { "type": "object", @@ -2828,7 +2828,7 @@ definitions: "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", "allOf": [ { - "$ref": "#/definitions/Pet" + "$ref": "#/components/schemas/Pet" }, { "type": "object", @@ -2852,7 +2852,7 @@ definitions: ``` ```yaml -definitions: +schemas: Pet: type: object discriminator: petType @@ -2867,7 +2867,7 @@ definitions: Cat: ## "Cat" will be used as the discriminator value description: A representation of a cat allOf: - - $ref: '#/definitions/Pet' + - $ref: '#/components/schemas/Pet' - type: object properties: huntingSkill: @@ -2884,7 +2884,7 @@ definitions: Dog: ## "Dog" will be used as the discriminator value description: A representation of a dog allOf: - - $ref: '#/definitions/Pet' + - $ref: '#/components/schemas/Pet' - type: object properties: packSize: @@ -3442,7 +3442,7 @@ read:pets: read your pets #### Security Requirement Object Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#componentsSecurityDefinitions) under the [Components Object](#componentsObject). +The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#componentsSecuritySchemes) under the [Components Object](#componentsObject). Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where there multiple query parameters or HTTP headers are required to convey security information. From 915675d1cc5a40550fe44dec67adbef3c50515cf Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 13:59:38 -0800 Subject: [PATCH 0242/1801] schema object references --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e1896de8c6..d798f9dae4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -930,7 +930,7 @@ Field Name | Type | Description style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. +schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. @@ -1108,7 +1108,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -`*` | [Schema Object](#schemaObject) | The schema defining the request body. +`*` | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the request body. ^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. @@ -1260,7 +1260,7 @@ Each Media Type Object provides schema and examples for a the media type identif Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body. +schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the request body. examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. From 5fd2cdd6aab37517a03f06b3e7fc9c87e347e044 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 14:08:40 -0800 Subject: [PATCH 0243/1801] link object references --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d798f9dae4..d933450239 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1868,7 +1868,7 @@ Field Name | Type | Description Field Pattern | Type | Description ---|:---:|--- -link name | [Link Object](#linkObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). +link name | [Link Object](#linkObject) | [Reference Object](#referenceObject)] | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. From 674d96331d1690d70ce883f82b30dd1787cccaa7 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 17:27:24 -0500 Subject: [PATCH 0244/1801] various minor corrections. --- versions/3.0.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e1896de8c6..16e45e58ea 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -181,7 +181,7 @@ It combines what previously was the Resource Listing and API Declaration (versio Field Name | Type | Description ---|:---:|--- -openapi | [OpenAPI Version String](#oasVersion) | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. +openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. @@ -192,7 +192,7 @@ Field Name | Type | Description This object can be extended with [Specification Extensions](#specificationExtensions). -#### OpenAPI Version String +#### OpenAPI Version String The version string signifies the version of the OpenAPI Specification that the document complies to. The format for this string MUST be `major`.`minor`.`patch`. The `patch` MAY be suffixed by a hyphen and extra alphanumeric characters. @@ -384,7 +384,7 @@ An object representing a Server Variable for server URL template substituion. Field Name | Type | Description ---|:---:|--- -enum | [ `primitive` ] | An enumeration of primitive type values to be used if the substitution options are from a limited set. +enum | [`primitive`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. default | `primitive` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. @@ -410,6 +410,8 @@ Field Pattern | Type | Description links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Objects](#callbackObject). +This object can be extended with [Specification Extensions](#specificationExtensions). + All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. Field Name Examples: @@ -1076,10 +1078,12 @@ A free-form query parameter, allowing undefined parameters of a specific type: { "in": "query", "name": "freeForm", - "type": "object", - "additionalProperties": { - "type": "integer" - }, + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer" + }, + } "style": "form" } ``` @@ -1087,9 +1091,10 @@ A free-form query parameter, allowing undefined parameters of a specific type: ```yaml in: query name: freeForm -type: object -additionalProperties: - type: integer +schema: + type: object + additionalProperties: + type: integer style: form ``` From f80ab0d4afe64bfe6bd2184f45dd58bec0e40717 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 14:36:30 -0800 Subject: [PATCH 0245/1801] Reorganized title headers in the spec --- versions/3.0.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d933450239..cd474b5520 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -51,7 +51,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Examples Object](#examplesObject) - [Links Object](#linksObject) - [Link Object](#linkObject) - - [Variable Substitution](#variableSubstitution) - [Link Parameters Object](#linkParametersObject) - [Header Object](#headerObject) - [Tag Object](#tagObject) @@ -1872,7 +1871,7 @@ Field Pattern | Type | Description The link SHALL reference a single Link Object, or a JSON Reference to a single link object. -### Link Object +#### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description @@ -1889,13 +1888,13 @@ Locating a linked resource MAY be performed by either a `href` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. -#### Response Payload Values +##### Response Payload Values Payload values are only available in parsable response payloads which match the advertised media type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition. -### Example +##### Example Response payload: ```json @@ -1934,7 +1933,7 @@ color: ["red", "green", "blue"] The variables generated can be used in locations prescribed by the definition. -### Variable Substitution +##### Variable Substitution In all cases, _variables_ from request and responses may be substituted for link generation. The table below provides examples of variable expressions and examples of their use in a value: @@ -1970,7 +1969,7 @@ The variable expression is defined by the following [ABNF](https://tools.ietf.or The `name` identifier is case-sensitive, whereas `token` is not. -### Request Parameter Example +##### Request Parameter Example Computing a link from a request operation like such: ```yaml @@ -2010,7 +2009,7 @@ For a `id` value of `10101110`, the generated link would be: href: '/users/10101110/department' ``` -### Response Payload Example +##### Response Payload Example ```yaml Addresses: @@ -2042,7 +2041,7 @@ href: 'http://colors.my-server.com/colors/blue' As with all links, it at the the clients' discretion to follow them, and permissions and the ability to make a successful call to that link is not guaranteed solely by the existence of a relationship. -### Example +##### Example The example below shows how relationships in the BitBucket API can be represented with the link schema. This example uses `operationId` values to link responses to possible operations. @@ -2255,7 +2254,7 @@ components: ``` -### Link Parameters Object +#### Link Parameters Object Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. From d1dd1d94a353c6fbcae9ef52bea6bbb04e4e3096 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 18:14:00 -0500 Subject: [PATCH 0246/1801] removed x- from media type objects --- versions/3.0.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index c59c247d7e..686eae263a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1263,16 +1263,12 @@ Each Media Type Object provides schema and examples for a the media type identif ##### Fixed Fields Field Name | Type | Description ---|:---:|--- - schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the request body. examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Media Type Examples From 417aaea0548697a3e77580e4be4230ce277606ea Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 15:38:24 -0800 Subject: [PATCH 0247/1801] misc fixes --- versions/3.0.md | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 686eae263a..c71c7d3f2a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -48,7 +48,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Responses Object](#responsesObject) - [Response Object](#responseObject) - [Headers Object](#headersObject) - - [Examples Object](#examplesObject) + - [Example Object](#exampleObject) - [Links Object](#linksObject) - [Link Object](#linkObject) - [Link Parameters Object](#linkParametersObject) @@ -397,7 +397,7 @@ All objects defined within the components object will have no effect on the API ##### Fixed Fields -Field Pattern | Type | Description +Field Name | Type | Description ---|:---|--- schemas | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). @@ -1109,12 +1109,7 @@ Field Name | Type | Description required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -`*` | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the request body. -^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details. - +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Request Body Examples @@ -1560,16 +1555,6 @@ Field Name | Type | Description content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. - -##### Patterned Objects - -Field Pattern | Type | Description ----|:---:|--- -`*` | [Schema Object](#schemaObject)| [Reference Object](#referenceObject) | A schema describing the response value for a specific `Content-Type` - -Representations MAY take the form of a wildcard (`*`) to designate any `Content-Type`, -or a regular expression for matching a specific type - This object can be extended with [Specification Extensions](#specificationExtensions). ##### Response Object Examples @@ -2366,7 +2351,7 @@ schemas: $ref: http://foo.bar#/examples/name-example # in a request body, note the plural `examples` as the Content-Type is set to `*`: - requestBody: + requestBody: content: 'application/json': schema: From 9dd627e93272bc8f8e73b8c74429f449c1a51f1a Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 18:55:36 -0500 Subject: [PATCH 0248/1801] Updates to link object and link parameter objects --- versions/3.0.md | 61 ++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 686eae263a..b50c0aa280 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1860,25 +1860,20 @@ The presence of a link does not guarantee the caller's ability to successfully i As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. -For computing links, and providing instructions to execute them, a mechanism is defined for accessing values in a response and using them as variables while invoking the linked operation. - -Field Name | Type | Description ----|:---:|--- -$ref | `string` | If present, a reference to another Links Object. Note, the presence of `$ref` in the Links Object will cause all _Patterned Objects_ to be ignored. +For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. Field Pattern | Type | Description ---|:---:|--- -link name | [Link Object](#linkObject) | [Reference Object](#referenceObject)] | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject)] | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. - #### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description ---|:---:|--- href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing Operation Object in the OAS. +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). @@ -2053,9 +2048,10 @@ paths: operationId: getUserByName parameters: - name: username - type: string in: path required: true + schema: + type: string responses: 200: description: The User @@ -2071,9 +2067,10 @@ paths: operationId: getRepositoriesByOwner parameters: - name: username - type: string in: path required: true + schema: + type: string responses: 200: description: repositories owned by the supplied user @@ -2094,10 +2091,13 @@ paths: type: string in: path required: true + schema: + type: string - name: slug - type: string in: path required: true + schema: + type: string responses: 200: description: The repository @@ -2113,20 +2113,23 @@ paths: operationId: getPullRequestsByRepository parameters: - name: username - type: string in: path required: true + schema: + type: string - name: slug - type: string in: path required: true + schema: + type: string - name: state - type: string in: query - enum: - - open - - merged - - declined + schema: + type: string + enum: + - open + - merged + - declined responses: 200: description: an array of pull request objects @@ -2141,17 +2144,20 @@ paths: operationId: getPullRequestsById parameters: - name: username - type: string in: path required: true + schema: + type: string - name: slug - type: string in: path required: true + schema: + type: string - name: pid - type: string in: path required: true + schema: + type: string responses: 200: description: a pull request object @@ -2166,17 +2172,20 @@ paths: operationId: mergePullRequest parameters: - name: username - type: string in: path required: true + schema: + type: string - name: slug - type: string in: path required: true + schema: + type: string - name: pid - type: string in: path required: true + schema: + type: string responses: 204: description: the PR was successfully merged @@ -2262,6 +2271,10 @@ Many operations require parameters to be passed, and these MAY be dynamic depend To specify parameters required by the operation, we can use a **Link Parameters Object**. This object contains parameter names along with static or dynamic values: +Field Pattern | Type | Description +---|:---:|--- + {name} | Any | [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. + ```yaml paths: /user/{username}: # ... From 9d4755cd25f46c8723a05626da6d0b77e087506b Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 15:58:01 -0800 Subject: [PATCH 0249/1801] definition changes --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index c71c7d3f2a..35296bcba1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2390,7 +2390,7 @@ schemas: #### Reference Object -A simple object to allow referencing other definitions in the specification, internally and externally. +A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. @@ -2509,8 +2509,8 @@ To support polymorphism, OpenAPI Specification adds the support of the `discrimi When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. There are are two ways to define the value of a discriminator for an inheriting instance. -- Use the definition's name. -- Override the definition's name by overriding the property with a new value. If exists, this takes precedence over the definition's name. +- Use the schema's name. +- Override the schema's name by overriding the property with a new value. If exists, this takes precedence over the schema's name. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. ###### XML Modeling @@ -3428,7 +3428,7 @@ read:pets: read your pets #### Security Requirement Object Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#componentsSecuritySchemes) under the [Components Object](#componentsObject). +The name used for each property MUST correspond to a security scheme declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where there multiple query parameters or HTTP headers are required to convey security information. @@ -3439,7 +3439,7 @@ When a list of Security Requirement Objects is defined on the [Open API object]( Field Pattern | Type | Description ---|:---:|--- -{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +{name} | [`string`] | Each name MUST correspond to a security scheme which is ddeclared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. ##### Security Requirement Object Examples From 539037acefaf0d434f953cbbd26fcb1f2a048f75 Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 18:58:48 -0500 Subject: [PATCH 0250/1801] Removed a ] --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b50c0aa280..9539ebbd4e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1864,7 +1864,7 @@ For computing links, and providing instructions to execute them, [variable subst Field Pattern | Type | Description ---|:---:|--- - {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject)] | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. #### Link Object From 8d54b8642d342869a633db6f51c63906be010f45 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 16:04:19 -0800 Subject: [PATCH 0251/1801] Removed extra d --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 35296bcba1..bade5d456c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3439,7 +3439,7 @@ When a list of Security Requirement Objects is defined on the [Open API object]( Field Pattern | Type | Description ---|:---:|--- -{name} | [`string`] | Each name MUST correspond to a security scheme which is ddeclared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. ##### Security Requirement Object Examples From 9febd066306039d5d24a53212274b5c61cc84d98 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 28 Feb 2017 16:30:16 -0800 Subject: [PATCH 0252/1801] update version --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 686eae263a..b4d86da2ff 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,6 +1,6 @@ # OpenAPI Specification -#### Version 3.0 +#### Version 3.0.0-rc0 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). From f0594a41b8b282422a74910536179e2669b7732f Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 28 Feb 2017 19:35:03 -0500 Subject: [PATCH 0253/1801] Added pattern headings --- versions/3.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9539ebbd4e..69e8ecba52 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1862,6 +1862,7 @@ As opposed to _dynamic_ links (links provided **in** the response payload), the For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. +##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). @@ -2271,6 +2272,7 @@ Many operations require parameters to be passed, and these MAY be dynamic depend To specify parameters required by the operation, we can use a **Link Parameters Object**. This object contains parameter names along with static or dynamic values: +##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- {name} | Any | [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. From e5bfee3047260863812668a2298831f2c212df75 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 28 Feb 2017 17:11:57 -0800 Subject: [PATCH 0254/1801] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad4b4fc621..c644ab7cf4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) -**Looking for the next version of the OpenAPI Specification? [See here](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next).** +**The OAS 3.0.0-RC0 Spec can be [found here](https://github.com/OAI/OpenAPI-Specification/blob/3.0.0-rc0/versions/3.0.md)** The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service. From 26df7108b54c8a2087295978a3b54dcabfc3ba64 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Fri, 3 Mar 2017 11:18:57 -0800 Subject: [PATCH 0255/1801] Fix a few missing entries and a broken link in the Table of Contents. --- versions/3.0.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..b6ef87d49b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -34,8 +34,8 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Contact Object](#contactObject) - [License Object](#licenseObject) - [Server Object](#serverObject) - - [Server Variables Object](#serverVariablesObject) - - [Server Variable Object](#serverVariableObject) + - [Server Variables Object](#serverVariablesObject) + - [Server Variable Object](#serverVariableObject) - [Components Object](#componentsObject) - [Paths Object](#pathsObject) - [Path Item Object](#pathItemObject) @@ -45,8 +45,12 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Request Body Object](#requestBodyObject) - [Content Object](#contentObject) - [Media Type Object](#mediaTypeObject) + - [Encoding Object](#encodingObject) + - [Encoding Property Object](#encodingPropertyObject) - [Responses Object](#responsesObject) - [Response Object](#responseObject) + - [Callbacks Object](#callbacksObject) + - [Callback Object](#callbackObject) - [Headers Object](#headersObject) - [Example Object](#exampleObject) - [Links Object](#linksObject) @@ -59,6 +63,8 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Schema Object](#schemaObject) - [XML Object](#xmlObject) - [Security Scheme Object](#securitySchemeObject) + - [OAuth Flows Object](#oauthFlowsObject) + - [OAuth Flow Object](#oauthFlowObject) - [Scopes Object](#scopesObject) - [Security Requirement Object](#securityRequirementObject) - [Specification Extensions](#specificationExtensions) @@ -1853,7 +1859,7 @@ Field Pattern | Type | Description {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. -#### Link Object +#### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description From a57ca537c0fa15db0820558d4f0ce25895ba8c50 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 4 Mar 2017 07:52:14 +0000 Subject: [PATCH 0256/1801] Add missing comma in parameter example json --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..82347a984a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1082,7 +1082,7 @@ A free-form query parameter, allowing undefined parameters of a specific type: "additionalProperties": { "type": "integer" }, - } + }, "style": "form" } ``` From a651666086bb8f7a0f226cd3a53636e2c69eaa88 Mon Sep 17 00:00:00 2001 From: Max Goldstein Date: Sat, 4 Mar 2017 10:33:07 -0800 Subject: [PATCH 0257/1801] [v3] Remove extra backtick --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..4cf007650c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2491,7 +2491,7 @@ The following properties are taken from the JSON Schema definition but their def - additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - description - [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. -- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"`` but cannot be `1`. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"` but cannot be `1`. Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions in place of defining them inline. From 056af93de1667d0a96868f9135e08879617982af Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 7 Mar 2017 10:15:03 +0000 Subject: [PATCH 0258/1801] Missing capitalisation of 'must' --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..11cf037e79 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -938,7 +938,7 @@ Field Name | Type | Description For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario above. When `example` or `examples` are provided in conjunction with the `schema` object, -the example must follow the prescribed serialization strategy for the parameter. +the example MUST follow the prescribed serialization strategy for the parameter. Field Name | Type | Description From 6c0f76e7f42e6f0f416ac8ad0375740c5385c0bb Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 7 Mar 2017 12:07:03 +0000 Subject: [PATCH 0259/1801] Fix text/plain examples in Content Object Missing `examples` property in one case and missing empty example in the other. --- versions/3.0.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..80ec02bd29 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1222,8 +1222,10 @@ Each key in the Content Object is the media type of the [Media Type Object](#med ] }, "text/plain": { - "Bob,Diane,Mary,Bill", - "" + "examples": [ + "Bob,Diane,Mary,Bill", + "" + ] } } ``` @@ -1250,6 +1252,7 @@ content: 'text/plain': examples: - "Bob,Diane,Mary,Bill" + - "" ``` #### Media Type Object From 845dca56ad268d32e4d6c48014ff40e229831cce Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 7 Mar 2017 17:03:12 -0800 Subject: [PATCH 0260/1801] updated example issues --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..dc6f530502 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2149,8 +2149,8 @@ paths: description: a pull request object content: application/json: - schema: - $ref: '#/components/schemas/pullrequest' + schema: + $ref: '#/components/schemas/pullrequest' links: $ref: '#/components/links/PullRequestMerge' /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: @@ -2191,7 +2191,7 @@ components: RepositoryPullRequests: # returns '#/components/schemas/pullrequest' operationId: getPullRequestsByRepository - params: + parameters: username: $response.body#/owner/username slug: $response.body#/slug PullRequestMerge: From 996936cff1fe821a409bee63e2ec018ccb73de33 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 7 Mar 2017 17:10:38 -0800 Subject: [PATCH 0261/1801] removed extra hash --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index dc6f530502..24cc06ac6f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1853,7 +1853,7 @@ Field Pattern | Type | Description {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. -#### Link Object +#### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description From 4730caf4d389a18900532a13c05897161f08a214 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 9 Mar 2017 14:25:07 +0000 Subject: [PATCH 0262/1801] Add URL format restriction on termsOfService --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..ef2ba7d81f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -211,7 +211,7 @@ Field Name | Type | Description ---|:---:|--- title | `string` | **Required.** The title of the application. description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -termsOfService | `string` | A URL to the Terms of Service for the API. +termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. version | `string` | **Required.** The version of the API definition (which is distinct from the OpenAPI specification version or the API implementation version). From 553005304b60d66b91c6106e512b75a10a869a7c Mon Sep 17 00:00:00 2001 From: Will Dady Date: Sat, 11 Mar 2017 16:59:56 +1100 Subject: [PATCH 0263/1801] =?UTF-8?q?Renamed=20=E2=80=98Headers=E2=80=99?= =?UTF-8?q?=20field=20to=20=E2=80=98headers=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..937141b9aa 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1464,7 +1464,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. -Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | The Content-Type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. From 793c22f9a79ed8767dcf4a2ed79a92e4aa773385 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 6 Mar 2017 12:36:40 +0000 Subject: [PATCH 0264/1801] Small grammar nits 'Like such' reads badly, and add missing 'is' to 'it at the', fix double 'the the' and reword a negative clause. --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..16dcd58510 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -933,7 +933,7 @@ Field Name | Type | Description allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. +example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1260,7 +1260,7 @@ Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the request body. examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1952,7 +1952,7 @@ The `name` identifier is case-sensitive, whereas `token` is not. ##### Request Parameter Example -Computing a link from a request operation like such: +Computing a link from a request operation like this: ```yaml paths: @@ -2020,7 +2020,7 @@ href: 'http://colors.my-server.com/colors/green' href: 'http://colors.my-server.com/colors/blue' ``` -As with all links, it at the the clients' discretion to follow them, and permissions and the ability to make a successful call to that link is not guaranteed solely by the existence of a relationship. +As with all links, it is at the clients' discretion to follow them, neither permissions nor the ability to make a successful call to that link is guaranteed solely by the existence of a relationship. ##### Example From fc8c7c8cc21e8452170390848ae19a68ccfb8912 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 11 Mar 2017 07:58:42 +0000 Subject: [PATCH 0265/1801] Amend wording which might imply property ordering --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..55c355fe91 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2295,7 +2295,7 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje 1. `name` MUST NOT be specified, it is given in the [Headers Object](#headersObject). 1. `in` MUST NOT be specified, it is implicitly in `header`. -1. All traits that are affected by the location MUST follow the location of `header` (for example, [`style`](#parameterStyle)). +1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). ##### Header Object Example From 70f0b65289b5b6e6abc00b373aa8cc6ea0f47662 Mon Sep 17 00:00:00 2001 From: Will Dady Date: Sun, 12 Mar 2017 09:11:14 +1100 Subject: [PATCH 0266/1801] Fixing link to Parameter Object. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..04540e24cb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1465,7 +1465,7 @@ Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | The Content-Type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +style | `string` | The Content-Type to use for encoding a specific property. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From c7d3e1fb53c9847b4d956dbf441549abe3c9d331 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 13 Mar 2017 10:16:32 -0400 Subject: [PATCH 0267/1801] Yaml V3 examples --- examples/v3.0/api-with-examples.yaml | 163 +++++++++++++++ examples/v3.0/petstore-expanded.yaml | 155 ++++++++++++++ examples/v3.0/petstore.yaml | 109 ++++++++++ examples/v3.0/uber.yaml | 298 +++++++++++++++++++++++++++ 4 files changed, 725 insertions(+) create mode 100644 examples/v3.0/api-with-examples.yaml create mode 100644 examples/v3.0/petstore-expanded.yaml create mode 100644 examples/v3.0/petstore.yaml create mode 100644 examples/v3.0/uber.yaml diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml new file mode 100644 index 0000000000..010f6eb6ae --- /dev/null +++ b/examples/v3.0/api-with-examples.yaml @@ -0,0 +1,163 @@ +openapi: "3.0.0-RC0" +info: + title: Simple API overview + version: v2 +paths: + /: + get: + operationId: listVersionsv2 + summary: List API versions + responses: + 200: + description: |- + 200 300 response + content: + application/json: + examples: + - { + "versions": [ + { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + } + ] + }, + { + "status": "EXPERIMENTAL", + "updated": "2013-07-23T11:33:21Z", + "id": "v3.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v3/", + "rel": "self" + } + ] + } + ] + } + 300: + description: |- + 200 300 response + content: + application/json: + examples: + - | + { + "versions": [ + { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + } + ] + }, + { + "status": "EXPERIMENTAL", + "updated": "2013-07-23T11:33:21Z", + "id": "v3.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v3/", + "rel": "self" + } + ] + } + ] + } + /v2: + get: + operationId: getVersionDetailsv2 + summary: Show API version details + responses: + 200: + description: |- + 200 203 response + content: + application/json: + examples: + - { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } + 203: + description: |- + 200 203 response + content: + application/json: + examples: + - { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://23.253.228.211:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } \ No newline at end of file diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml new file mode 100644 index 0000000000..ace79b1a54 --- /dev/null +++ b/examples/v3.0/petstore-expanded.yaml @@ -0,0 +1,155 @@ +openapi: "3.0.0-RC0" +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + termsOfService: http://swagger.io/terms/ + contact: + name: Swagger API Team + email: foo@example.com + url: http://madskristensen.net + license: + name: MIT + url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: simple + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + 200: + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewPet' + responses: + 200: + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: find pet by id + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: pet deleted + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + allOf: + - $ref: '#/components/schemas/NewPet' + - required: + - id + properties: + id: + type: integer + format: int64 + + NewPet: + required: + - name + properties: + name: + type: string + tag: + type: string + + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/examples/v3.0/petstore.yaml b/examples/v3.0/petstore.yaml new file mode 100644 index 0000000000..31834cf761 --- /dev/null +++ b/examples/v3.0/petstore.yaml @@ -0,0 +1,109 @@ +openapi: "3.0.0-RC0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT +servers: + - url: http://petstore.swagger.io/v1 +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + 200: + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + 201: + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + 200: + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml new file mode 100644 index 0000000000..1ae7d8ef08 --- /dev/null +++ b/examples/v3.0/uber.yaml @@ -0,0 +1,298 @@ +# this is an example of the Uber API +# as a demonstration of an API spec in YAML +openapi: "3.0.0-RC0" +info: + title: Uber API + description: Move your app forward with the Uber API + version: "1.0.0" +servers: + - url: https://api.uber.com/v1 +paths: + /products: + get: + summary: Product Types + description: The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. + parameters: + - name: latitude + in: query + description: Latitude component of location. + required: true + schema: + type: number + format: double + - name: longitude + in: query + description: Longitude component of location. + required: true + schema: + type: number + format: double + security: + - apikey: [] + tags: + - Products + responses: + 200: + description: An array of products + content: + application/json: + schema: + $ref: "#/components/schemas/ProductList" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /estimates/price: + get: + summary: Price Estimates + description: The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. + parameters: + - name: start_latitude + in: query + description: Latitude component of start location. + required: true + schema: + type: number + format: double + - name: start_longitude + in: query + description: Longitude component of start location. + required: true + schema: + type: number + format: double + - name: end_latitude + in: query + description: Latitude component of end location. + required: true + schema: + type: number + format: double + - name: end_longitude + in: query + description: Longitude component of end location. + required: true + schema: + type: number + format: double + tags: + - Estimates + responses: + 200: + description: An array of price estimates by product + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/PriceEstimate" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /estimates/time: + get: + summary: Time Estimates + description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. + parameters: + - name: start_latitude + in: query + description: Latitude component of start location. + required: true + schema: + type: number + format: double + - name: start_longitude + in: query + description: Longitude component of start location. + required: true + schema: + type: number + format: double + - name: customer_uuid + in: query + schema: + type: string + format: uuid + description: Unique customer identifier to be used for experience customization. + - name: product_id + in: query + schema: + type: string + description: Unique identifier representing a specific product for a given latitude & longitude. + tags: + - Estimates + responses: + 200: + description: An array of products + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Product" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /me: + get: + summary: User Profile + description: The User Profile endpoint returns information about the Uber user that has authorized with the application. + tags: + - User + responses: + 200: + description: Profile information for a user + content: + application/json: + schema: + $ref: "#/components/schemas/Profile" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /history: + get: + summary: User Activity + description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. + parameters: + - name: offset + in: query + schema: + type: integer + format: int32 + description: Offset the list of returned results by this amount. Default is zero. + - name: limit + in: query + schema: + type: integer + format: int32 + description: Number of items to retrieve. Default is 5, maximum is 100. + tags: + - User + responses: + 200: + description: History information for the given user + content: + application/json: + schema: + $ref: "#/components/schemas/Activities" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + securitySchemes: + apikey: + type: apiKey + name: server_token + in: query + schemas: + Product: + properties: + product_id: + type: string + description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + description: + type: string + description: Description of product. + display_name: + type: string + description: Display name of product. + capacity: + type: integer + description: Capacity of product. For example, 4 people. + image: + type: string + description: Image URL representing the product. + ProductList: + properties: + products: + description: Contains the list of products + type: array + items: + $ref: "#/components/schemas/Product" + PriceEstimate: + properties: + product_id: + type: string + description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles + currency_code: + type: string + description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." + display_name: + type: string + description: Display name of product. + estimate: + type: string + description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. + low_estimate: + type: number + description: Lower bound of the estimated price. + high_estimate: + type: number + description: Upper bound of the estimated price. + surge_multiplier: + type: number + description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. + Profile: + properties: + first_name: + type: string + description: First name of the Uber user. + last_name: + type: string + description: Last name of the Uber user. + email: + type: string + description: Email address of the Uber user + picture: + type: string + description: Image URL of the Uber user. + promo_code: + type: string + description: Promo code of the Uber user. + Activity: + properties: + uuid: + type: string + description: Unique identifier for the activity + Activities: + properties: + offset: + type: integer + format: int32 + description: Position in pagination. + limit: + type: integer + format: int32 + description: Number of items to retrieve (100 max). + count: + type: integer + format: int32 + description: Total number of items available. + history: + type: array + items: + $ref: "#/components/schemas/Activity" + Error: + properties: + code: + type: integer + format: int32 + message: + type: string + fields: + type: string + From dc645ab178c9538e8b965f5bbce9ad78d0c544af Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 14 Mar 2017 09:51:28 +0000 Subject: [PATCH 0268/1801] Fix JWT Bearer security JSON sample As reported by @pjmolina [here](https://github.com/Mermade/swagger2openapi/issues/2) --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..66a9e54732 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3306,7 +3306,7 @@ in: header ```json { - "type": "scheme", + "type": "http", "scheme": "bearer", "bearerFormat": "JWT", } From 9f39cd9d8196cf4f9282507217a6d3c328be5baa Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 15 Mar 2017 08:24:21 +0000 Subject: [PATCH 0269/1801] Update versions/3.0.md based on mdv issues --- versions/3.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..98aaea3946 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -146,7 +146,7 @@ Types that are not accompanied by a `format` property follow their definition fr The formats defined by the OAS are: -Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments +Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments ----------- | ------ | -------- | -------- integer | `integer` | `int32` | signed 32 bits long | `integer` | `int64` | signed 64 bits @@ -657,7 +657,7 @@ Field Name | Type | Description patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -756,7 +756,7 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. @@ -947,7 +947,7 @@ Field Name | Type | Description In order to support common ways of serializing simple parameters, a set of `style` values are defined. -`style` | [`type`](#dataTypeType) | `in` | Comments +`style` | [`type`](#dataTypes) | `in` | Comments ----------- | ------ | -------- | -------- matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) @@ -1194,7 +1194,7 @@ content: #### Content Object -Describes a set of supported media types. A Content Object can be used in [Request Body Object](#requestBody), +Describes a set of supported media types. A Content Object can be used in [Request Body Object](#requestBodyObject), [Parameter Objects](#parameterObject), [Header Objects](#headerObject), and [Response Objects](#responseObject). Each key in the Content Object is the media type of the [Media Type Object](#mediaTypeObject). @@ -1489,12 +1489,12 @@ Field Name | Type | Description ---|:---:|--- default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. -[Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. +[Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's components/responses](#componentsResponses) section. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1680,7 +1680,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [Callback Object](#callbackObject) | [Reference Object](#ReferenceObject) | A Callback Object used to define a callback request and expected responses +{name} | [Callback Object](#callbackObject) | [Reference Object](#referenceObject) | A Callback Object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1853,7 +1853,7 @@ Field Pattern | Type | Description {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. -#### Link Object +#### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. Field Name | Type | Description From 3799704a6c2ebc588f7199657c21c86c3e278e9b Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 15 Mar 2017 14:30:40 +0000 Subject: [PATCH 0270/1801] Fix the component name regular expression Currently the expression given matches everything --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..728f9c9b83 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -411,7 +411,7 @@ Field Name | Type | Description This object can be extended with [Specification Extensions](#specificationExtensions). -All the fixed fields declared above are objects that MUST use keys that match the regular expression: `[a-zA-Z0-9.\-_]+`. +All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. Field Name Examples: From 363e34d5872395e78add93a8037c8ff8c8bf6f22 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 15 Mar 2017 08:26:25 +0000 Subject: [PATCH 0271/1801] Enable mdv CI checking in OpenAPI.next branch --- .travis.yml | 9 +++++++++ package.json | 1 + 2 files changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 66c5dcbb31..37727967b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,12 @@ env: matrix: allow_failures: - env: VALIDATORS=tv4 +install: + - rm -rf ~/.nvm + - curl -L https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh + - source ~/.nvm/nvm.sh + - nvm install 6.1 + - nvm use 6.1 +script: + - npm install + - node node_modules/mdv/mdv versions/3.*.md diff --git a/package.json b/package.json index 4fa476b77a..a5b8cd1873 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "json2yaml": "^1.0.3", "jsonschema": "^1.0.0", "map-stream": "^0.1.0", + "mdv": "^1.0.3", "mocha": "^1.21.3", "q": "^1.0.1", "request": "^2.39.0", From 2cfe4156f3152eea491842853d6ce349672182d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sun, 19 Mar 2017 15:02:36 +0100 Subject: [PATCH 0272/1801] =?UTF-8?q?plain/text=20=E2=86=92=20text/plain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I think this is what was meant here. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..2c388fce0e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1463,7 +1463,7 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` - `application/octet-stream`; for other primitive types - `plain/text`; for `object` - `application/json`; for `array` - the default is defined based on the inner type. +contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. Headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | The Content-Type to use for encoding a specific property. See (#parameterContent) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. From 8dae769a8b691ae621c959314e48f0861a3be456 Mon Sep 17 00:00:00 2001 From: Eugene Pirogov Date: Mon, 27 Mar 2017 12:57:02 +0200 Subject: [PATCH 0273/1801] Fix markdown table formatting --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..593d8336d1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3351,7 +3351,7 @@ Allows configuration of the supported OAuth Flows. ##### Fixed Fields Field Name | Type | Description ----|:---:|---|--- +---|:---:|--- implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. From eb62989ef3041309c1e0d41f5a3ac87700019b4a Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 27 Mar 2017 13:57:33 +0100 Subject: [PATCH 0274/1801] Replace | with \| As per GitHub's markdown renderer changes --- versions/3.0.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..806aedb875 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -657,7 +657,7 @@ Field Name | Type | Description patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -756,8 +756,8 @@ Field Name | Type | Description description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) | [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). +requestBody | [[Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. @@ -931,9 +931,9 @@ Field Name | Type | Description style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. +examples | [[Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) \| [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1258,9 +1258,9 @@ Each Media Type Object provides schema and examples for a the media type identif ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the request body. -examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | The schema defining the type used for the request body. +examples | [[Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | [Example Object](#exampleObject) \| [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1487,14 +1487,14 @@ SHOULD be the response for a successful operation call. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1680,7 +1680,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [Callback Object](#callbackObject) | [Reference Object](#ReferenceObject) | A Callback Object used to define a callback request and expected responses +{name} | [Callback Object](#callbackObject) \| [Reference Object](#ReferenceObject) | A Callback Object used to define a callback request and expected responses This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1767,7 +1767,7 @@ Lists the headers that can be sent in a response or forwarded via a link. Note t ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{name} | [Header Object](#headerObject) | [Reference Object](#referenceObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. +{name} | [Header Object](#headerObject) \| [Reference Object](#referenceObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. ##### Headers Object Example @@ -1850,7 +1850,7 @@ For computing links, and providing instructions to execute them, [variable subst ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - {name} | [Link Object](#linkObject) | [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. #### Link Object @@ -2260,7 +2260,7 @@ This object contains parameter names along with static or dynamic values: ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - {name} | Any | [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. + {name} | Any \| [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. ```yaml paths: From 09c16d5857128ff5c939d27d0caaec88307243a8 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 27 Mar 2017 09:59:09 -0700 Subject: [PATCH 0275/1801] Bumping version to rc1 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..8bbc393ff4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,6 +1,6 @@ # OpenAPI Specification -#### Version 3.0.0-rc0 +#### Version 3.0.0-rc1 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). From 4498a8c46e3c20345b41c4c353baccd2d20e1a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Mar 2017 22:13:37 +0200 Subject: [PATCH 0276/1801] add missing ":" in callback object example --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9b7506007a..070dcb9207 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1761,7 +1761,7 @@ myWebhook: requestBody: description: Callback payload content: - 'application/json' + 'application/json': schema: $ref: '#/components/schemas/SomePayload' responses: From eb84d248aa68a7530d21fecb1e84f4f5656d6bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Mar 2017 22:16:47 +0200 Subject: [PATCH 0277/1801] also mark the '200' as string --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 070dcb9207..dfa85d1659 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1765,7 +1765,7 @@ myWebhook: schema: $ref: '#/components/schemas/SomePayload' responses: - 200: + '200': description: webhook successfully processed an no retries will be performed ``` From 49f998582daec62289998d29271f29f4d8e38261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 27 Mar 2017 22:18:29 +0200 Subject: [PATCH 0278/1801] typo --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index dfa85d1659..66bb03380d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1766,7 +1766,7 @@ myWebhook: $ref: '#/components/schemas/SomePayload' responses: '200': - description: webhook successfully processed an no retries will be performed + description: webhook successfully processed and no retries will be performed ``` From c5ff37a01730d25e09bd176873e57ef60dff6d69 Mon Sep 17 00:00:00 2001 From: Paul Ebermann Date: Tue, 28 Mar 2017 10:51:56 +0200 Subject: [PATCH 0279/1801] add missing quotes to YAML keys. --- versions/3.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9b7506007a..f7590b3f60 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1765,7 +1765,7 @@ myWebhook: schema: $ref: '#/components/schemas/SomePayload' responses: - 200: + '200': description: webhook successfully processed an no retries will be performed ``` @@ -1974,7 +1974,7 @@ paths: schema: type: string responses: - 200: + '200': description: the user being returned content: application/json: @@ -2048,7 +2048,7 @@ paths: schema: type: string responses: - 200: + '200': description: The User content: application/json: @@ -2067,7 +2067,7 @@ paths: schema: type: string responses: - 200: + '200': description: repositories owned by the supplied user content: application/json: @@ -2094,7 +2094,7 @@ paths: schema: type: string responses: - 200: + '200': description: The repository content: application/json: @@ -2126,7 +2126,7 @@ paths: - merged - declined responses: - 200: + '200': description: an array of pull request objects content: application/json: @@ -2154,7 +2154,7 @@ paths: schema: type: string responses: - 200: + '200': description: a pull request object content: application/json: @@ -2182,7 +2182,7 @@ paths: schema: type: string responses: - 204: + '204': description: the PR was successfully merged components: links: @@ -2402,7 +2402,7 @@ schemas: $ref: 'http://foo.bar#/examples/zip-example' # in a response, note the plural `examples`: responses: - 200: + '200': description: your car appointment has been booked content: application/json: From 6c37b2864550d1caf22b86ac358adb4c41761dd5 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 30 Mar 2017 01:28:11 +0100 Subject: [PATCH 0280/1801] Remove Array markers around op.requestBody def. As discussed [here](https://github.com/googleapis/gnostic/issues/35#issuecomment-290262023) --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index f7590b3f60..fd613139ee 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -763,7 +763,7 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). -requestBody | [[Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. From 9ed3426b1adb467aad0f87ace2877cbf62865be3 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Thu, 30 Mar 2017 09:52:22 -0700 Subject: [PATCH 0281/1801] Minor edits: add headers for consistency, fix misspelling, add missing tag. --- versions/3.0.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fd613139ee..e149d80ebb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -385,7 +385,9 @@ This object can be extended with [Specification Extensions](#specificationExtens #### Server Variable Object -An object representing a Server Variable for server URL template substituion. +An object representing a Server Variable for server URL template substitution. + +##### Fixed Fields Field Name | Type | Description ---|:---:|--- @@ -410,7 +412,7 @@ Field Name | Type | Description parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). - headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). + headers | Map[`string`, [Header Object](#headerObject)] | An object to hold reusable [Header Objects](#headerObject). securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Objects](#callbackObject). @@ -912,6 +914,7 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). +##### Parameter Locations There are four possible parameter locations (as specified with the `in` field): * path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. @@ -927,7 +930,7 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. -allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSchema) can be used to describe the structure and syntax of the parameter. @@ -951,6 +954,8 @@ Field Name | Type | Description ---|:---:|--- content | [Content Object](#contentObject) | The content of the parameter. +##### Style Values + In order to support common ways of serializing simple parameters, a set of `style` values are defined. `style` | [`type`](#dataTypeType) | `in` | Comments @@ -1865,6 +1870,8 @@ The link SHALL reference a single Link Object, or a JSON Reference to a single l #### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. +##### Fixed Fields + Field Name | Type | Description ---|:---:|--- href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. @@ -2470,6 +2477,8 @@ This object is an extended subset of the [JSON Schema Specification Wright Draft Further information about the properties can be found in [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. +##### Properties + The following properties are taken directly from the JSON Schema definition and follow the same specifications: - title From 9036068275f641e2a47f84c1c0ba7659691b2ce0 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Thu, 30 Mar 2017 10:58:22 -0700 Subject: [PATCH 0282/1801] Remove duplicate tag closing to match surrounding style. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index e149d80ebb..f26eb99599 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -930,7 +930,7 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. - allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSchema) can be used to describe the structure and syntax of the parameter. From fb059ca461bd17b10a9e3e59879f04485886d356 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 4 Apr 2017 08:58:47 +0100 Subject: [PATCH 0283/1801] Replace | with \| --- versions/2.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/2.0.md b/versions/2.0.md index 8b9b9525cb..5916e30c3e 100755 --- a/versions/2.0.md +++ b/versions/2.0.md @@ -318,7 +318,7 @@ Field Name | Type | Description options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. ##### Patterned Fields @@ -417,7 +417,7 @@ Field Name | Type | Description operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#swaggerConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#swaggerProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes). -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#swaggerSchemes) definition. deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. @@ -844,12 +844,12 @@ The `Responses Object` MUST contain at least one response code, and it SHOULD be ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) | [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) | [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. +{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section. ^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details. From 8d3dc3f6d391432ac05066cba55e5e1a7cbd9e60 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 7 Apr 2017 11:49:34 -0700 Subject: [PATCH 0284/1801] First attempt at described example --- versions/3.0.md | 193 ++++++++++++++++++++++++++++-------------------- 1 file changed, 113 insertions(+), 80 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 66610d5c4f..1ec796a937 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -49,12 +49,12 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Response Object](#responseObject) - [Headers Object](#headersObject) - [Example Object](#exampleObject) + - [Described Example Object](#describedExampleObject) - [Links Object](#linksObject) - [Link Object](#linkObject) - [Link Parameters Object](#linkParametersObject) - [Header Object](#headerObject) - [Tag Object](#tagObject) - - [Examples Object](#examplesObject) - [Reference Object](#referenceObject) - [Schema Object](#schemaObject) - [XML Object](#xmlObject) @@ -402,7 +402,7 @@ Field Name | Type | Description schemas | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). - examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). + examples | Map[`string`, [Described Example Object](#describedExampleObject)] | An object to hold reusable [Described Example Objects](#describedExampleObject). requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). @@ -932,8 +932,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. -examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the content type. Each example in the Examples array SHOULD be in the correct format as specified parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the content type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the the schema. +example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +examples | Map[ `string`, [Described Example Object](#describedExampleObject) | [Reference Object](#referenceObject)] | Described Examples of the media type. Each described example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1258,9 +1258,9 @@ Each Media Type Object provides schema and examples for a the media type identif ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject)] | The schema defining the type used for the request body. -examples | [[Example Object](#exampleObject) | [Reference Object](#referenceObject)] | Examples of the media type. Each example in the Examples array SHOULD be in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -example | [Example Object](#exampleObject) | [Reference Object](#referenceObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +schema | [Schema Object](#schemaObject) | [Reference Object](#referenceObject) | The schema defining the type used for the request body. +example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +examples | Map[ `string`, [Described Example Object](#describedExampleObject) | [Reference Object](#referenceObject)] | Described Examples of the media type. Each described example SHOULD contain a value in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1273,14 +1273,23 @@ This object can be extended with [Specification Extensions](#specificationExtens "schema": { "$ref": "#/components/schemas/Pet" }, - "examples": [{ - "name": "Fluffy", - "petType": "Cat" - }, - { - "name": "Rover", - "petType": "Frog" - }] + "examples": { + "cat" : { + "summary": "An example of a cat", + "value": + { + "name": "Fluffy", + "petType": "Cat" + } + }, + "frog": { + "summary": "An example of a frog with a dog's name", + "value" : { + "name": "Rover", + "petType": "Frog" + } + } + } } } ``` @@ -1290,11 +1299,18 @@ application/json: schema: $ref: "#/components/schemas/Pet" examples: - # converted directly from YAML to JSON - - name: Fluffy - petType: Cat - - {"name": "Rover", "petType": "Frog"} - + cat: + summary: An example of a cat + value: + name: Fluffy + petType: Cat + frog: + summary: An example of a frog with a dog's name + value: + name: Rover + petType: Frog + dog: + $ref: "#/components/examples/dog-example" ``` ##### Considerations for file uploads @@ -1813,7 +1829,7 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation requests and responses. This object can either be a freeform object, array or primitive value. To represent examples of media types that cannot naturally represented in the OpenAPI definition, a string value can be used to contain the example with escaping where necessary. +Allows sharing examples for operation requests and responses. This literal value can either be any JSON or YAML object, array or primitive value. To represent examples of media types that cannot naturally represented in the OpenAPI definition, a string value can be used to contain the example with escaping where necessary. ##### Example Example @@ -1839,6 +1855,82 @@ breed: Mixed ``` +#### Described Example Object + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +summary | `string` | Short description for the example. +description | `string` | Long description for the example. +value | [Example Object](#exampleObject) | Embedded literal example. The `value` field and `valueUrl` field are mutually exclusive. +valueUrl | `string` | A Url that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `valueUrl` field are mutually exclusive. + +This object can be extended with [Specification Extensions](#specificationExtensions). + +In all cases, the example value is expected to be compatible with the type schema +for the value that it is accompanying. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are not compatible. + +##### Example Described Example + +```yaml +# in a model +schemas: + properties: + name: + type: string + example: + $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example + +# in a request body, note the plural `examples` as the Content-Type is set to `*`: + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + summary: A foo example + value: {"foo": "bar"} + bar: + summary: A bar example + value: {"bar": "baz"} + 'application/xml': + examples: + xmlExample: + summary: This is an example in XML + valueUrl: 'http://example.org/examples/address-example.xml' + 'text/plain': + examples: + textExample: + summary: This is a text example + valueUrl: 'http://foo.bar/examples/address-example.txt' + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + examples: + zip-example: + $ref: '#/components/examples/zip-example' + +# in a response + responses: + 200: + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + examples: + confirmation-success: + $ref: '#/components/examples/confirmation-success' +``` + #### Links Object The links object represents a set of possible design-time links for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. @@ -2344,64 +2436,6 @@ name: pet description: Pets operations ``` -#### Examples Object - -Anywhere an `example` may be given, a JSON Reference MAY be used, with the -explicit restriction that examples having a JSON format with object named -`$ref` are not allowed. This does mean that `example`, structurally, can be -either a string primitive or an object, similar to `additionalProperties`. - -In all cases, the payload is expected to be compatible with the type schema -for the value that it is accompanying. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are not compatible. - -```yaml -# in a model -schemas: - properties: - name: - type: string - example: - $ref: http://foo.bar#/examples/name-example - -# in a request body, note the plural `examples` as the Content-Type is set to `*`: - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Address' - examples: - - {"foo": "bar"} - - {"bar": "baz"} - 'application/xml': - examples: - - $ref: 'http://foo.bar#/examples/address-example.xml' - 'text/plain': - examples: - - $ref: 'http://foo.bar#/examples/address-example.txt' - -# in a parameter - - parameters: - - name: 'zipCode' - in: 'query' - schema: - type: 'string' - format: 'zip-code' - example: - $ref: 'http://foo.bar#/examples/zip-example' -# in a response, note the plural `examples`: - responses: - 200: - description: your car appointment has been booked - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessResponse' - example: - $ref: http://foo.bar#/examples/address-example.json -``` #### Reference Object @@ -2509,7 +2543,6 @@ Field Name | Type | Description xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. -examples | Any | An array of free-formed properties to include examples for this schema. deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. This object can be extended with [Specification Extensions](#specificationExtensions). From 2a4cc4a1111bd10fb2188379ee9064879669cb31 Mon Sep 17 00:00:00 2001 From: Darrel Date: Sun, 9 Apr 2017 23:26:36 -0400 Subject: [PATCH 0285/1801] Fixed section names --- versions/3.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1ec796a937..437ca07e69 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -674,7 +674,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "200": { "description": "pet response", "content": { - "*": { + "*/*": { "schema": { "type": "array", "items": { @@ -721,7 +721,7 @@ get: '200': description: pet response content: - *: + '*/*' : schema: type: array items: @@ -1831,7 +1831,7 @@ X-Rate-Limit-Reset: Allows sharing examples for operation requests and responses. This literal value can either be any JSON or YAML object, array or primitive value. To represent examples of media types that cannot naturally represented in the OpenAPI definition, a string value can be used to contain the example with escaping where necessary. -##### Example Example +##### Example Object Example Example representation for application/json media type of a Pet data type: @@ -1863,7 +1863,7 @@ Field Name | Type | Description summary | `string` | Short description for the example. description | `string` | Long description for the example. value | [Example Object](#exampleObject) | Embedded literal example. The `value` field and `valueUrl` field are mutually exclusive. -valueUrl | `string` | A Url that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `valueUrl` field are mutually exclusive. +valueUrl | `string` | A URL that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `valueUrl` field are mutually exclusive. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1872,7 +1872,7 @@ for the value that it is accompanying. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. -##### Example Described Example +##### Described Example Object Example ```yaml # in a model @@ -1906,7 +1906,8 @@ schemas: textExample: summary: This is a text example valueUrl: 'http://foo.bar/examples/address-example.txt' - + + # in a parameter parameters: - name: 'zipCode' @@ -2436,7 +2437,6 @@ name: pet description: Pets operations ``` - #### Reference Object A simple object to allow referencing other components in the specification, internally and externally. From 6bcbde99c65a0ad23c2e426eba8eb736fe7921de Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 11 Apr 2017 11:12:37 -0400 Subject: [PATCH 0286/1801] Updated examples throughout spec --- versions/3.0.md | 163 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 117 insertions(+), 46 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0c8fe07229..137b28186b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1128,20 +1128,38 @@ A request body with a referenced model definition. "schema": { "$ref": "#/components/schemas/User" }, - "examples": [ "http://foo.bar/examples/user-example.json" ] + "examples": { + "user" : { + "summary": "User Example", + "valueUrl": "http://foo.bar/examples/user-example.json" + } + } }, "application/xml": { "schema": { "$ref": "#/components/schemas/User" }, - "examples": [ "http://foo.bar/examples/user-example.xml" ] + "examples": { + "user" : { + "summary": "User example in XML", + "valueUrl": "http://foo.bar/examples/user-example.xml" + } + } }, "text/plain": { - "examples": [ "http://foo.bar/examples/user-example.txt" ] + "examples": { + "user" : { + "summary": "User example in Plain text", + "valueUrl": "http://foo.bar/examples/user-example.txt" + } + } }, "*/*": { - "example": { - "$ref": "http://foo.bar/examples/user-example.whatever" + "examples": { + "user" : { + "summary": "User example in other format", + "valueUrl": "http://foo.bar/examples/user-example.whatever" + } } } } @@ -1155,18 +1173,26 @@ content: schema: $ref: '#/components/schemas/User' examples: - - 'http://foo.bar/examples/user-example.json' + user: + summary: User Example + valueUrl: 'http://foo.bar/examples/user-example.json' 'application/xml': schema: $ref: '#/components/schemas/User' examples: - - 'http://foo.bar/examples/user-example.xml' + user: + summary: User Example in XML + valueUrl: 'http://foo.bar/examples/user-example.xml' 'text/plain': examples: - - 'http://foo.bar/examples/user-example.txt' + user: + summary: User example in text plain format + valueUrl: 'http://foo.bar/examples/user-example.txt' '*/*': - example: - $ref: 'http://foo.bar/examples/user-example.whatever' + examples: + user: + summary: User example in other format + valueUrl: 'http://foo.bar/examples/user-example.whatever' ``` A body parameter that is an array of string values: @@ -1216,22 +1242,40 @@ Each key in the Content Object is the media type of the [Media Type Object](#med "type": "string" } }, - "examples": [ - ["Bob","Diane","Mary","Bill"], - [] - ] + "examples": { + "list": { + "summary": "List of names", + "value" : ["Bob","Diane","Mary","Bill"] + }, + "empty":{ + "summary": "Empty List", + "value": [] + } + } }, "application/xml": { - "examples": [ - "", - "" - ] + "examples": { + "list": { + "summary": "List of names", + "value": "" + }, + "empty": { + "summary":"Empty", + "value": "" + } + } }, "text/plain": { - "examples": [ - "Bob,Diane,Mary,Bill", - "" - ] + "examples": { + "list": { + "summary": "List of names", + "value": "Bob,Diane,Mary,Bill" + }, + "empty": { + "summary": "Empty", + "value" : "" + } + } } } ``` @@ -1244,21 +1288,33 @@ content: items: type: string examples: - - - - Bob - - Diane - - Mary - - Bill - - {} + list: + summary: List of Names + value: + - Bob + - Diane + - Mary + - Bill + empty: + summary: Empty + value: {} 'application/xml': examples: - - "" - - "" + list: + summary: List of names + value: "" + empty: + summmary: Empty list + value: "" 'text/plain': examples: - - "Bob,Diane,Mary,Bill" - - "" + list: + summary: List of names + value: "Bob,Diane,Mary,Bill" + empty: + summary: Empty + value: "" ``` #### Media Type Object @@ -1889,8 +1945,9 @@ schemas: properties: name: type: string - example: - $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example + examples: + name: + $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example # in a request body, note the plural `examples` as the Content-Type is set to `*`: requestBody: @@ -2781,14 +2838,22 @@ example: "required": [ "name" ], - "examples": [ - { - "name": "Puma", - "id": 1 - }, { - "name": "Ferguson", - "id": 2 - }] + "examples": { + "cat": { + "summary": "Big cat example", + "value": { + "name": "Puma", + "id": 1 + } + }, + "dog": { + "summary": "Family dog example", + "value": { + "name": "Ferguson", + "id": 2 + } + } + } } ``` @@ -2803,10 +2868,16 @@ properties: required: - name examples: - - name: Puma - id: 1 - - name: Ferguson - id: 2 + cat: + summary: Big cat example + value: + name: Puma + id: 1 + dog: + summary: Family Dog + value: + name: Ferguson + id: 2 ``` ###### Models with Composition From 7e5693e5f7657b3e5cc1e65d0e4c5f8b6190e413 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 11 Apr 2017 22:05:33 -0700 Subject: [PATCH 0287/1801] added explanation, fixes for #1039 --- versions/3.0.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fd613139ee..1a4c081896 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1867,17 +1867,19 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- -href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field. +operationRef | `string` | a relative or reference to an OAS operation. This field is mutually exclusive with the `operationId` field. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). +server | [Server Object](#serverObject) | a server object to be used by the target operation This object can be extended with [Specification Extensions](#specificationExtensions). -Locating a linked resource MAY be performed by either a `href` or `operationId`. +Locating a linked resource MAY be performed by either a `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references. +Because of the potential for name clashes, consider the `operationRef` syntax as the preferred +method for specifications with external references. ##### Response Payload Values From 687a253a9860fcd1e9f1b14bf88d70432eacbde8 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 12 Apr 2017 14:43:34 -0700 Subject: [PATCH 0288/1801] clarified that the `operationRef` must point to a valid specification --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1a4c081896..087de817b8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1867,7 +1867,7 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or reference to an OAS operation. This field is mutually exclusive with the `operationId` field. +operationRef | `string` | a relative or reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. From 080fd6df2636795e78e20fd4a73e84122f411af5 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 12 Apr 2017 15:38:59 -0700 Subject: [PATCH 0289/1801] added implementations --- IMPLEMENTATIONS.md | 26 ++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 IMPLEMENTATIONS.md diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md new file mode 100644 index 0000000000..ebb9ff253b --- /dev/null +++ b/IMPLEMENTATIONS.md @@ -0,0 +1,26 @@ +### Implementations + +Below is a list of known tooling implementing the 3.0.0 specification. Because +the 3.0.0 specification has not yet been released, please consult the details of +any projects listed below for notes about stability and roadmap. The process +to create the best possible 3.0.0 specification includes feedback from end-users +and tooling creators alike, and it is strongly encouraged that draft tooling be +made available for early users of the OAS. + + +Low-Level tooling + +| Title | Project Link | Language |Description | +|----------------|--------------|----------|---------------------| +| swagger-parser | [GitHub/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to Open API Specification converter | +| swagger-models | [GitHub/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | Open API 3.0 Java Pojos | + + + +User Interfaces + + +Server Implementations + + +Code Generators diff --git a/README.md b/README.md index 1578c2da18..7166930985 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # The OpenAPI Specification +### [Draft implementations of tooling supporting the 3.0.0 specification can be found here](https://github.com/OAI/OpenAPI-Specification/blob/master/IMPLEMENTATIONS.md) + This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). The current, released version of the OpenAPI Specification is 2.0, through donation of the Swagger Specification to the OAI by SmartBear Software. If you are interested in the release specification, please see the [master branch](https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) of this project. From b5482c518dfd5147f2af6c78ef4a0187fad927f7 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 12 Apr 2017 15:42:24 -0700 Subject: [PATCH 0290/1801] updated title --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7166930985..5f6b85d61f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # The OpenAPI Specification -### [Draft implementations of tooling supporting the 3.0.0 specification can be found here](https://github.com/OAI/OpenAPI-Specification/blob/master/IMPLEMENTATIONS.md) +### Draft implementations of tooling supporting the 3.0.0 specification can be found here! + +[3.0.0 Implementations](https://github.com/OAI/OpenAPI-Specification/blob/master/IMPLEMENTATIONS.md) This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). From aaa4203057871787a4628cb2f58741ee8df4e426 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 12 Apr 2017 22:14:07 -0700 Subject: [PATCH 0291/1801] added parser --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index ebb9ff253b..21bdfa2869 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -14,7 +14,7 @@ Low-Level tooling |----------------|--------------|----------|---------------------| | swagger-parser | [GitHub/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to Open API Specification converter | | swagger-models | [GitHub/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | Open API 3.0 Java Pojos | - +| KaiZen OpenAPI Parser | [GitHub/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | User Interfaces From d35631a9affcf39078f9222b990069a7fb4a96f5 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 13 Apr 2017 07:10:29 -0700 Subject: [PATCH 0292/1801] added link to next branch --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c644ab7cf4..cb364002dd 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ [![Build Status](https://travis-ci.org/OAI/OpenAPI-Specification.svg?branch=master)](https://travis-ci.org/OAI/OpenAPI-Specification) -![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) +## Looking for the upcoming 3.0 version? See here + +[The pre-release OAS 3.0.0 Specification Branch](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/README.md)** -**The OAS 3.0.0-RC0 Spec can be [found here](https://github.com/OAI/OpenAPI-Specification/blob/3.0.0-rc0/versions/3.0.md)** +![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service. From fb08824ee0e6616ae155e93d409f4ad3ba30a434 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 13 Apr 2017 07:11:08 -0700 Subject: [PATCH 0293/1801] updated text --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb364002dd..92e6dd80c5 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ [![Build Status](https://travis-ci.org/OAI/OpenAPI-Specification.svg?branch=master)](https://travis-ci.org/OAI/OpenAPI-Specification) -## Looking for the upcoming 3.0 version? See here - -[The pre-release OAS 3.0.0 Specification Branch](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/README.md)** +## Looking for the upcoming 3.0 version? See here: +[The pre-release OAS 3.0.0 Specification Branch](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/README.md) ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) From 52e64affce6050b5a12d039cafd5ac52b8a4071d Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 13 Apr 2017 07:12:15 -0700 Subject: [PATCH 0294/1801] updated link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f6b85d61f..e1ef23d45e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### Draft implementations of tooling supporting the 3.0.0 specification can be found here! -[3.0.0 Implementations](https://github.com/OAI/OpenAPI-Specification/blob/master/IMPLEMENTATIONS.md) +[3.0.0 Implementations](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/IMPLEMENTATIONS.md) This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). From ff0d8d2e36e22eed94f3036dcb005d9a79f8a0ad Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 13 Apr 2017 07:24:02 -0700 Subject: [PATCH 0295/1801] added missing semi-important term --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 087de817b8..90ee6ae973 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1867,7 +1867,7 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition +operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. From 68c80ca2480b646b2c012e3535f8b43c597ccb2e Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 13 Apr 2017 15:49:31 +0100 Subject: [PATCH 0296/1801] Update IMPLEMENTATIONS.md These projects appear to be at beta stage or better. --- IMPLEMENTATIONS.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 21bdfa2869..53739a6e8b 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -8,19 +8,31 @@ and tooling creators alike, and it is strongly encouraged that draft tooling be made available for early users of the OAS. -Low-Level tooling +#### Low-Level tooling | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| | swagger-parser | [GitHub/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to Open API Specification converter | | swagger-models | [GitHub/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | Open API 3.0 Java Pojos | | KaiZen OpenAPI Parser | [GitHub/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | +| openapi3-ts | [GitHub/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | +| swagger2openapi | [GitHub/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | +| Tavis.OpenApi | [GitHub/tavis-sofware/Tavis.OpenApi](https://github.com/tavis-software/Tavis.OpenApi/) | dotnet | C# based parser with definition validation and migration support from V2 | -User Interfaces +#### User Interfaces + +| Title | Project Link | Language |Description | +|----------------|--------------|----------|---------------------| +| openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification | -Server Implementations +#### Server Implementations -Code Generators +#### Code Generators + +| Title | Project Link | Language |Description | +|----------------|--------------|----------|---------------------| +| baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts | +| Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations | From b33f258f90cbdffa8ae09e84667637fc95161489 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 13 Apr 2017 11:06:12 -0700 Subject: [PATCH 0297/1801] Update IMPLEMENTATIONS.md --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 53739a6e8b..c4ab4281eb 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -7,6 +7,7 @@ to create the best possible 3.0.0 specification includes feedback from end-users and tooling creators alike, and it is strongly encouraged that draft tooling be made available for early users of the OAS. +These tools are not necessarily endorsed by the OAI. #### Low-Level tooling From c0943807468fd704ab4a1d2293e463c487fd776a Mon Sep 17 00:00:00 2001 From: Darrel Date: Sat, 15 Apr 2017 20:24:09 -0400 Subject: [PATCH 0298/1801] Updates based on review --- versions/3.0.md | 71 +++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 50 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 137b28186b..edcdd6f95b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -53,7 +53,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Callback Object](#callbackObject) - [Headers Object](#headersObject) - [Example Object](#exampleObject) - - [Described Example Object](#describedExampleObject) - [Links Object](#linksObject) - [Link Object](#linkObject) - [Link Parameters Object](#linkParametersObject) @@ -408,7 +407,7 @@ Field Name | Type | Description schemas | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). - examples | Map[`string`, [Described Example Object](#describedExampleObject)] | An object to hold reusable [Described Example Objects](#describedExampleObject). + examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). headers | Map[`string`, [Header object](#headerObject)] | An object to hold reusable [Header objects](#headerObject). securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). @@ -938,8 +937,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. -example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -examples | Map[ `string`, [Described Example Object](#describedExampleObject) \| [Reference Object](#referenceObject)] | Described Examples of the media type. Each described example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. This option is mutually exclusive with the simple scenario @@ -1131,7 +1130,7 @@ A request body with a referenced model definition. "examples": { "user" : { "summary": "User Example", - "valueUrl": "http://foo.bar/examples/user-example.json" + "externalValue": "http://foo.bar/examples/user-example.json" } } }, @@ -1142,7 +1141,7 @@ A request body with a referenced model definition. "examples": { "user" : { "summary": "User example in XML", - "valueUrl": "http://foo.bar/examples/user-example.xml" + "externalValue": "http://foo.bar/examples/user-example.xml" } } }, @@ -1150,7 +1149,7 @@ A request body with a referenced model definition. "examples": { "user" : { "summary": "User example in Plain text", - "valueUrl": "http://foo.bar/examples/user-example.txt" + "externalValue": "http://foo.bar/examples/user-example.txt" } } }, @@ -1158,7 +1157,7 @@ A request body with a referenced model definition. "examples": { "user" : { "summary": "User example in other format", - "valueUrl": "http://foo.bar/examples/user-example.whatever" + "externalValue": "http://foo.bar/examples/user-example.whatever" } } } @@ -1175,24 +1174,24 @@ content: examples: user: summary: User Example - valueUrl: 'http://foo.bar/examples/user-example.json' + externalValue: 'http://foo.bar/examples/user-example.json' 'application/xml': schema: $ref: '#/components/schemas/User' examples: user: summary: User Example in XML - valueUrl: 'http://foo.bar/examples/user-example.xml' + externalValue: 'http://foo.bar/examples/user-example.xml' 'text/plain': examples: user: summary: User example in text plain format - valueUrl: 'http://foo.bar/examples/user-example.txt' + externalValue: 'http://foo.bar/examples/user-example.txt' '*/*': examples: user: summary: User example in other format - valueUrl: 'http://foo.bar/examples/user-example.whatever' + externalValue: 'http://foo.bar/examples/user-example.whatever' ``` A body parameter that is an array of string values: @@ -1324,8 +1323,8 @@ Each Media Type Object provides schema and examples for a the media type identif Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. -example | [Example Object](#exampleObject) | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -examples | Map[ `string`, [Described Example Object](#describedExampleObject) \| [Reference Object](#referenceObject)] | Described Examples of the media type. Each described example SHOULD contain a value in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD contain a value in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1894,41 +1893,13 @@ X-Rate-Limit-Reset: #### Example Object -Allows sharing examples for operation requests and responses. This literal value can either be any JSON or YAML object, array or primitive value. To represent examples of media types that cannot naturally represented in the OpenAPI definition, a string value can be used to contain the example with escaping where necessary. - -##### Example Object Example - -Example representation for application/json media type of a Pet data type: - -```json - { - "name": "Puma", - "type": "Dog", - "color": "Black", - "gender": "Female", - "breed": "Mixed" - } -``` - -```yaml - -name: Puma -type: Dog -color: Black -gender: Female -breed: Mixed - -``` - -#### Described Example Object - ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -summary | `string` | Short description for the example. -description | `string` | Long description for the example. -value | [Example Object](#exampleObject) | Embedded literal example. The `value` field and `valueUrl` field are mutually exclusive. -valueUrl | `string` | A URL that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `valueUrl` field are mutually exclusive. +summary | `string` | Short description for the example. +description | `string` | Long description for the example. +value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +externalValue | `string` | A URL that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1937,7 +1908,7 @@ for the value that it is accompanying. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. -##### Described Example Object Example +##### Example Object Example ```yaml # in a model @@ -1966,12 +1937,12 @@ schemas: examples: xmlExample: summary: This is an example in XML - valueUrl: 'http://example.org/examples/address-example.xml' + externalValue: 'http://example.org/examples/address-example.xml' 'text/plain': examples: textExample: summary: This is a text example - valueUrl: 'http://foo.bar/examples/address-example.txt' + externalValue: 'http://foo.bar/examples/address-example.txt' # in a parameter @@ -2667,7 +2638,7 @@ Field Name | Type | Description writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. -example | Any | A free-form property to include an example of an instance for this schema. +example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. This object can be extended with [Specification Extensions](#specificationExtensions). From 8b4437e4d0594e84f033658e111fa80a5a6e3b99 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 21 Apr 2017 11:51:18 -0400 Subject: [PATCH 0299/1801] Updates based on PR Comments --- versions/3.0.md | 105 ++++++++++++++---------------------------------- 1 file changed, 30 insertions(+), 75 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index edcdd6f95b..c100e27b2b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -937,7 +937,7 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. -example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the parameter encoding. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. For more complex scenarios a [Content Object](#contentObject) can be used to define the media type @@ -1324,7 +1324,7 @@ Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD contain a value in the correct format as specified in the media type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1343,14 +1343,23 @@ This object can be extended with [Specification Extensions](#specificationExtens "value": { "name": "Fluffy", - "petType": "Cat" + "petType": "Cat", + "color": "White", + "gender": "male", + "breed": "Persian" } }, - "frog": { - "summary": "An example of a frog with a dog's name", + "dog": { + "summary": "An example of a dog with a cat's name", "value" : { - "name": "Rover", - "petType": "Frog" + "name": "Puma", + "petType": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + }, + "frog": { + "$ref": "#/components/examples/frog-example" } } } @@ -1368,13 +1377,19 @@ application/json: value: name: Fluffy petType: Cat - frog: - summary: An example of a frog with a dog's name - value: - name: Rover - petType: Frog + color: White + gender: male + breed: Persian dog: - $ref: "#/components/examples/dog-example" + summary: An example of a dog with a cat's name + value: + name: Puma + petType: Dog + color: Black + gender: Female + breed: Mixed + frog: + $ref: "#/components/examples/frog-example" ``` ##### Considerations for file uploads @@ -1918,9 +1933,9 @@ schemas: type: string examples: name: - $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example + $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example -# in a request body, note the plural `examples` as the Content-Type is set to `*`: +# in a request body: requestBody: content: 'application/json': @@ -2532,7 +2547,6 @@ schemas: $ref: http://foo.bar#/examples/address-example.json ``` ->>>>>>> refs/remotes/origin/OpenAPI.next #### Reference Object A simple object to allow referencing other components in the specification, internally and externally. @@ -2792,65 +2806,6 @@ example: id: 1 ``` -###### Model with Examples - -```json -{ - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "required": [ - "name" - ], - "examples": { - "cat": { - "summary": "Big cat example", - "value": { - "name": "Puma", - "id": 1 - } - }, - "dog": { - "summary": "Family dog example", - "value": { - "name": "Ferguson", - "id": 2 - } - } - } -} -``` - -```yaml -type: object -properties: - id: - type: integer - format: int64 - name: - type: string -required: -- name -examples: - cat: - summary: Big cat example - value: - name: Puma - id: 1 - dog: - summary: Family Dog - value: - name: Ferguson - id: 2 -``` - ###### Models with Composition ```json From e8f399ca3aa0972d401129aa47c9cda09e150d0e Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 21 Apr 2017 10:55:01 -0700 Subject: [PATCH 0300/1801] addresses feedback from OAI/TDC call --- versions/3.0.md | 74 ++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 90ee6ae973..5d00ee5e94 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1868,11 +1868,11 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`. -headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. -description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). -server | [Server Object](#serverObject) | a server object to be used by the target operation +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. +parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. +headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. +description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). +server | [Server Object](#serverObject) | a server object to be used by the target operation This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1883,9 +1883,11 @@ method for specifications with external references. ##### Response Payload Values -Payload values are only available in parsable response payloads which match the advertised media type and for media types that can be referenced using a JSON Pointer fragment Id. -In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource. -In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition. +Payload values are only available in parsable response payloads which match the advertised media +type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases, +if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an +empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is +required, and a parameter is not supplied, the client MAY choose to not follow the link definition. ##### Example @@ -1992,51 +1994,46 @@ Can be used in a link like this: ```yaml Addresses: - href: '/users/{$request.path.id}/department' + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: '{$request.path.id}' ``` Where the `$request.path.id` is the value passed in the request to `/users/{id}`. -For a `id` value of `10101110`, the generated link would be: - -```yaml -href: '/users/10101110/department' -``` ##### Response Payload Example ```yaml Addresses: - href: '/users/{$response.body#/uuid}/address' -``` - -Where the `$response.uuid` from the example above would yield the target: - - -```yaml -href: '/users/df71a505-07bc-458a-a5c0-73c0340d1ec7/address' + operationId: getUserAddressByUUID + parameters: + # get the `id` field from the request path parameter named `id` + userUuid: '{$response.body#/uuid}' ``` And the array example: ```yaml ColorSelection: - href: 'http://colors.my-server.com/colors/{$response.body#/color}' + operationId: getColorSample + parameters: + colorName: '{$response.body#/color}' ``` -Would produce the following links: - -```yaml -href: 'http://colors.my-server.com/colors/red' -href: 'http://colors.my-server.com/colors/green' -href: 'http://colors.my-server.com/colors/blue' -``` +Would produce three links with the `colorName` of `red`, `green`, and `blue`: -As with all links, it is at the clients' discretion to follow them, neither permissions nor the ability to make a successful call to that link is guaranteed solely by the existence of a relationship. +As with all links, it is at the clients' discretion to follow them, neither +permissions nor the ability to make a successful call to that link is guaranteed +solely by the existence of a relationship. ##### Example -The example below shows how relationships in the BitBucket API can be represented with the link schema. This example uses `operationId` values to link responses to possible operations. +The example below shows how relationships in the BitBucket API can be represented +with the link schema. This example uses `operationId` values to link responses to +possible operations. ```yaml paths: @@ -2209,7 +2206,7 @@ components: # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge operationId: mergePullRequest parameters: - username: $response.body#/user/username # Should be $response.author.username? + username: $response.body#/author/username slug: $response.body#/repository/slug pid: $response.body#/id schemas: @@ -2240,26 +2237,29 @@ components: $ref: '#/components/schemas/user' ``` -As references to `operationId` MAY NOT be possible (the `operationId` is an optional value), references MAY also be made through a relative `href`: +As references to `operationId` MAY NOT be possible (the `operationId` is an optional +value), references MAY also be made through a relative `operationRef`: ```yaml components: links: UserRepositories: # returns array of '#/components/schemas/repository' - href: '/2.0/repositories/{$response.body#/username}' + operationRef: '#paths~12.0~1repositories~1{$response.body#/username}' ``` -or an absolute `href`: +or an absolute `operationRef`: ```yaml components: links: UserRepositories: # returns array of '#/components/schemas/repository' - href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body#/username}' + href: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{$response.body#/username}' ``` +Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when +using JSON references. #### Link Parameters Object Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads. From a019be8220d94b27fb97f49f58dab358e85f78c0 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:02:20 +0300 Subject: [PATCH 0301/1801] MOAR CommonMark --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 928609647e..e2312a802c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -324,7 +324,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- url | `string` | A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. -description | `string` | An optional string describing the host designated by the URL. +description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. variables | [Server Variables Object](#serverVariablesObject) | An object holding variables for substitution in the URL template. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -390,7 +390,7 @@ Field Name | Type | Description ---|:---:|--- enum | [`primitive`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. default | `primitive` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. -description | `string` | An optional description for the server variable. +description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -652,7 +652,7 @@ Field Name | Type | Description ---|:---:|--- $ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. summary| `string` | An optional, string summary, intended to apply to all operations in this path. -description | `string` | An optional, string description, intended to apply to all operations in this path. +description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. get | [Operation Object](#operationObject) | A definition of a GET operation on this path. put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. post | [Operation Object](#operationObject) | A definition of a POST operation on this path. @@ -1912,7 +1912,7 @@ X-Rate-Limit-Reset: Field Name | Type | Description ---|:---:|--- summary | `string` | Short description for the example. -description | `string` | Long description for the example. +description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. externalValue | `string` | A URL that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. @@ -3360,7 +3360,7 @@ Supported schemes are HTTP authentication, an API key (either as a header or as Field Name | Type | Validity | Description ---|:---:|---|--- type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. -description | `string` | Any | A short description for security scheme. +description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required.** The location of the API key. Valid values are `"query"` or `"header"`. scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). From f597924199977c245b3f33cce987251d2e11f53f Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:11:14 +0300 Subject: [PATCH 0302/1801] More details on 'pattern' --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 928609647e..d0f2d3b2a4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2617,7 +2617,7 @@ The following properties are taken directly from the JSON Schema definition and - exclusiveMinimum - maxLength - minLength -- pattern +- pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) - maxItems - minItems - uniqueItems From 150d27e8c0a094be2fe1fc555ddffe603ee432b7 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:18:27 +0300 Subject: [PATCH 0303/1801] Fixed link Resolves #954 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 928609647e..b1ab72b7e2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -338,7 +338,7 @@ url: https://development.gigantic-server.com/v1 description: Development server ``` -The following shows how multiple servers can be described, for example, at the OpenAPI Object's `servers`(#oasServers): +The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers): ```yaml servers: From 8beb3a7cf54453164a616abbbfd169a374ba7a83 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:27:16 +0300 Subject: [PATCH 0304/1801] MOAR required --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 928609647e..eb95ac799a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -323,7 +323,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +url | `string` | **Required.** A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. variables | [Server Variables Object](#serverVariablesObject) | An object holding variables for substitution in the URL template. @@ -1110,7 +1110,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | [Content Object](#contentObject) | The content of the request body. +content | [Content Object](#contentObject) | **Required.** The content of the request body. required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. From 974299fdf89f219a80d1eb200e5d15c5c4e3cd84 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:45:15 +0300 Subject: [PATCH 0305/1801] Changed field name from flow to flows Resolves #967. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..37db468dd6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3365,7 +3365,7 @@ Field Name | Type | Validity | Description in | `string` | `apiKey` | **Required.** The location of the API key. Valid values are `"query"` or `"header"`. scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. -flow | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. +flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). From 651ce3af9254c1023bd60653a37ac064dbde9a88 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 04:47:07 +0300 Subject: [PATCH 0306/1801] Fixed anchors --- versions/3.0.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 37db468dd6..ab51012793 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3452,10 +3452,10 @@ Allows configuration of the supported OAuth Flows. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow -password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow -clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. -authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. +implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow +password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3466,10 +3466,10 @@ Configuration details for a supported OAuth Flow ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This MUST be in the form of a URL. -tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This MUST be in the form of a URL. -refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. -scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This MUST be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. This object can be extended with [Specification Extensions](#specificationExtensions). From 09b2d589739549fc159615210be7351f3287665b Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 23 Apr 2017 05:01:38 +0300 Subject: [PATCH 0307/1801] Make servers arrays again --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..a2fd4db488 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -661,7 +661,7 @@ Field Name | Type | Description head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. -servers | [Server Object](#serverObject) | An alternative `server` array to service all operations in this path. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service all operations in this path. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters). @@ -767,7 +767,7 @@ Field Name | Type | Description callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. -servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. This object can be extended with [Specification Extensions](#specificationExtensions). From 2cda83a1e7378592b18897acef3508a95960330a Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 23 Apr 2017 09:44:23 +0100 Subject: [PATCH 0308/1801] =?UTF-8?q?Change=20only=20occurrence=20of=20--?= =?UTF-8?q?=20to=20=20=E2=80=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..32d2c05256 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1466,7 +1466,7 @@ When passing complex objects in the `x-www-form-urlencoded` content type, the de It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supports mechanisms for multiple file uploads. -When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred--thus, the following default `Content-Type`s are defined for `multipart/*`: +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart/*`: * If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` * If the property is complex, or an array of complex values, the default Content-Type is `application/json` From a47c1215f97749cba4ec3cb4db156b0e078b9f5a Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 23 Apr 2017 09:48:13 +0100 Subject: [PATCH 0309/1801] Grammar nit s/as well as supports/as well as supporting --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..9e011d2871 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1464,7 +1464,7 @@ When passing complex objects in the `x-www-form-urlencoded` content type, the de ##### Special Considerations for `multipart` content -It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supports mechanisms for multiple file uploads. +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supporting mechanisms for multiple file uploads. When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred--thus, the following default `Content-Type`s are defined for `multipart/*`: From 1b65371c4fb0f2f6f3ab0a3d8132fcb4f72862b4 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 23 Apr 2017 09:55:19 +0100 Subject: [PATCH 0310/1801] Fix cut and paste error --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..2799025720 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1560,7 +1560,7 @@ Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | The Content-Type to use for encoding a specific property. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 0f19ab8aa0e677b7165b4e92a17661b2f529a014 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 23 Apr 2017 10:44:07 +0100 Subject: [PATCH 0311/1801] Table formatting fixes Fix two instances of multi-line descriptions leaking from table cells --- versions/3.0.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index b1ab72b7e2..f1448f09fc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1582,9 +1582,7 @@ SHOULD be the response for a successful operation call. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. -It can be used to cover undeclared responses. -[Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. ##### Patterned Fields Field Pattern | Type | Description @@ -1995,8 +1993,7 @@ For computing links, and providing instructions to execute them, [variable subst ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). -The link SHALL reference a single Link Object, or a JSON Reference to a single link object. + {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. #### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. From 560b0d31e46ba9242ae7bc32287a878fd1a1c043 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 24 Apr 2017 14:48:36 -0700 Subject: [PATCH 0312/1801] updated examples --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ab51012793..72ba19568b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -508,7 +508,7 @@ my\org\User }, "petstore_auth": { "type": "oauth2", - "flow": { + "flows": { "implicit": { "authorizationUrl": "http://example.org/api/oauth/dialog", "scopes": { @@ -576,7 +576,7 @@ components: in: header petstore_auth: type: oauth2 - flow: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: @@ -3423,7 +3423,7 @@ bearerFormat: JWT ```json { "type": "oauth2", - "flow": { + "flows": { "implicit": { "authorizationUrl": "https://example.com/api/oauth/dialog", "scopes": { @@ -3437,7 +3437,7 @@ bearerFormat: JWT ```yaml type: oauth2 -flow: +flows: implicit: authorizationUrl: https://example.com/api/oauth/dialog scopes: @@ -3478,7 +3478,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```JSON { "type": "oauth2", - "flow": { + "flows": { "implicit": { "authorizationUrl": "https://example.com/api/oauth/dialog", "scopes": { @@ -3500,7 +3500,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```YAML type: oauth2 -flow: +flows: implicit: authorizationUrl: https://example.com/api/oauth/dialog scopes: From edb20ba95f0d2e48d6eaecdeacaabb46184af855 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 24 Apr 2017 14:55:42 -0700 Subject: [PATCH 0313/1801] Added link --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d0f2d3b2a4..ae5b5ce446 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2617,7 +2617,7 @@ The following properties are taken directly from the JSON Schema definition and - exclusiveMinimum - maxLength - minLength -- pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) +- pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5) dialect) - maxItems - minItems - uniqueItems From 568ddf17eba55bde858bd76f8071513d11ea887d Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Apr 2017 13:51:51 -0700 Subject: [PATCH 0314/1801] Explicit code over range clarification. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42b32300ff..b331088692 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1587,7 +1587,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. '200'), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined as well - the explicit code definition takes precedence over the range definition for that code. This object can be extended with [Specification Extensions](#specificationExtensions). From 98fe8d41b08653e077577ccd74313f65c8e611be Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Apr 2017 14:04:42 -0700 Subject: [PATCH 0315/1801] Change requestBody default required to false --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42b32300ff..0f5038a61a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1111,7 +1111,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. content | [Content Object](#contentObject) | The content of the request body. -required | `boolean` | Determines if the request body is required in the request. Defaults to `true`. +required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 685ab1430bac33acd64e2f4b9ed92a158aa43ba7 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Apr 2017 14:25:12 -0700 Subject: [PATCH 0316/1801] Added default value to Schema Object's deprecated --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42b32300ff..14f4fe40de 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2652,7 +2652,7 @@ Field Name | Type | Description xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. - deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. + deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 943dd44e8781200104f5150f91b0c5853b0dbf8f Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Apr 2017 15:08:09 -0700 Subject: [PATCH 0317/1801] clarified `null` --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 42b32300ff..498d6eca6c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -139,7 +139,7 @@ By convention, it is RECOMMENDED that the OpenAPI Specification (OAS) file be na Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. -`null` is not supported as a value. +`null` is not supported as a type (see [`nullable`](#schemaNullable) for an alternative solution). Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. Primitives have an optional modifier property: `format`. From 0d45f5b37a08c1a8fa8d799024e8af38c4d4f038 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Apr 2017 19:39:28 -0700 Subject: [PATCH 0318/1801] minor change --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b331088692..5934897d03 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1587,7 +1587,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. '200'), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined as well - the explicit code definition takes precedence over the range definition for that code. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. '200'), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined as well, the explicit code definition takes precedence over the range definition for that code. This object can be extended with [Specification Extensions](#specificationExtensions). From 6e32b3492d096c19dc15161ca6bfff1f292ae758 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 26 Apr 2017 09:11:16 -0700 Subject: [PATCH 0319/1801] Update enum and default type for server variables --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index be79a88f03..af67cea41d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -388,8 +388,8 @@ An object representing a Server Variable for server URL template substituion. Field Name | Type | Description ---|:---:|--- -enum | [`primitive`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. -default | `primitive` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +enum | [`string`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. +default | `string` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be used if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. This object can be extended with [Specification Extensions](#specificationExtensions). From 925c87cdce322995625f7fd77e930fbfc326d2a9 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 26 Apr 2017 11:16:53 -0700 Subject: [PATCH 0320/1801] will to MUST --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index af67cea41d..d08bc44fa3 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -389,7 +389,7 @@ An object representing a Server Variable for server URL template substituion. Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. -default | `string` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be used if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +default | `string` | **Required.** The default value to use for substitution if an alternate value is not specified, and MUST be used if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. This object can be extended with [Specification Extensions](#specificationExtensions). From 245c5fbc4e8b7dadb54d8ddeb238183af12ab0be Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 14:38:35 -0700 Subject: [PATCH 0321/1801] Actual fields table for the content object --- versions/3.0.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15829ab6b5..6e34482928 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1233,7 +1233,10 @@ content: Describes a set of supported media types. A Content Object can be used in [Request Body Object](#requestBodyObject), [Parameter Objects](#parameterObject), [Header Objects](#headerObject), and [Response Objects](#responseObject). -Each key in the Content Object is the media type of the [Media Type Object](#mediaTypeObject). +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{mediaType} | [Media Type Object](#mediaTypeObject) | A media type that is supported by this container. The key should be the media type and the value is used to describe it. ##### Content Examples From cbdde0b275b76be01f70e87256cb0d9578194da7 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 14:58:23 -0700 Subject: [PATCH 0322/1801] Added name restrictions to some headers --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15829ab6b5..0607bb67c0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -924,7 +924,7 @@ There are four possible parameter locations (as specified with the `in` field): ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
+name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `Accept`, `Content-Type` or `Authorization`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. @@ -1649,7 +1649,7 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. +headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. If a response header is defined with the name `Content-Type`, it SHALL be ignored. content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. From 600d4c71548b191a7714198e13a349ae7c66bf09 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 15:00:25 -0700 Subject: [PATCH 0323/1801] added quotes --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0607bb67c0..721d7fe6f5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -924,7 +924,7 @@ There are four possible parameter locations (as specified with the `in` field): ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `Accept`, `Content-Type` or `Authorization`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
+name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. @@ -1649,7 +1649,7 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. If a response header is defined with the name `Content-Type`, it SHALL be ignored. +headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. From b6f81ea5b89138ade974b4506768da1064baf118 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 15:05:38 -0700 Subject: [PATCH 0324/1801] Fixed anchors for Links/Link --- versions/3.0.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15829ab6b5..e70b5d6d2b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1998,7 +1998,7 @@ For computing links, and providing instructions to execute them, [variable subst ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. + {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. #### Link Object The `Link Object` is responsible for defining a possible operation based on a single response. @@ -2007,12 +2007,12 @@ The `Link Object` is responsible for defining a possible operation based on a si Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. -headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. -description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). -server | [Server Object](#serverObject) | a server object to be used by the target operation +operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. +parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. +headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. +description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). +server | [Server Object](#serverObject) | a server object to be used by the target operation. This object can be extended with [Specification Extensions](#specificationExtensions). From c195cac908534bceadc6284578398a0adcc055c2 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 27 Apr 2017 20:53:17 -0400 Subject: [PATCH 0325/1801] Fixed a few nits in the examples --- examples/v3.0/api-with-examples.yaml | 10 +++++----- examples/v3.0/petstore-expanded.yaml | 2 +- examples/v3.0/petstore.yaml | 2 +- examples/v3.0/uber.yaml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml index 010f6eb6ae..ea0ce3f7dc 100644 --- a/examples/v3.0/api-with-examples.yaml +++ b/examples/v3.0/api-with-examples.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0-RC0" +openapi: "3.0.0" info: title: Simple API overview version: v2 @@ -10,7 +10,7 @@ paths: responses: 200: description: |- - 200 300 response + 200 response content: application/json: examples: @@ -42,7 +42,7 @@ paths: } 300: description: |- - 200 300 response + 300 response content: application/json: examples: @@ -80,7 +80,7 @@ paths: responses: 200: description: |- - 200 203 response + 200 response content: application/json: examples: @@ -124,7 +124,7 @@ paths: } 203: description: |- - 200 203 response + 203 response content: application/json: examples: diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml index ace79b1a54..26e533e7a1 100644 --- a/examples/v3.0/petstore-expanded.yaml +++ b/examples/v3.0/petstore-expanded.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0-RC0" +openapi: "3.0.0" info: version: 1.0.0 title: Swagger Petstore diff --git a/examples/v3.0/petstore.yaml b/examples/v3.0/petstore.yaml index 31834cf761..b444f02531 100644 --- a/examples/v3.0/petstore.yaml +++ b/examples/v3.0/petstore.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0-RC0" +openapi: "3.0.0" info: version: 1.0.0 title: Swagger Petstore diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml index 1ae7d8ef08..b7dea7a0ba 100644 --- a/examples/v3.0/uber.yaml +++ b/examples/v3.0/uber.yaml @@ -1,6 +1,6 @@ # this is an example of the Uber API # as a demonstration of an API spec in YAML -openapi: "3.0.0-RC0" +openapi: "3.0.0" info: title: Uber API description: Move your app forward with the Uber API From b9f969a92be288898d7fe2a315584b07cb07f204 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 27 Apr 2017 21:27:33 -0400 Subject: [PATCH 0326/1801] Clarify parameter use of schema or content --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15829ab6b5..1d98fc5d6f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -932,7 +932,7 @@ Field Name | Type | Description allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a [`style`](#parameterStyle) and [`schema`](#parameterSchema) can be used to describe the structure and syntax of the parameter. +For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can be used to describe the structure and syntax of the parameter. Field Name | Type | Description ---|:---:|--- @@ -943,9 +943,9 @@ Field Name | Type | Description example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -For more complex scenarios a [Content Object](#contentObject) can be used to define the media type -and schema of the parameter. This option is mutually exclusive with the simple scenario -above. When `example` or `examples` are provided in conjunction with the `schema` object, +For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. +A parameter MUST contain either a `schema` property, or a `content` property, but not both. +When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. From 8d48f5ff227ce8eed1d8787a6e677fb3c89dcca4 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 18:31:34 -0700 Subject: [PATCH 0327/1801] Added allowReserved to Encoding Property Object --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9abf258fd8..5ca049f9bc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1570,6 +1570,7 @@ Field Name | Type | Description headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 463aef6908560a6844e638fcdb344718e8d34397 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 27 Apr 2017 21:57:37 -0400 Subject: [PATCH 0328/1801] Added paragraph about markdown --- versions/3.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 9abf258fd8..ea06b59b80 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -27,6 +27,7 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Format](#format) - [File Structure](#fileStructure) - [Data Types](#dataTypes) + - [Rich Text Formatting](#richText) - [Relative References In URLs](#relativeReferences) - [Schema](#schema) - [OpenAPI Object](#oasObject) @@ -165,6 +166,10 @@ date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc. dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) password | `string` | `password` | Used to hint UIs the input needs to be obscured. +### Rich Text Formatting +Throughout the specification `summary` and `description` fields are noted as supporting CommonMark markdown formatting. +OpenAPI compliant tooling MUST support [CommonMark 0.27](http://spec.commonmark.org/0.27/). + ### Relative References in URLs Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). From d8f72c8d2eb77611a37375994b6a6e9e824cfac4 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 27 Apr 2017 22:02:19 -0400 Subject: [PATCH 0329/1801] Removed overly generous use of markdown --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ea06b59b80..da8fbd2da8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -167,7 +167,7 @@ dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http:/ password | `string` | `password` | Used to hint UIs the input needs to be obscured. ### Rich Text Formatting -Throughout the specification `summary` and `description` fields are noted as supporting CommonMark markdown formatting. +Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. OpenAPI compliant tooling MUST support [CommonMark 0.27](http://spec.commonmark.org/0.27/). ### Relative References in URLs From b6e8bfead4859249241b2a289202279d210c7fbc Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 27 Apr 2017 19:17:20 -0700 Subject: [PATCH 0330/1801] Working on the next release --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 20d51f016d..9ab5b32547 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,6 +1,6 @@ # OpenAPI Specification -#### Version 3.0.0-rc1 +#### Version 3.0.0-rc2 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). From 34fd4155a60e6d94a84d781a99a8242a6dd41046 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 3 May 2017 09:15:26 +0100 Subject: [PATCH 0331/1801] Allow $refs in Components Object Maps --- versions/3.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9ab5b32547..264f4da0be 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -411,15 +411,15 @@ All objects defined within the components object will have no effect on the API Field Name | Type | Description ---|:---|--- - schemas | Map[`string`, [Schema Object](#schemaObject)] | An object to hold reusable [Schema Objects](#schemaObject). - responses | Map[`string`, [Response Object](#responseObject)] | An object to hold reusable [Response Objects](#responseObject). - parameters | Map[`string`, [Parameter Object](#parameterObject)] | An object to hold reusable [Parameter Objects](#parameterObject). - examples | Map[`string`, [Example Object](#exampleObject)] | An object to hold reusable [Example Objects](#exampleObject). - requestBodies | Map[`string`, [Request Body Object](#requestBodyObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). - headers | Map[`string`, [Header Object](#headerObject)] | An object to hold reusable [Header Objects](#headerObject). - securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). - links | Map[`string`, [Link Object](#linkObject)] | An object to hold reusable [Link Objects](#linkObject). - callbacks | Map[`string`, [Callback Object](#callbackObject)] | An object to hold reusable [Callback Objects](#callbackObject). + schemas | Map[`string`, [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Response Object](#responseObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Response Objects](#responseObject). + parameters | Map[`string`, [Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Parameter Objects](#parameterObject). + examples | Map[`string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). + headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Header Objects](#headerObject). + securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). + links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Callback Objects](#callbackObject). This object can be extended with [Specification Extensions](#specificationExtensions). From 49a030cf6037c08a738f44a73e9e1a863cbfc26e Mon Sep 17 00:00:00 2001 From: Darrel Date: Sat, 6 May 2017 22:00:12 -0400 Subject: [PATCH 0332/1801] Removed erroneus bracket --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..6f898c3557 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -944,7 +944,7 @@ Field Name | Type | Description style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. -schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | The schema defining the type used for the parameter. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. From 99f0a42e91f3b97c6cf891c7b0a92516da6dece0 Mon Sep 17 00:00:00 2001 From: Darrel Date: Sat, 6 May 2017 22:08:15 -0400 Subject: [PATCH 0333/1801] Removed examples that contain required and default --- versions/3.0.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..02a82dd121 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2925,7 +2925,6 @@ schemas: "huntingSkill": { "type": "string", "description": "The measured skill for hunting", - "default": "lazy", "enum": [ "clueless", "lazy", @@ -2953,7 +2952,6 @@ schemas: "type": "integer", "format": "int32", "description": "the size of the pack the dog is from", - "default": 0, "minimum": 0 } }, @@ -2989,7 +2987,6 @@ schemas: huntingSkill: type: string description: The measured skill for hunting - default: lazy enum: - clueless - lazy @@ -3007,7 +3004,6 @@ schemas: type: integer format: int32 description: the size of the pack the dog is from - default: 0 minimum: 0 required: - packSize From d96828a7995900fa4846f3693e2a7989f2f5f675 Mon Sep 17 00:00:00 2001 From: Darrel Date: Sat, 6 May 2017 22:53:57 -0400 Subject: [PATCH 0334/1801] Permit tooling to limit commonmark usage --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..c1b1a489ae 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -168,7 +168,7 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur ### Rich Text Formatting Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. -OpenAPI compliant tooling MUST support [CommonMark 0.27](http://spec.commonmark.org/0.27/). +OpenAPI compliant tooling MUST support markdown that is compliant with [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY limit some CommonMark features to address security concerns. ### Relative References in URLs From a5911d7adfb6ca4dd4c6b673b98a95028bf3b081 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 8 May 2017 11:42:22 +0100 Subject: [PATCH 0335/1801] Make RFC references more consistent --- versions/3.0.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..8833eb3f0b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2,7 +2,7 @@ #### Version 3.0.0-rc2 -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt). +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](http://www.ietf.org/rfc/rfc2119.txt). This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). @@ -81,7 +81,7 @@ Path templating refers to the usage of curly braces ({}) to mark a section of a ##### Media Types Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838). +The media type definitions SHOULD be in compliance with [RFC6838](http://tools.ietf.org/html/rfc6838). Some examples of possible media type definitions: ``` @@ -98,7 +98,7 @@ Some examples of possible media type definitions: ``` ##### HTTP Status Codes The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +The available status codes are defined by [RFC7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). ## Specification @@ -172,7 +172,7 @@ OpenAPI compliant tooling MUST support [CommonMark 0.27](http://spec.commonmark. ### Relative References in URLs -Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.2). +Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), i.e. using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). @@ -769,7 +769,7 @@ Field Name | Type | Description externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). -requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. @@ -922,7 +922,7 @@ A unique parameter is defined by a combination of a [name](#parameterName) and [ There are four possible parameter locations (as specified with the `in` field): * path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. -* header - Custom headers that are expected as part of the request. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. * cookie - Used to pass a specific cookie value to the API. @@ -1452,7 +1452,7 @@ requestBody: ##### Support for x-www-form-urlencoded request bodies -To submit content using form url encoding via RFC 1866, the following +To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following definition may be used: ```yaml @@ -1466,12 +1466,12 @@ requestBody: type: string format: uuid address: - # complex types are stringified to support RFC1866 + # complex types are stringified to support RFC 1866 type: object properties: {} ``` -Note that in the above example, the contents in the `requestBody` MUST be stringified per RFC1866 when being passed to the server. In addition, the `address` field complex object will be stringified as well. +Note that in the above example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when being passed to the server. In addition, the `address` field complex object will be stringified as well. When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. @@ -1809,7 +1809,7 @@ This object can be extended with [Specification Extensions](#specificationExtens The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed. -This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). +This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). For example, given the following HTTP request: @@ -1869,7 +1869,7 @@ myWebhook: #### Headers Object -Lists the headers that can be sent in a response or forwarded via a link. Note that [RFC 7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +Lists the headers that can be sent in a response or forwarded via a link. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. ##### Patterned Fields Field Pattern | Type | Description @@ -2104,10 +2104,10 @@ The variable expression is defined by the following [ABNF](https://tools.ietf.or query-reference = "query." name path-reference = "path." name body-reference = "body#" fragment - fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) + fragment = a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) name = *( char ) - char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) - token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) + char = as per [RFC7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per [RFC7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) ``` The `name` identifier is case-sensitive, whereas `token` is not. @@ -3378,7 +3378,7 @@ Field Name | Type | Validity | Description description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. in | `string` | `apiKey` | **Required.** The location of the API key. Valid values are `"query"` or `"header"`. -scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC 7235](https://tools.ietf.org/html/rfc7235#section-4.2). +scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. From 6088808c75a5838d62c552500030324af096bc14 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 8 May 2017 16:25:43 +0100 Subject: [PATCH 0336/1801] Remove invalid component name example --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..279b7f00be 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -433,7 +433,6 @@ User_1 User_Name user-name my.org.User -my\org\User ``` ##### Components Object Example From 30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 8 May 2017 15:49:47 -0700 Subject: [PATCH 0337/1801] documented the discriminator property --- versions/3.0.md | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index cd6a6e2826..d19a56669f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3012,6 +3012,125 @@ schemas: - packSize ``` +#### Discriminator Object + +When request bodies or response payloads may be one of a number of different schemas, a `discriminator` property can be used to aid in serialization, deserialization, and validation. The discriminator is a specific property in an object which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +propertyName | `string` | **required** the name of the property in the payload that will hold the discriminator value. + mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. + +The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. + +In OAS 3.0, a response payload may be described to be exactly one of any number of types: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' +``` + +which means the paylod _must_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator will act as a "hint" to bypass validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: + + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + discriminator: + property: pet_type +``` + +The expectation now is that a property with name `pet_type` _must_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: + +``` +{ + "id": 12345, + "pet_type": "Cat" +} +``` + +Will indicate that the `Cat` schema be used in conjunction with this payload. + +In scenarios where the value of the discriminator field does not match the schema name, an optional `mapping` definition may be used: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + discriminator: + property: pet_type + mapping: + cat: '#/components/schemas/Cat' +``` + +When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. + +In both the `oneOf` and `anyOf` use cases, all possible schemas must be listed explicitly. To avoid redundancy, the discriminator may be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema. + +For example: + +``` +components: + schemas: + Pet: + type: object + required: + - pet_type + properties: + pet_type: + type: string + discriminator: + propertyName: pet_type + mapping: + cachorro: Dog + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Cat` + properties: + name: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Dog` + properties: + bark: + type: string +``` + +a payload like this: + +``` +{ + "pet_type": "Cat", + "name": "misty" +} +``` + +will indicate that the `Cat` schema be used. Likewise this schema: + +``` +{ + "pet_type": "cachorro", + "bark": "soft" +} +``` + +will map to `Dog` because of the definition in the `mappings` element. + + #### XML Object A metadata object that allows for more fine-tuned XML model definitions. From 81435aedf58022b1326a1cc894d9fe8a28e35e1e Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 8 May 2017 16:35:49 -0700 Subject: [PATCH 0338/1801] Remove guidance on length restrictions for summary Per TDC discussion on PR #1009, this removes the SHOULD keep length under 120 guidance from v2 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd6a6e2826..081655619e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -763,7 +763,7 @@ Describes a single API operation on a path. Field Name | Type | Description ---|:---:|--- tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. -summary | `string` | A short summary of what the operation does. For maximum readability in editing or documentation generation tools, this field SHOULD be less than 120 characters. +summary | `string` | A short summary of what the operation does. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. From 16b0fa6cbdf0a510eacc0a9ecc06c308ca6e7668 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 9 May 2017 23:19:36 -0500 Subject: [PATCH 0339/1801] Default server value --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9ab5b32547..10ae8d9635 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -192,7 +192,7 @@ Field Name | Type | Description ---|:---:|--- openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [[Server Object](#serverObject)] | An optional array of Server Objects which provide connectivity information to a target server. +servers | [[Server Object](#serverObject)] | An array of Server Objects which provide connectivity information to a target server. If `servers` is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. From 2c2af4857d36b7875b6847d23b1ff006cb50b909 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 11 May 2017 15:04:50 -0700 Subject: [PATCH 0340/1801] added example, type clarification for encoding headers --- versions/3.0.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd6a6e2826..1dc82bb189 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1561,6 +1561,8 @@ requestBody: profileImage: # only accept png/jpeg contentType: image/png, image/jpeg + headers: + x-source: profile ``` #### Encoding Property Object @@ -1571,7 +1573,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +headers | `map[String, String]` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From 10ce3e0e78bda847005aaadc57ec3337ea06b02f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 11 May 2017 15:25:48 -0700 Subject: [PATCH 0341/1801] updated per feedback --- versions/3.0.md | 335 +++++++++++++++++++++++++----------------------- 1 file changed, 177 insertions(+), 158 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d19a56669f..390a3d3e7e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2663,7 +2663,7 @@ Other than the JSON Schema subset fields, the following fields MAY be used for f Field Name | Type | Description ---|:---:|--- nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. -discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. See [Composition and Inheritance](#schemaComposition) for more details. +discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. See [Composition and Inheritance](#schemaComposition) for more details. readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. @@ -2826,190 +2826,197 @@ example: ```json { - "schemas": { - "ErrorModel": { - "type": "object", - "required": [ - "message", - "code" - ], - "properties": { - "message": { - "type": "string" - }, - "code": { - "type": "integer", - "minimum": 100, - "maximum": 600 + "components": { + "schemas": { + "ErrorModel": { + "type": "object", + "required": [ + "message", + "code" + ], + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer", + "minimum": 100, + "maximum": 600 + } } - } - }, - "ExtendedErrorModel": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorModel" - }, - { - "type": "object", - "required": [ - "rootCause" - ], - "properties": { - "rootCause": { - "type": "string" + }, + "ExtendedErrorModel": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorModel" + }, + { + "type": "object", + "required": [ + "rootCause" + ], + "properties": { + "rootCause": { + "type": "string" + } } } - } - ] + ] + } } } } ``` ```yaml -schemas: - ErrorModel: - type: object - required: - - message - - code - properties: - message: - type: string - code: - type: integer - minimum: 100 - maximum: 600 - ExtendedErrorModel: - allOf: - - $ref: '#/components/schemas/ErrorModel' - - type: object +components: + schemas: + ErrorModel: + type: object required: - - rootCause + - message + - code properties: - rootCause: + message: type: string + code: + type: integer + minimum: 100 + maximum: 600 + ExtendedErrorModel: + allOf: + - $ref: '#/components/schemas/ErrorModel' + - type: object + required: + - rootCause + properties: + rootCause: + type: string ``` ###### Models with Polymorphism Support ```json { - "schemas": { - "Pet": { - "type": "object", - "discriminator": "petType", - "properties": { - "name": { - "type": "string" + "components": { + "schemas": { + "Pet": { + "type": "object", + "discriminator": "petType", + "properties": { + "name": { + "type": "string" + }, + "petType": { + "type": "string" + } }, - "petType": { - "type": "string" - } + "required": [ + "name", + "petType" + ] }, - "required": [ - "name", - "petType" - ] - }, - "Cat": { - "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } + "Cat": { + "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" }, - "required": [ - "huntingSkill" - ] - } - ] - }, - "Dog": { - "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } + { + "type": "object", + "properties": { + "huntingSkill": { + "type": "string", + "description": "The measured skill for hunting", + "default": "lazy", + "enum": [ + "clueless", + "lazy", + "adventurous", + "aggressive" + ] + } + }, + "required": [ + "huntingSkill" + ] + } + ] + }, + "Dog": { + "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" }, - "required": [ - "packSize" - ] - } - ] + { + "type": "object", + "properties": { + "packSize": { + "type": "integer", + "format": "int32", + "description": "the size of the pack the dog is from", + "default": 0, + "minimum": 0 + } + }, + "required": [ + "packSize" + ] + } + ] + } } } } ``` ```yaml -schemas: - Pet: - type: object - discriminator: petType - properties: - name: - type: string - petType: - type: string - required: - - name - - petType - Cat: ## "Cat" will be used as the discriminator value - description: A representation of a cat - allOf: - - $ref: '#/components/schemas/Pet' - - type: object +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType properties: - huntingSkill: + name: + type: string + petType: type: string - description: The measured skill for hunting - default: lazy - enum: - - clueless - - lazy - - adventurous - - aggressive - required: - - huntingSkill - Dog: ## "Dog" will be used as the discriminator value - description: A representation of a dog - allOf: - - $ref: '#/components/schemas/Pet' - - type: object - properties: - packSize: - type: integer - format: int32 - description: the size of the pack the dog is from - default: 0 - minimum: 0 required: - - packSize + - name + - petType + Cat: ## "Cat" will be used as the discriminator value + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: ## "Dog" will be used as the discriminator value + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize ``` #### Discriminator Object @@ -3034,7 +3041,7 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' ``` -which means the paylod _must_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator will act as a "hint" to bypass validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: +which means the paylod _must_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator may act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: ``` @@ -3044,7 +3051,7 @@ MyResponseType: - $ref: '#/components/schemas/Dog' - $ref: '#/components/schemas/Lizard' discriminator: - property: pet_type + propertyName: pet_type ``` The expectation now is that a property with name `pet_type` _must_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: @@ -3058,7 +3065,7 @@ The expectation now is that a property with name `pet_type` _must_ be present in Will indicate that the `Cat` schema be used in conjunction with this payload. -In scenarios where the value of the discriminator field does not match the schema name, an optional `mapping` definition may be used: +In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition may be used: ``` MyResponseType: @@ -3066,12 +3073,16 @@ MyResponseType: - $ref: '#/components/schemas/Cat' - $ref: '#/components/schemas/Dog' - $ref: '#/components/schemas/Lizard' + - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' discriminator: property: pet_type mapping: - cat: '#/components/schemas/Cat' + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' ``` +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation should fail. + When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. In both the `oneOf` and `anyOf` use cases, all possible schemas must be listed explicitly. To avoid redundancy, the discriminator may be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema. @@ -3108,6 +3119,14 @@ components: properties: bark: type: string + Lizard: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Lizard` + properties: + lovesRocks: + type: boolean ``` a payload like this: From 06ca1cf2b00339eb8aad4b48fd65c32851e0ebdd Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 12 May 2017 08:54:13 -0700 Subject: [PATCH 0342/1801] Refactoring variable substitution into runtime expression --- versions/3.0.md | 162 +++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 99 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 264f4da0be..da95a57b6f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1808,7 +1808,7 @@ This object can be extended with [Specification Extensions](#specificationExtens The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. -However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed. +However, using a [variable substitution](#runtimeExpression) syntax the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). For example, given the following HTTP request: @@ -1830,7 +1830,6 @@ Content-Length: 123 201 Created Location: http://example.org/subscription/1 - ``` Here are the examples of how the various expressions evaluate, assuming a the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. @@ -1849,12 +1848,13 @@ $response.header.Location | http://example.org/subscription/1 ##### Callback Object Example -A callback to the URL specified by the `url` parameter in the request +A callback to the URL specified by the `url` property in the request body. ```yaml myWebhook: '$request.body#/url': + 'http://notificationServer.com?transactionId={$request#/body}&email={$request.body#/email}}' post: requestBody: description: Callback payload @@ -2000,9 +2000,9 @@ schemas: The links object represents a set of possible design-time links for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. -As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. +As opposed to _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. -For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in a response and using them as parameters while invoking the linked operation. ##### Patterned Fields Field Pattern | Type | Description @@ -2019,7 +2019,6 @@ Field Name | Type | Description operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. -headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. @@ -2030,88 +2029,6 @@ In the case of an `operationId`, it MUST be unique and resolved in the scope of Because of the potential for name clashes, consider the `operationRef` syntax as the preferred method for specifications with external references. -##### Response Payload Values - -Payload values are only available in parsable response payloads which match the advertised media -type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases, -if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an -empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is -required, and a parameter is not supplied, the client MAY choose to not follow the link definition. - -##### Example - -Response payload: -```json -{ - "id": "df71a505-07bc-458a-a5c0-73c0340d1ec7", - "firstname": "Ash", - "lastname": "Williams" -} -``` - -Payload Variables: -```yaml -id: df71a505-07bc-458a-a5c0-73c0340d1ec7 -firstname: Ash -lastname: Williams -missingValue: null -``` - -In situations where variables appear in an array, an array of variables will be extracted. -For example: - -```json -[ - { "color": "red" }, - { "color": "green" }, - { "color": "blue" } -] -``` - -will be extracted as such: - -```json -color: ["red", "green", "blue"] -``` - -The variables generated can be used in locations prescribed by the definition. - - -##### Variable Substitution -In all cases, _variables_ from request and responses may be substituted for link generation. -The table below provides examples of variable expressions and examples of their use in a value: - -Source Location | variable expression | example reference | notes ----|:---|:---|:--- -HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation -Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` | -Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters MUST be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers -Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself -Request URL | `$url` | `/track?url={$url}` | -Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax. -Response header | `$response.header` | `{$response.header.Server}` | Single header values only are available - -From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. -For responses, the response payload may be used with the `$response` syntax. -For both requests and responses, values will be substituted in the link in sections designated with a variable expression, surrounded by curly brackets `{}`. - -The variable expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax - -``` - expression = ( "$url" | "$method" | "$request." [ source ] | "$response." [ source ]) - source = ( header-reference | query-reference | path-reference | body-reference ) - header-reference = "header." token - query-reference = "query." name - path-reference = "path." name - body-reference = "body#" fragment - fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) - name = *( char ) - char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) - token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) -``` - -The `name` identifier is case-sensitive, whereas `token` is not. - ##### Request Parameter Example Computing a link from a request operation like this: @@ -2147,7 +2064,7 @@ Addresses: operationId: getUserAddress parameters: # get the `id` field from the request path parameter named `id` - userId: '{$request.path.id}' + userId: $request.path.id ``` Where the `$request.path.id` is the value passed in the request to `/users/{id}`. @@ -2155,24 +2072,22 @@ Where the `$request.path.id` is the value passed in the request to `/users/{id}` ##### Response Payload Example ```yaml -Addresses: +AddressesLink: operationId: getUserAddressByUUID parameters: # get the `id` field from the request path parameter named `id` - userUuid: '{$response.body#/uuid}' + userUuid: $response.body#/uuid ``` And the array example: ```yaml -ColorSelection: +ColorSelectionLink: operationId: getColorSample parameters: - colorName: '{$response.body#/color}' + colorName: $response.body#/color ``` -Would produce three links with the `colorName` of `red`, `green`, and `blue`: - As with all links, it is at the clients' discretion to follow them, neither permissions nor the ability to make a successful call to that link is guaranteed solely by the existence of a relationship. @@ -2394,7 +2309,9 @@ components: links: UserRepositories: # returns array of '#/components/schemas/repository' - operationRef: '#paths~12.0~1repositories~1{$response.body#/username}' + operationRef: '#paths~12.0~1repositories~1/{username}' + parameters: + username: $response.body#/username ``` or an absolute `operationRef`: @@ -2404,14 +2321,15 @@ components: links: UserRepositories: # returns array of '#/components/schemas/repository' - href: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{$response.body#/username}' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}' + parameters: + username: $response.body#/username ``` Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when using JSON references. #### Link Parameters Object -Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads. Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. To specify parameters required by the operation, we can use a **Link Parameters Object**. @@ -2420,7 +2338,10 @@ This object contains parameter names along with static or dynamic values: ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- - {name} | Any \| [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. + {name} | Any \| [{runtime expression}](#runtimeExpression) | A constant value or expression to be evaluated and passed to the linked operation. + +When a runtime expression evaluates to null, no parameter value is passed to the target operation. + ```yaml paths: @@ -2449,6 +2370,49 @@ components: In the above, the link for `UserCommitHistory` points to the operation `getUserCommitHistory`, and passes the `username` value from the response payload as well as the static scalar value `0`. +##### Runtime Expressions + +Runtime expressions allow defining values based on information that will only available within the HTTP message in an actual API call. This mechanism is used by [Link Parameters Objects](#linkParmeterObject) and [Callback Objects](#callbackObject). + +The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = ( "$url" | "$method" | "$request." [ source ] | "$response." [ source ]) + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body#" fragment + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + +The table below provides examples of runtime expressions and examples of their use in a value: + +##### Examples + +Source Location | example expression | notes +---|:---|:---|:--- +HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation +Requested media type | `$request.header.accept` | +Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section for the parent operation or they cannot be evaluated. This includes request headers. +Request body property | `$request.body#/user/uuid` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Request URL | `$url` | +Response value | `$response.body#/status` | Only the payload in the response can be accessed with the `$response` syntax. +Response header | `$response.header.Server` | Single header values only are available + +Runtime expressions preserve the type of the referenced value. +Expression values can be embeded into string values by surrounding the expression with `{}` curly braces. + +`$request.body`and `$response.body`expressions are only available in payloads which that can be accessed using a JSON Pointer. +If a value does _not_ exist, the result of the expression will be considered a `null` value (as opposed to an empty value). + + + #### Header Object The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes: From 3105843b8a50d55cfb2bde7969b29d3ae2033531 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 12 May 2017 08:58:05 -0700 Subject: [PATCH 0343/1801] webhook key with embedded runtime expression --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index da95a57b6f..ad8855a01c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1853,8 +1853,7 @@ A callback to the URL specified by the `url` property in the request body. ```yaml myWebhook: - '$request.body#/url': - 'http://notificationServer.com?transactionId={$request#/body}&email={$request.body#/email}}' + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}}': post: requestBody: description: Callback payload From 47a18623a45219db86fd69577ccf282fb1069233 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 12 May 2017 09:47:21 -0700 Subject: [PATCH 0344/1801] fixed a variable substitution --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ad8855a01c..3296f0e5c7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1808,7 +1808,7 @@ This object can be extended with [Specification Extensions](#specificationExtens The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. -However, using a [variable substitution](#runtimeExpression) syntax the complete HTTP message can be accessed. +However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). For example, given the following HTTP request: From 5064b7cc6bec2b51e3971a1a76017c12f586cbdd Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 12 May 2017 09:47:47 -0700 Subject: [PATCH 0345/1801] comments per TDC --- versions/3.0.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 390a3d3e7e..7b4cb62f26 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2995,7 +2995,6 @@ components: huntingSkill: type: string description: The measured skill for hunting - default: lazy enum: - clueless - lazy @@ -3041,7 +3040,7 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' ``` -which means the paylod _must_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator may act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: +which means the paylod _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator may act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: ``` @@ -3054,7 +3053,7 @@ MyResponseType: propertyName: pet_type ``` -The expectation now is that a property with name `pet_type` _must_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: +The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: ``` { @@ -3075,13 +3074,13 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' discriminator: - property: pet_type + propertyName: pet_type mapping: dog: '#/components/schemas/Dog' monster: 'https://gigantic-server.com/schemas/Monster/schema.json' ``` -Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation should fail. +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation should fail. Note, mapping keys MUST be string values, but tooling may response values to strings for comparison. When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. From a46d2ba411cecc19021847c4acc0613b9982e600 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 17 May 2017 12:16:42 -0700 Subject: [PATCH 0346/1801] Minor wording fix --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 10ae8d9635..6fcf80e4f0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -192,7 +192,7 @@ Field Name | Type | Description ---|:---:|--- openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [[Server Object](#serverObject)] | An array of Server Objects which provide connectivity information to a target server. If `servers` is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +servers | [[Server Object](#serverObject)] | An array of Server Objects which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. From f8c100f79e5c36c09490aa812ad87751f2749156 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 17 May 2017 12:25:09 -0700 Subject: [PATCH 0347/1801] oops --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index e577a0ad64..538a64b8ca 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3625,6 +3625,7 @@ Two examples for this: Version | Date | Notes --- | --- | --- +3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification 3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification 2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative 2.0 | 2014-09-08 | Release of Swagger 2.0 From 37ff59ca3d5ea24c189f46f728054c3f0f191b6d Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Wed, 17 May 2017 20:28:28 -0400 Subject: [PATCH 0348/1801] Fix typo in spec example: 'securitySchemas'->'SecuritySchemes' --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index fd613139ee..5f241b406c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -570,7 +570,7 @@ components: application/json schema: $ref: '#/components/schemas/GeneralError' - securitySchemas: + securitySchemes: api_key: type: apiKey name: api_key From 978555bf4a2117ac7d0e5ee39ab3477dd52fceda Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 18 May 2017 10:24:24 -0400 Subject: [PATCH 0349/1801] Fixed quoted response key --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 15829ab6b5..7082ecf3d1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1976,7 +1976,7 @@ schemas: # in a response responses: - 200: + '200': description: your car appointment has been booked content: application/json: From dd6eb33535f17a207890ba74901c5cabb0b163dc Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 13:39:10 -0700 Subject: [PATCH 0350/1801] Removed Server Variables Object --- versions/3.0.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e577a0ad64..8579bc4730 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -35,7 +35,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Contact Object](#contactObject) - [License Object](#licenseObject) - [Server Object](#serverObject) - - [Server Variables Object](#serverVariablesObject) - [Server Variable Object](#serverVariableObject) - [Components Object](#componentsObject) - [Paths Object](#pathsObject) @@ -330,7 +329,7 @@ Field Name | Type | Description ---|:---:|--- url | `string` | **Required.** A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -variables | [Server Variables Object](#serverVariablesObject) | An object holding variables for substitution in the URL template. +variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -376,16 +375,6 @@ servers: default: v2 ``` -#### Server Variables Object - -##### Patterned Fields - -Field Pattern | Type | Description ----|:---:|--- - {name} | [Server Variable Object](#serverVariableObject) | A variable to be used for substitution in a Server's URL template. - -This object can be extended with [Specification Extensions](#specificationExtensions). - #### Server Variable Object From cd37500687c4b89ed98b2b5b43b7c3059f263fb7 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 13:46:44 -0700 Subject: [PATCH 0351/1801] Removed Encoding Object Renamed Encoding Property Object to Encoding Object. --- versions/3.0.md | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8579bc4730..23c6046c2a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -46,7 +46,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Content Object](#contentObject) - [Media Type Object](#mediaTypeObject) - [Encoding Object](#encodingObject) - - [Encoding Property Object](#encodingPropertyObject) - [Responses Object](#responsesObject) - [Response Object](#responseObject) - [Callbacks Object](#callbacksObject) @@ -1326,7 +1325,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | [Encoding Object](#encodingObject) | Encoding of the media type. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1510,12 +1509,18 @@ In scenarios where more control is needed over the Content-Type for `multipart` #### Encoding Object -An object representing multipart region encoding for `requestBody` objects. +A single encoding definition applied to a single schema property. -##### Patterned Fields -Field Pattern | Type | Description +##### Fixed Fields +Field Name | Type | Description ---|:---:|--- -{property} | [Encoding Property Object](#encodingPropertyObject) | The property name to which the special encoding are applied. This field MUST exist in the schema as a property. +contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. +headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. + +This object can be extended with [Specification Extensions](#specificationExtensions). ##### Encoding Object Example @@ -1552,20 +1557,6 @@ requestBody: contentType: image/png, image/jpeg ``` -#### Encoding Property Object - -A single encoding definition applied to a single schema property. - -##### Fixed Fields -Field Name | Type | Description ----|:---:|--- -contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | `object` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. -explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. -allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. - -This object can be extended with [Specification Extensions](#specificationExtensions). #### Responses Object From f774f1df15c78c94d78c38635095fabdc6f282ea Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 14:03:20 -0700 Subject: [PATCH 0352/1801] Remove Callbacks Object --- versions/3.0.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 23c6046c2a..746c0760a9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -48,7 +48,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Encoding Object](#encodingObject) - [Responses Object](#responsesObject) - [Response Object](#responseObject) - - [Callbacks Object](#callbacksObject) - [Callback Object](#callbackObject) - [Headers Object](#headersObject) - [Example Object](#exampleObject) @@ -758,7 +757,8 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. @@ -1757,19 +1757,6 @@ Response with no return value: description: object created ``` -#### Callbacks Object - -A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -{name} | [Callback Object](#callbackObject) \| [Reference Object](#referenceObject) | A Callback Object used to define a callback request and expected responses - -This object can be extended with [Specification Extensions](#specificationExtensions). - #### Callback Object A map of possible out-of band callbacks related to the parent operation. From b387c4c3ca424613091ce3799961c5acae001f87 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Thu, 18 May 2017 17:39:15 -0400 Subject: [PATCH 0353/1801] Fix spec example: Plain text response with headers Headers Object example from [Response Object Examples](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#response-object-examples) defines the type directly in the header element, but it should be inside a schema object - see [Headers Object Example](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#headers-object-example). --- versions/3.0.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index ff7e43f098..48a561b2d6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1732,15 +1732,21 @@ Plain text response with headers: "headers": { "X-Rate-Limit-Limit": { "description": "The number of allowed requests in the current period", - "type": "integer" + "schema": { + "type": "integer" + } }, "X-Rate-Limit-Remaining": { "description": "The number of remaining requests in the current period", - "type": "integer" + "schema": { + "type": "integer" + } }, "X-Rate-Limit-Reset": { "description": "The number of seconds left in the current period", - "type": "integer" + "schema": { + "type": "integer" + } } } } @@ -1756,13 +1762,16 @@ content: headers: X-Rate-Limit-Limit: description: The number of allowed requests in the current period - type: integer + schema: + type: integer X-Rate-Limit-Remaining: description: The number of remaining requests in the current period - type: integer + schema: + type: integer X-Rate-Limit-Reset: description: The number of seconds left in the current period - type: integer + schema: + type: integer ``` Response with no return value: From b228c461ff979cc3460b2918e98299ba286712fd Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 15:30:02 -0700 Subject: [PATCH 0354/1801] Removed Headers Object --- versions/3.0.md | 57 +++---------------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 746c0760a9..d982efcf06 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -49,7 +49,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Responses Object](#responsesObject) - [Response Object](#responseObject) - [Callback Object](#callbackObject) - - [Headers Object](#headersObject) - [Example Object](#exampleObject) - [Links Object](#linksObject) - [Link Object](#linkObject) @@ -1637,7 +1636,7 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -headers | [Headers Object](#headersObject) | A list of headers that are sent with the response. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. links | [Links Object](#linksObject) | An object representing operations related to the response payload. @@ -1834,56 +1833,6 @@ myWebhook: ``` -#### Headers Object -Lists the headers that can be sent in a response or forwarded via a link. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -{name} | [Header Object](#headerObject) \| [Reference Object](#referenceObject) | The name of the property corresponds to the name of the header. The value describes the type of the header. - -##### Headers Object Example - -Rate-limit headers: - -```json -{ - "X-Rate-Limit-Limit": { - "description": "The number of allowed requests in the current period", - "schema": { - "type": "integer" - } - }, - "X-Rate-Limit-Remaining": { - "description": "The number of remaining requests in the current period", - "schema": { - "type": "integer" - } - }, - "X-Rate-Limit-Reset": { - "description": "The number of seconds left in the current period", - "schema": { - "type": "integer" - } - } -} -``` - -```yaml -X-Rate-Limit-Limit: - description: The number of allowed requests in the current period - schema: - type: integer -X-Rate-Limit-Remaining: - description: The number of remaining requests in the current period - schema: - type: integer -X-Rate-Limit-Reset: - description: The number of seconds left in the current period - schema: - type: integer -``` - #### Example Object ##### Fixed Fields @@ -1985,7 +1934,7 @@ Field Name | Type | Description operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. -headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. This represents the headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. @@ -2419,7 +2368,7 @@ In the above, the link for `UserCommitHistory` points to the operation `getUserC The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes: -1. `name` MUST NOT be specified, it is given in the [Headers Object](#headersObject). +1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). From 702f44ab67fd5f364461757c08989357e5100cce Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 15:48:00 -0700 Subject: [PATCH 0355/1801] Removed Links Object --- versions/3.0.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d982efcf06..53a4ad42cc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -50,7 +50,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Response Object](#responseObject) - [Callback Object](#callbackObject) - [Example Object](#exampleObject) - - [Links Object](#linksObject) - [Link Object](#linkObject) - [Link Parameters Object](#linkParametersObject) - [Header Object](#headerObject) @@ -1638,7 +1637,7 @@ Field Name | Type | Description description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. -links | [Links Object](#linksObject) | An object representing operations related to the response payload. +links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1911,22 +1910,16 @@ schemas: $ref: '#/components/examples/confirmation-success' ``` -#### Links Object -The links object represents a set of possible design-time links for a response. + +#### Link Object + +The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- - {name} | [Link Object](#linkObject) \| [Reference Object](#referenceObject) | A short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). The link SHALL reference a single Link Object, or a JSON Reference to a single link object. - -#### Link Object -The `Link Object` is responsible for defining a possible operation based on a single response. - ##### Fixed Fields Field Name | Type | Description From 3711cfe817435e57ae80ed047a7b90edcf3b5967 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 15:55:15 -0700 Subject: [PATCH 0356/1801] Removed Scopes Object --- versions/3.0.md | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 53a4ad42cc..22b337e6f6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -60,7 +60,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Security Scheme Object](#securitySchemeObject) - [OAuth Flows Object](#oauthFlowsObject) - [OAuth Flow Object](#oauthFlowObject) - - [Scopes Object](#scopesObject) - [Security Requirement Object](#securityRequirementObject) - [Specification Extensions](#specificationExtensions) - [Security Filtering](#securityFiltering) @@ -3388,7 +3387,7 @@ Field Name | Type | Validity | Description authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This MUST be in the form of a URL. tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This MUST be in the form of a URL. refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. -scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. +scopes | Map[`string`, `string`] | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3433,31 +3432,6 @@ flows: read:pets: read your pets ``` -#### Scopes Object - -Lists the available scopes for an OAuth2 security scheme. - -##### Patterned Fields - -Field Pattern | Type | Description ----|:---:|--- -{name} | `string` | Maps between a name of a scope to a short description of it (as the value of the property). - -This object can be extended with [Specification Extensions](#specificationExtensions). - -##### Scopes Object Example - -```json -{ - "write:pets": "modify pets in your account", - "read:pets": "read your pets" -} -``` - -```yaml -write:pets: modify pets in your account -read:pets: read your pets -``` #### Security Requirement Object From 53196d5f8263cf8474e2fe47474261150995bb18 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 16:07:06 -0700 Subject: [PATCH 0357/1801] Removed Link Parameters Object --- versions/3.0.md | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 22b337e6f6..e61bbb3402 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -51,7 +51,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [Callback Object](#callbackObject) - [Example Object](#exampleObject) - [Link Object](#linkObject) - - [Link Parameters Object](#linkParametersObject) - [Header Object](#headerObject) - [Tag Object](#tagObject) - [Reference Object](#referenceObject) @@ -1917,7 +1916,7 @@ The presence of a link does not guarantee the caller's ability to successfully i As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. -For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. +Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation. ##### Fixed Fields @@ -1925,7 +1924,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. +parameters | Map[`string` | Any \| [{expression}](#variableSubstitution) | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. This represents the headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. @@ -2317,45 +2316,6 @@ components: Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when using JSON references. -#### Link Parameters Object -Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads. -Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself. - -To specify parameters required by the operation, we can use a **Link Parameters Object**. -This object contains parameter names along with static or dynamic values: - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- - {name} | Any \| [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation. - -```yaml -paths: - /user/{username}: # ... - /user/{username}/commits: - get: - operationId: userCommitHistory - parameters: - - name: username - in: path - type: string - required: true - - name: page - type: integer - format: int32 - required: true - responses: { ... } -components: - links: - UserCommitHistory: - operationId: userCommitHistory - parameters: - username: $response.body#/user/username - page: 0 -``` - -In the above, the link for `UserCommitHistory` points to the operation `getUserCommitHistory`, and passes the `username` value from the response payload as well as the static scalar value `0`. - #### Header Object The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes: From d8654ad946b128392c6cb0243c75e9b0fe4307f0 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 18 May 2017 16:22:58 -0700 Subject: [PATCH 0358/1801] Removed Content Object --- versions/3.0.md | 110 +++--------------------------------------------- 1 file changed, 6 insertions(+), 104 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e61bbb3402..99a41d01d2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -43,7 +43,6 @@ Additional utilities can also take advantage of the resulting files, such as tes - [External Documentation Object](#externalDocumentationObject) - [Parameter Object](#parameterObject) - [Request Body Object](#requestBodyObject) - - [Content Object](#contentObject) - [Media Type Object](#mediaTypeObject) - [Encoding Object](#encodingObject) - [Responses Object](#responsesObject) @@ -931,15 +930,14 @@ Field Name | Type | Description example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -For more complex scenarios a [Content Object](#contentObject) can be used to define the media type and schema of the parameter. +For more complex scenarios the [`content`](#parameterContent) can be used to define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. -When `example` or `examples` are provided in conjunction with the `schema` object, -the example MUST follow the prescribed serialization strategy for the parameter. +When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. Field Name | Type | Description ---|:---:|--- -content | [Content Object](#contentObject) | The content of the parameter. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing the representations for the parameter. The key is the media type and the value is used to describe it. ##### Style Values @@ -1103,7 +1101,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | [Content Object](#contentObject) | **Required.** The content of the request body. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **Required.** The content of the request body. The key is the media type and the value is used to describe it. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1216,104 +1214,8 @@ content: ``` -#### Content Object - -Describes a set of supported media types. A Content Object can be used in [Request Body Object](#requestBodyObject), -[Parameter Objects](#parameterObject), [Header Objects](#headerObject), and [Response Objects](#responseObject). - -##### Patterned Fields -Field Pattern | Type | Description ----|:---:|--- -{mediaType} | [Media Type Object](#mediaTypeObject) | A media type that is supported by this container. The key should be the media type and the value is used to describe it. - -##### Content Examples - -```js -"content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "examples": { - "list": { - "summary": "List of names", - "value" : ["Bob","Diane","Mary","Bill"] - }, - "empty":{ - "summary": "Empty List", - "value": [] - } - } - }, - "application/xml": { - "examples": { - "list": { - "summary": "List of names", - "value": "" - }, - "empty": { - "summary":"Empty", - "value": "" - } - } - }, - "text/plain": { - "examples": { - "list": { - "summary": "List of names", - "value": "Bob,Diane,Mary,Bill" - }, - "empty": { - "summary": "Empty", - "value" : "" - } - } - } -} -``` - -```yaml -content: - 'application/json': - schema: - type: array - items: - type: string - examples: - list: - summary: List of Names - value: - - Bob - - Diane - - Mary - - Bill - empty: - summary: Empty - value: {} - - 'application/xml': - examples: - list: - summary: List of names - value: "" - empty: - summmary: Empty list - value: "" - 'text/plain': - examples: - list: - summary: List of names - value: "Bob,Diane,Mary,Bill" - empty: - summary: Empty - value: "" -``` - #### Media Type Object -Each Media Type Object provides schema and examples for a the media type identified by its key. Media Type Objects can be used in a [Content Object](#contentObject). +Each Media Type Object provides schema and examples for a the media type identified by its key. ##### Fixed Fields Field Name | Type | Description @@ -1634,7 +1536,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | [Content Object](#contentObject) | An object containing descriptions of potential response payloads. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). From b07e49fe3242a75ab2f8022b9ad165e769583134 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 19 May 2017 09:25:57 -0700 Subject: [PATCH 0359/1801] clarifications on discriminator object, disallow inline schemas --- versions/3.0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d33fa0f6d2..f180c2c92d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2663,7 +2663,7 @@ Other than the JSON Schema subset fields, the following fields MAY be used for f Field Name | Type | Description ---|:---:|--- nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. -discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. See [Composition and Inheritance](#schemaComposition) for more details. +discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. @@ -3020,7 +3020,9 @@ components: #### Discriminator Object -When request bodies or response payloads may be one of a number of different schemas, a `discriminator` property can be used to aid in serialization, deserialization, and validation. The discriminator is a specific property in an object which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. +When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. + +Note, when using the discriminator, _inline_ schemas will not be considered when using the discriminator. ##### Fixed Fields Field Name | Type | Description From 893dc38f1ae00789b6e0a16cd50619e306f55df2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 19 May 2017 10:19:42 -0700 Subject: [PATCH 0360/1801] fixed header type for `encodingObject` --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1dc82bb189..e0d3badcd6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1573,7 +1573,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | `map[String, String]` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +headers | `map[String, Headers Object]` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From 535adaca73f8af47a17a60c9cbc578ef86cf694b Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 19 May 2017 10:22:15 -0700 Subject: [PATCH 0361/1801] nit pickin yo --- versions/3.0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e0d3badcd6..7e82d9ede5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1562,7 +1562,9 @@ requestBody: # only accept png/jpeg contentType: image/png, image/jpeg headers: - x-source: profile + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + type: integer ``` #### Encoding Property Object @@ -1573,7 +1575,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | `map[String, Headers Object]` | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +headers | Map[`string`, Headers Object] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From c10e144782b8a7f3ebb6b872f0d15cde96d98f60 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Fri, 19 May 2017 16:52:27 -0400 Subject: [PATCH 0362/1801] Fix indents in Links example Fix Links example (https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#example-1): * Fix indents * Remove the type property from parameter, as it's already defined in the schema property * Add a name to the link --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7947f5b2e7..7d22da583e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2243,7 +2243,6 @@ paths: operationId: getRepository parameters: - name: username - type: string in: path required: true schema: @@ -2256,7 +2255,7 @@ paths: responses: '200': description: The repository - content: + content: application/json: schema: $ref: '#/components/schemas/repository' @@ -2321,7 +2320,8 @@ paths: schema: $ref: '#/components/schemas/pullrequest' links: - $ref: '#/components/links/PullRequestMerge' + pullRequestMerge: + $ref: '#/components/links/PullRequestMerge' /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: post: operationId: mergePullRequest @@ -2360,7 +2360,7 @@ components: RepositoryPullRequests: # returns '#/components/schemas/pullrequest' operationId: getPullRequestsByRepository - parameters: + parameters: username: $response.body#/owner/username slug: $response.body#/slug PullRequestMerge: From 4f3714ff99fea59662cf9511c6ca076a88f9b559 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 20 May 2017 11:18:58 +0100 Subject: [PATCH 0363/1801] Correct discriminator json example --- versions/3.0.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7947f5b2e7..e85d650fb8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2915,7 +2915,9 @@ components: "schemas": { "Pet": { "type": "object", - "discriminator": "petType", + "discriminator": { + "propertyName": "petType" + }, "properties": { "name": { "type": "string" From 08482aa3c2ccbfa6183dfac7bf4442f59bf2d844 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Mon, 22 May 2017 10:29:49 -0700 Subject: [PATCH 0364/1801] [LICENSE] Update year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 08ec3d307e..8d9ebfcb19 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2016 The Linux Foundation +Copyright 2017 The Linux Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From e6b10cc57494c2213b4cd0a843f296b412812902 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 18 May 2017 13:58:33 +0100 Subject: [PATCH 0365/1801] Add specification links for auth mechanisms --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd6a6e2826..f4b2cf4d52 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3368,7 +3368,7 @@ animals: #### Security Scheme Object Allows the definition of a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect](http://openid.net/specs/openid-connect-core-1_0.html). ##### Fixed Fields Field Name | Type | Validity | Description From ce924a93c4ce6a0d0db2938b0c414a5dfcaf423b Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 22 May 2017 16:37:46 -0400 Subject: [PATCH 0366/1801] Update 3.0.md I have updated the text to try and address concerns raised in the TDC call. - Clarified that compatibility with CommonMark is only relevant for tooling that renders rich text. - Clarified that tooling is not limited to only supporting CommonMark .27 features. Other newer features can be supported - Clarified that tooling should only ignore and not fail when features with security concerns are used. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index c1b1a489ae..44a4edf930 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -168,7 +168,7 @@ password | `string` | `password` | Used to hint UIs the input needs to be obscur ### Rich Text Formatting Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. -OpenAPI compliant tooling MUST support markdown that is compliant with [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY limit some CommonMark features to address security concerns. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. ### Relative References in URLs From 6ef745a0f6fe327d4aff1bfeb01d5962a6e90953 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Wed, 24 May 2017 16:06:07 -0400 Subject: [PATCH 0367/1801] Encoding Property Object: headers property should me a map of [String -> Header (not Header*s*)] 1. [Encoding Property Object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#encoding-property-object)#headers is currently defined as a Map of [String -> Header*s* Object]. 2. [Headers Object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#headers-object) is already a map of [{name} -> Header Object]. So, current description is equivalent to a map whose values are maps : [String -> [{name} -> Header Object]]. It contradicts to [this Encoding Object example](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#encoding-object-example) @timburks and I found this issue while working on [JSON Schema for RC2](https://github.com/googleapis/gnostic/commit/02acf4809ebe82fe6280d952ec7b6467635e5a50#commitcomment-22252403) --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index e85d650fb8..c82b958418 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1575,7 +1575,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | Map[`string`, Headers Object] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. +headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From d0b5a9ccdca018a055613a29bc248e96b5083eb9 Mon Sep 17 00:00:00 2001 From: ckriley Date: Fri, 26 May 2017 23:42:51 -0400 Subject: [PATCH 0368/1801] Added Server Object JSON examples. Enhanced Server Object YAML examples with JSON examples to be consistent with remainder of document. --- versions/3.0.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 33fbe0446c..93444157ee 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -338,6 +338,13 @@ This object can be extended with [Specification Extensions](#specificationExtens A single server would be described as: +```json +{ + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" +} +``` + ```yaml url: https://development.gigantic-server.com/v1 description: Development server @@ -345,6 +352,25 @@ description: Development server The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers): +```json +{ + "servers": [ + { + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" + }, + { + "url": "https://staging.gigantic-server.com/v1", + "description": "Staging server" + }, + { + "url": "https://api.gigantic-server.com/v1", + "description": "Production server" + } + ] +} +``` + ```yaml servers: - url: https://development.gigantic-server.com/v1 @@ -357,6 +383,33 @@ servers: The following shows how variables can be used for a server configuration: +```json +{ + "servers": [ + { + "url": "https://{username}.gigantic-server.com:{port}/{basePath}", + "description": "The production API server", + "variables": { + "username": { + "default": "demo", + "description": "this value is assigned by the service provider, in this example `gigantic-server.com`" + }, + "port": { + "enum": [ + 8443, + 443 + ], + "default": 8443 + }, + "basePath": { + "default": "v2" + } + } + } + ] +} +``` + ```yaml servers: - url: https://{username}.gigantic-server.com:{port}/{basePath} From c0e5dd1c2d3a8e3a25c3d599bd70d641604d80a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 30 May 2017 10:19:16 +0200 Subject: [PATCH 0369/1801] #1133 - replace commaDelimited by simple. Also, in one example there was `"format": "form"` for a parameter, which is totally bogus. --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 33fbe0446c..fa40088da4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -717,7 +717,7 @@ This object can be extended with [Specification Extensions](#specificationExtens "items": { "type": "string" }, - "style": "commaDelimited" + "style": "simple" } ] } @@ -749,7 +749,7 @@ parameters: description: ID of pet to use required: true type: array - format: form + style: simple items: type: string ``` @@ -1016,7 +1016,7 @@ A header parameter with an array of 64 bit integer numbers: "format": "int64" } }, - "style": "commaDelimited" + "style": "simple" } ``` @@ -1030,7 +1030,7 @@ schema: items: type: integer format: int64 -style: commaDelimited +style: simple ``` A path parameter of a string value: From f1101d249983feb23c4b7a7e9e63467a52a5c76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 30 May 2017 10:25:04 +0200 Subject: [PATCH 0370/1801] csv is now simple, not form Fixes the location of the reference to csv to the correct one. Also, add a "from OpenAPI 2.0" to the "replaces" sentences, because otherwise the context is missing for people who are new to OpenAPI. --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 33fbe0446c..7653b14237 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -965,10 +965,10 @@ In order to support common ways of serializing simple parameters, a set of `styl ----------- | ------ | -------- | -------- matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` value. -simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). -spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv`. -pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes`. +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `multi` value from OpenAPI 2.0. +simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0. +spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. +pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. From a0709cd471eb59a066f7917ff9fd899abdd5abfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 30 May 2017 18:17:41 +0200 Subject: [PATCH 0371/1801] add missing schema to "Path Item Object Example" As pointed out by @darrelmiller, the path item object example was missing its `schema` attribute. --- versions/3.0.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fa40088da4..3dd22a1ec6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -713,9 +713,11 @@ This object can be extended with [Specification Extensions](#specificationExtens "in": "path", "description": "ID of pet to use", "required": true, - "type": "array", - "items": { - "type": "string" + "schema": { + "type": "array", + "items": { + "type": "string" + } }, "style": "simple" } @@ -748,10 +750,11 @@ parameters: in: path description: ID of pet to use required: true - type: array - style: simple - items: - type: string + schema: + type: array + style: simple + items: + type: string ``` #### Operation Object From 8baa32cbef85bd85e419ae00ddd3f8aa393eea1c Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 31 May 2017 08:45:38 +0100 Subject: [PATCH 0372/1801] Server variable enum values must be strings --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 33fbe0446c..95a9245d22 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -395,7 +395,7 @@ An object representing a Server Variable for server URL template substitution. Field Name | Type | Description ---|:---:|--- -enum | [`string`] | An enumeration of primitive type values to be used if the substitution options are from a limited set. +enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. default | `string` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. From bc77970d3a501fc96e48fabbfe25fe1df9335f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Thu, 1 Jun 2017 19:58:59 +0200 Subject: [PATCH 0373/1801] style=form can replace both csv and multi Thanks to @webron for noting this. --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7653b14237..bb9b040211 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -965,7 +965,7 @@ In order to support common ways of serializing simple parameters, a set of `styl ----------- | ------ | -------- | -------- matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) -form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `multi` value from OpenAPI 2.0. +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0. simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0. spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. From 9a1b264a78c61622408e761654fa8c51cec1350f Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 1 Jun 2017 11:52:08 -0700 Subject: [PATCH 0374/1801] content property --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 99a41d01d2..ec0850c978 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -930,7 +930,7 @@ Field Name | Type | Description example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -For more complex scenarios the [`content`](#parameterContent) can be used to define the media type and schema of the parameter. +For more complex scenarios the [`content`](#parameterContent) property can be used to define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. From 2b61473e472d5b2668771edc39935c6784d2565a Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 1 Jun 2017 12:03:53 -0700 Subject: [PATCH 0375/1801] callbacks key correction --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ec0850c978..9d7ecbe9c2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -752,7 +752,7 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. From 6f198ed0ee736f1612f869324723828abc56e67d Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 1 Jun 2017 18:44:31 -0400 Subject: [PATCH 0376/1801] Added map constraint for parameter content property --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 68610aee01..112766cd25 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -993,7 +993,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing the representations for the parameter. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing the representations for the parameter. The key is the media type and the value is used to describe it. The map MUST only contain one entry. ##### Style Values From b9d2ec76c4317a65078d4997cdb54b8a6180caca Mon Sep 17 00:00:00 2001 From: Jeremy Whitlock Date: Thu, 11 May 2017 09:17:59 -0600 Subject: [PATCH 0377/1801] update XML namespace documentation The XML namespace documentation was changed to better reflect the expected value. We changed the value type from a URL to an absolute URI and the wording was that this is a strict requirement and not a suggestion. Fixes #1084 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 68610aee01..2969ea65c5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3002,7 +3002,7 @@ See examples for expected behavior. Field Name | Type | Description ---|:---:|--- name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. -namespace | `string` | The URL of the namespace definition. Value SHOULD be in the form of a URL. +namespace | `string` | The URI of the namespace definition. Value MUST be in the form of an absolute URI. prefix | `string` | The prefix to be used for the [name](#xmlName). attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). From 18d3491eeb00ff41119cae579a75eafade7dfdcd Mon Sep 17 00:00:00 2001 From: Ollie Ford Date: Sun, 4 Jun 2017 22:35:06 +0100 Subject: [PATCH 0378/1801] Fix schemas/Error code property in Uber example The [live API returns][Uber products GET] e.g.: { "message": "No authentication provided.", "code": "unauthorized" } This commit corrects the schema for `code` to be of `type: string`. [Uber products GET]: https://api.uber.com/v1/products --- examples/v3.0/uber.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml index b7dea7a0ba..2c77b440f9 100644 --- a/examples/v3.0/uber.yaml +++ b/examples/v3.0/uber.yaml @@ -289,8 +289,7 @@ components: Error: properties: code: - type: integer - format: int32 + type: string message: type: string fields: From bd042837bc6c3b053bc11ebe7b9fd6f8a74f1880 Mon Sep 17 00:00:00 2001 From: Johannes Bader Date: Mon, 5 Jun 2017 08:00:18 -0700 Subject: [PATCH 0379/1801] Update 3.0.md --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..1e13a361af 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3514,7 +3514,7 @@ Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where there multiple query parameters or HTTP headers are required to convey security information. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize. From 8239399392df71d3c97cd41470b91fefc0456194 Mon Sep 17 00:00:00 2001 From: Johannes Bader Date: Mon, 5 Jun 2017 08:02:20 -0700 Subject: [PATCH 0380/1801] Update 3.0.md --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1e13a361af..a19acb212b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1894,7 +1894,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string` | Any \| [{expression}](#variableSubstitution) | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string` \| Any \| [{expression}](#variableSubstitution) | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. This represents the headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. From 76e4ae002b4ff46ee031b9172b182c383923117e Mon Sep 17 00:00:00 2001 From: Johannes Bader Date: Mon, 5 Jun 2017 08:03:05 -0700 Subject: [PATCH 0381/1801] Update 3.0.md --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index a19acb212b..8bcbf74175 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1894,7 +1894,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string` \| Any \| [{expression}](#variableSubstitution) | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string` \| Any \| [{expression}](#variableSubstitution)] | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. This represents the headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. From c54a2a6c072073e82e2eaa6e7a2cfc0942aaeb7d Mon Sep 17 00:00:00 2001 From: Johannes Bader Date: Mon, 5 Jun 2017 09:30:18 -0700 Subject: [PATCH 0382/1801] Update 3.0.md --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8bcbf74175..28d7f9f393 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -808,8 +808,7 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. -callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. From c0c87316d6aef80a86f4bba10ea75f9a20940054 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 5 Jun 2017 14:46:39 -0700 Subject: [PATCH 0383/1801] minor editorial changes --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e1ef23d45e..aa21756748 100644 --- a/README.md +++ b/README.md @@ -6,22 +6,22 @@ This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). -The current, released version of the OpenAPI Specification is 2.0, through donation of the Swagger Specification to the OAI by SmartBear Software. If you are interested in the release specification, please see the [master branch](https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) of this project. +The current, released version of the OpenAPI Specification is 2.0, through donation of the Swagger Specification to the OAI by SmartBear Software. If you are interested in the release specification, see the [master branch](https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) of this project. -Development of the next version of the OpenAPI Specification is being guided by the [OAI Technical Contributors Board](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/CONTRIBUTORS.md). This group of committers will be bring their API expertise, incorporating feedback from the community, and expanding the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the OpenAPI Specification, this branch will be merged to master. +Development of the next version of the OpenAPI Specification is guided by the [OAI Technical Contributors Board](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the OpenAPI Specification, this branch will be merged to master. -You can see the current process for development inside the OpenAPI Specification [here](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md). +The current process for development of the OpenAPI Specification is described in [Development Guidelines](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md). ## Participation -The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. The OAI encourages participation from individuals and companies alike. If you wish to participate in the evolution of the OpenAPI Specification, please consider the following: +The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. The OAI encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: * Review the [current specification](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md). The human-readable markdown file _is the source of truth_ for the specification. -* Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so it's clear how the spec is evolving. +* Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so you understand how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. -* Create an issue to describe a new concern along with, if possible, a proposed solution. +* Create an issue to describe a new concern. If possible, propose a solution. -Be aware that not all feedback can be accommodated and there may be solid arguments to/from a change being appropriate for the specification. +Not all feedback can be accommodated and there may be solid arguments for or against a change being appropriate for the specification. ## License From 59c680776b8fe2d0bf3db2db016229eb3fb292a3 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 5 Jun 2017 15:42:58 -0700 Subject: [PATCH 0384/1801] minor edits --- DEVELOPMENT.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index dd7c0d6fe1..36a06b8029 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,33 +1,33 @@ ## Development Guidelines -This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Contributor Board will initially follow these processes when merging changes from external contributors or from the TCB itself. This guideline document will be adjusted as it makes sense. +This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Contributor Board will initially follow these processes when merging changes from external contributors or from the TCB itself. This guideline document will be adjusted as practicality dictates. ## OAI Specification Driving factors -The OpenAPI Specification should be use-case driven. We can write support for hypothetical use cases as we see fit, but they should be backed by realistic scenarios +The OpenAPI Specification should be use-case driven. We can specify support for hypothetical use cases as we see fit, but specifications should be backed by realistic scenarios. ## Specification Change Criteria -The specification _will change_ from the original 2.0 version. We should typically do so when any of the following criteria are met: +The specification _will change_ from the original 2.0 version. We should typically make changes when any of the following criteria are met: - - Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear - - Consistency. A portion of the specification is not consistent with the rest, or the industry standard terminology - - Necessary functionality. We are missing functionality because of a certain design of the specification - - Forward-looking designs. As usage of APIs evolves to new protocols, formats, patterns, we should always be considering what the next important functionality should be + - Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear. + - Consistency. A portion of the specification is not consistent with the rest, or with the industry standard terminology. + - Necessary functionality. We are missing functionality because of a certain design of the specification. + - Forward-looking designs. As usage of APIs evolves to new protocols, formats, and patterns, we should always consider what the next important functionality should be. - Impact. A change will provide impact on a large number of use cases. We should not be forced to accommodate every use case. We should strive to make the _common_ and _important_ use cases both well supported and common in the definition of the OAI Spec. We cannot be edge-case driven. ## Tracking Process - - Use GitHub for all spec designs, use cases, etc. + - Use GitHub for all spec designs, use cases, and so on. - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.md for example). - - The `master` branch shall remain the current, released OpenAPI Specification (i.e. 2.0). We will work in an OpenAPI.next branch, which shall be described and linked to on the **default** README.md on master - - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal - - New features should be done in feature branches which, upon approval, be merged into the OpenAPI.next branch. - - Use labels for the workflow of specification changes. For example, this may be labeled as `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, `needs approval`. These labels must be assigned by project committers - - An issue will be opened for each feature change. Embedded in the issue OR ideally linked in a file via pull-request (PR), a document should be supplied for use cases for the change - - A PR will be used to describe the _proposed_ solution, and linked to the original issue - - Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel + - The `master` branch shall remain the current, released OpenAPI Specification (i.e., 2.0). We will work in an OpenAPI.next branch, which shall be described and linked to on the **default** README.md on master. + - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal. + - New features should be done in feature branches which, upon approval, are merged into the OpenAPI.next branch. + - Use labels for the workflow of specification changes. Examples of labels are `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, and `needs approval`. These labels must be assigned by project committers. + - An issue will be opened for each feature change. Embedded in the issue, or ideally linked in a file via pull-request (PR), a document about use cases should be supplied with the change. + - A PR will be used to describe the _proposed_ solution, and linked to the original issue. + - Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel. - When the OpenApi.next spec is complete and approved for release, the branch will be merged to master. ## Approving Changes @@ -35,17 +35,17 @@ The specification _will change_ from the original 2.0 version. We should typica For each change in the specification we should _always_ consider the following: - Migration. Is this a construct that has a path from the existing 2.0 specification? If so, how complicated is it to migrate to the proposed change? - - Tooling. Strive to support code generation, software interfaces, spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered if the change should be approved. - - Visualization. Can the specification change be graphically visualized somehow in a UI or other? + - Tooling. Strive to support code generation, software interfaces, and spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered during the change approval process. + - Visualization. Can the specification change be graphically visualized somehow in a UI or other interface? -Spec changes should be approved by a majority of the committers. This can be done by commenting on the issue itself ("Approved by @fehguy" for example). Once voting criteria is met, any committer can merge the PR. (**TODO: we will want to formalize what voting criteria actually is). +Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @fehguy". After voting criteria is met, any committer can merge the PR. (**TODO: we will want to formalize what voting criteria actually is). No change should be approved until there is documentation for it, supplied in an accompanying PR. ## Transparency -We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, etc. These must be anonymized, discussed in a private repository, or offline +We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, and so on. These must be anonymized, discussed in a private repository, or conducted offline. - - Asynchronous discussions should live in the GitHub issues for this project - - Realtime discussions should be in a public chat such as IRC or Slack + - Asynchronous discussions should live in the GitHub issues for this project. + - Realtime discussions should be in a public chat such as IRC or Slack. From 82678fca352259ab6282c17c4edd9df39eddcfb6 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 5 Jun 2017 15:56:03 -0700 Subject: [PATCH 0385/1801] minor edits --- IMPLEMENTATIONS.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index c4ab4281eb..a594b615b8 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -1,10 +1,9 @@ ### Implementations -Below is a list of known tooling implementing the 3.0.0 specification. Because -the 3.0.0 specification has not yet been released, please consult the details of -any projects listed below for notes about stability and roadmap. The process +Below is a list of known tooling that implements the 3.0.0 specification. Because +the 3.0.0 specification has not yet been released, refer to the details of projects listed below for any notes about stability and roadmap. The process to create the best possible 3.0.0 specification includes feedback from end-users -and tooling creators alike, and it is strongly encouraged that draft tooling be +and tooling creators. We strongly encourage draft tooling be made available for early users of the OAS. These tools are not necessarily endorsed by the OAI. @@ -25,7 +24,7 @@ These tools are not necessarily endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification | +| openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | #### Server Implementations @@ -35,5 +34,5 @@ These tools are not necessarily endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts | -| Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations | +| baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | +| Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | From d69b3b53925cf4437643c7de7f3dcf39f9cec7cf Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 5 Jun 2017 23:30:36 -0400 Subject: [PATCH 0386/1801] Cleaned up link examples --- examples/v3.0/link-example.yaml | 203 +++++++++++++++++++++ versions/3.0.md | 312 ++++---------------------------- 2 files changed, 236 insertions(+), 279 deletions(-) create mode 100644 examples/v3.0/link-example.yaml diff --git a/examples/v3.0/link-example.yaml b/examples/v3.0/link-example.yaml new file mode 100644 index 0000000000..5837d705ee --- /dev/null +++ b/examples/v3.0/link-example.yaml @@ -0,0 +1,203 @@ +openapi: 3.0.0 +info: + title: Link Example + version: 1.0.0 +paths: + /2.0/users/{username}: + get: + operationId: getUserByName + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '200': + description: The User + content: + application/json: + schema: + $ref: '#/components/schemas/user' + links: + userRepositories: + $ref: '#/components/links/UserRepositories' + /2.0/repositories/{username}: + get: + operationId: getRepositoriesByOwner + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '200': + description: repositories owned by the supplied user + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/repository' + links: + userRepository: + $ref: '#/components/links/UserRepository' + /2.0/repositories/{username}/{slug}: + get: + operationId: getRepository + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + responses: + '200': + description: The repository + content: + application/json: + schema: + $ref: '#/components/schemas/repository' + links: + repositoryPullRequests: + $ref: '#/components/links/RepositoryPullRequests' + /2.0/repositories/{username}/{slug}/pullrequests: + get: + operationId: getPullRequestsByRepository + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: state + in: query + schema: + type: string + enum: + - open + - merged + - declined + responses: + '200': + description: an array of pull request objects + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/pullrequest' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}: + get: + operationId: getPullRequestsById + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: pid + in: path + required: true + schema: + type: string + responses: + '200': + description: a pull request object + content: + application/json: + schema: + $ref: '#/components/schemas/pullrequest' + links: + pullRequestMerge: + $ref: '#/components/links/PullRequestMerge' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: + post: + operationId: mergePullRequest + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: pid + in: path + required: true + schema: + type: string + responses: + '204': + description: the PR was successfully merged +components: + links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationId: getRepositoriesByOwner + parameters: + username: $response.body#/username + UserRepository: + # returns '#/components/schemas/repository' + operationId: getRepository + parameters: + username: $response.body#/owner/username + slug: $response.body#/slug + RepositoryPullRequests: + # returns '#/components/schemas/pullrequest' + operationId: getPullRequestsByRepository + parameters: + username: $response.body#/owner/username + slug: $response.body#/slug + PullRequestMerge: + # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + operationId: mergePullRequest + parameters: + username: $response.body#/author/username + slug: $response.body#/repository/slug + pid: $response.body#/id + schemas: + user: + type: object + properties: + username: + type: string + uuid: + type: string + repository: + type: object + properties: + slug: + type: string + owner: + $ref: '#/components/schemas/user' + pullrequest: + type: object + properties: + id: + type: integer + title: + type: string + repository: + $ref: '#/components/schemas/repository' + author: + $ref: '#/components/schemas/user' diff --git a/versions/3.0.md b/versions/3.0.md index 3ac098da79..9676ebad04 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1892,7 +1892,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string` \| Any \| [{expression}](#runtimeExpression) | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string` \| Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. @@ -1904,8 +1904,9 @@ Because of the potential for name clashes, consider the `operationRef` syntax as method for specifications with external references. -##### Request Parameter Example -Computing a link from a request operation like this: +##### Examples + +Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation. ```yaml paths: @@ -1928,39 +1929,26 @@ paths: uuid: the unique user id type: string format: uuid + links: + Address: + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: $request.path.id ``` -Can be used in a link like this: - -```yaml -Addresses: - # the target link operationId - operationId: getUserAddress - parameters: - # get the `id` field from the request path parameter named `id` - userId: $request.path.id -``` - -Where the `$request.path.id` is the value passed in the request to `/users/{id}`. When a runtime expression evaluates to null, no parameter value is passed to the target operation. -##### Response Payload Example - -```yaml -AddressesLink: - operationId: getUserAddressByUUID - parameters: - # get the `id` field from the request path parameter named `id` - userUuid: $response.body#/uuid -``` - -And the array example: +Values from the response body can be used to drive a linked operation. ```yaml -ColorSelectionLink: - operationId: getColorSample - parameters: - colorName: $response.body#/color +links: + addressesLink: + operationId: getUserAddressByUUID + parameters: + # get the `id` field from the request path parameter named `id` + userUuid: $response.body#/uuid ``` As with all links, it is at the clients' discretion to follow them, neither @@ -1968,273 +1956,39 @@ permissions nor the ability to make a successful call to that link is guaranteed solely by the existence of a relationship. - -##### Example - -The example below shows how relationships in the BitBucket API can be represented -with the link schema. This example uses `operationId` values to link responses to -possible operations. - -```yaml -paths: - /2.0/users/{username}: - get: - operationId: getUserByName - parameters: - - name: username - in: path - required: true - schema: - type: string - responses: - '200': - description: The User - content: - application/json: - schema: - $ref: '#/components/schemas/user' - links: - userRepositories: - $ref: '#/components/links/UserRepositories' - /2.0/repositories/{username}: - get: - operationId: getRepositoriesByOwner - parameters: - - name: username - in: path - required: true - schema: - type: string - responses: - '200': - description: repositories owned by the supplied user - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/repository' - links: - userRepository: - $ref: '#/components/links/UserRepository' - /2.0/repositories/{username}/{slug}: - get: - operationId: getRepository - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - responses: - '200': - description: The repository - content: - application/json: - schema: - $ref: '#/components/schemas/repository' - links: - repositoryPullRequests: - $ref: '#/components/links/RepositoryPullRequests' - /2.0/repositories/{username}/{slug}/pullrequests: - get: - operationId: getPullRequestsByRepository - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: state - in: query - schema: - type: string - enum: - - open - - merged - - declined - responses: - '200': - description: an array of pull request objects - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/pullrequest' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}: - get: - operationId: getPullRequestsById - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: pid - in: path - required: true - schema: - type: string - responses: - '200': - description: a pull request object - content: - application/json: - schema: - $ref: '#/components/schemas/pullrequest' - links: - pullRequestMerge: - $ref: '#/components/links/PullRequestMerge' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: - post: - operationId: mergePullRequest - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: pid - in: path - required: true - schema: - type: string - responses: - '204': - description: the PR was successfully merged -components: - links: - UserRepositories: - # returns array of '#/components/schemas/repository' - operationId: getRepositoriesByOwner - parameters: - username: $response.body#/username - UserRepository: - # returns '#/components/schemas/repository' - operationId: getRepository - parameters: - username: $response.body#/owner/username - slug: $response.body#/slug - RepositoryPullRequests: - # returns '#/components/schemas/pullrequest' - operationId: getPullRequestsByRepository - parameters: - username: $response.body#/owner/username - slug: $response.body#/slug - PullRequestMerge: - # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge - operationId: mergePullRequest - parameters: - username: $response.body#/author/username - slug: $response.body#/repository/slug - pid: $response.body#/id - schemas: - user: - type: object - properties: - username: - type: string - uuid: - type: string - repository: - type: object - properties: - slug: - type: string - owner: - $ref: '#/components/schemas/user' - pullrequest: - type: object - properties: - id: - type: integer - title: - type: string - repository: - $ref: '#/components/schemas/repository' - author: - $ref: '#/components/schemas/user' -``` +##### OperationRef Examples As references to `operationId` MAY NOT be possible (the `operationId` is an optional value), references MAY also be made through a relative `operationRef`: ```yaml -components: - links: - UserRepositories: - # returns array of '#/components/schemas/repository' - operationRef: '#paths~12.0~1repositories~1/{username}' - parameters: - username: $response.body#/username +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: '#paths~12.0~1repositories~1/{username}' + parameters: + username: $response.body#/username ``` or an absolute `operationRef`: ```yaml -components: - links: - UserRepositories: - # returns array of '#/components/schemas/repository' - operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}' - parameters: - username: $response.body#/username +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}' + parameters: + username: $response.body#/username ``` Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when using JSON references. -```yaml -paths: - /user/{username}: # ... - /user/{username}/commits: - get: - operationId: userCommitHistory - parameters: - - name: username - in: path - type: string - required: true - - name: page - type: integer - format: int32 - required: true - responses: { ... } -components: - links: - UserCommitHistory: - operationId: userCommitHistory - parameters: - username: $response.body#/user/username - page: 0 -``` - -In the above, the link for `UserCommitHistory` points to the operation `getUserCommitHistory`, and passes the `username` value from the response payload as well as the static scalar value `0`. ##### Runtime Expressions -Runtime expressions allow defining values based on information that will only available within the HTTP message in an actual API call. This mechanism is used by [Link Parameters Objects](#linkParmeterObject) and [Callback Objects](#callbackObject). +Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#callbackObject). The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax From ffa2946244676ca61275b0849de5a64c633cd262 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 5 Jun 2017 23:42:33 -0400 Subject: [PATCH 0387/1801] More example corrections --- versions/3.0.md | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9676ebad04..ca8885927e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1915,27 +1915,43 @@ paths: - name: id in: path required: true - description: the user identifier, as userId or username + description: the user identifier, as userId schema: type: string - responses: - '200': - description: the user being returned - content: - application/json: - schema: - type: object - properties: - uuid: the unique user id - type: string - format: uuid + get: + responses: + '200': + description: the user being returned + content: + application/json: + schema: + type: object + properties: + uuid: the unique user id + type: string + format: uuid links: - Address: + address: # the target link operationId operationId: getUserAddress parameters: # get the `id` field from the request path parameter named `id` userId: $request.path.id + # the path item of the linked operation + /users/{userid}/address: + parameters: + - name: userid + in: path + required: true + description: the user identifier, as userId + schema: + type: string + # linked operation + get: + operationId: getUserAddress + responses: + '200': + description: the user's address ``` When a runtime expression evaluates to null, no parameter value is passed to the target operation. @@ -1944,7 +1960,7 @@ Values from the response body can be used to drive a linked operation. ```yaml links: - addressesLink: + address: operationId: getUserAddressByUUID parameters: # get the `id` field from the request path parameter named `id` From 34d1aec817ee3422bf7737235892f337e1b2fc5a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 7 Jun 2017 05:27:06 -0700 Subject: [PATCH 0388/1801] plain language edits --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..f487d581a5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -96,8 +96,8 @@ The available status codes are defined by [RFC7231](http://tools.ietf.org/html/r ### Format -The files describing the RESTful API in accordance with this specification are represented as JSON objects and conform to the JSON standards. -YAML, being a superset of JSON, can be used as well to represent an OAS file. +The files describing the RESTful API in accordance with this specification consist of JSON objects and conform to the JSON standards. An OAS file written in +YAML, a superset of JSON, also complies with this specification. For example, if a field has an array value, the JSON array representation will be used: @@ -107,18 +107,18 @@ For example, if a field has an array value, the JSON array representation will b } ``` -While the API is described using JSON, it does not impose a JSON input/output to the API itself. +While the API is described using JSON, input to and output from the API is not required to be JSON. All field names in the specification are **case sensitive**. The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. -Patterned fields can have multiple occurrences as long as each has a unique name. +Multiple occurrences of patterned fields need to have unique names. In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: -- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) -- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346) +- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). ### File Structure From cc83c7a8c3bac4d4af10419f2fe2215fd49682e1 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 7 Jun 2017 05:58:06 -0700 Subject: [PATCH 0389/1801] strengthen project definition, improve flow --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..d89da313d7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,13 +8,13 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) is a project used to describe and document RESTful APIs. +The OpenAPI Specification (OAS) is a project that provides mechanisms to describe and document RESTful APIs. -The OpenAPI Specification defines a set of files required to describe such an API. +The OpenAPI Specification defines a set of files required to describe such APIs. These files can then be used by documentation generation tools to display the API and code generation tools to generate clients in various programming languages. -Additional utilities can also take advantage of the resulting files, such as testing tools. +Additional utilities, such as testing tools, can also use the files. ## Table of Contents From 50c20f7352b04e8a824e9da8139a4af235e2d6b1 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Thu, 8 Jun 2017 12:07:04 -0700 Subject: [PATCH 0390/1801] edit-filestruc-datatypes --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..aba5bd55b4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -126,7 +126,7 @@ The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -By convention, it is RECOMMENDED that the OpenAPI Specification (OAS) file be named `openapi.json` or `openapi.yaml`. +It is RECOMMENDED that the OpenAPI Specification (OAS) file be named following convention: `openapi.json` or `openapi.yaml`. ### Data Types @@ -136,10 +136,10 @@ Note that `integer` as a type is also supported and is defined as a JSON number Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. Primitives have an optional modifier property: `format`. -OAS uses several known formats to more finely define the data type being used. -However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. -Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. -Types that are not accompanied by a `format` property follow their definition from the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` was not specified. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the `format` property is an open `string`-valued property, and can have any value. +Formats such as `"email"`, `"uuid"`, and so on, can be used even though undefined by this specification. +Types that are not accompanied by a `format` property follow the type definition in the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` is not specified. The formats defined by the OAS are: @@ -156,7 +156,7 @@ binary | `string` | `binary` | any sequence of octets boolean | `boolean` | | | date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -password | `string` | `password` | Used to hint UIs the input needs to be obscured. +password | `string` | `password` | A hint to UIs to obscure input. ### Rich Text Formatting Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. From 557c6db6cad55de2c36982e433d970330d9fdd7a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Thu, 8 Jun 2017 16:35:24 -0700 Subject: [PATCH 0391/1801] DavidBiesack's changes --- versions/3.0.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index f487d581a5..69fa61e3a2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -106,20 +106,19 @@ For example, if a field has an array value, the JSON array representation will b "field": [...] } ``` - -While the API is described using JSON, input to and output from the API is not required to be JSON. - All field names in the specification are **case sensitive**. The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. -Multiple occurrences of patterned fields need to have unique names. +Patterned fields MUST have unique names within the containing object. In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). +**Note:** While APIs are described with JSON or YAML Open API documents, the API request and response bodies and other content are not required to be JSON or YAML. + ### File Structure The OAS representation of the API is made of a single file. From 2269858809d8e0bb80fa72b922ffe5839e997e3c Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Thu, 8 Jun 2017 17:00:12 -0700 Subject: [PATCH 0392/1801] earth2marsh change --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 69fa61e3a2..2ed15baac8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -117,7 +117,7 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). -**Note:** While APIs are described with JSON or YAML Open API documents, the API request and response bodies and other content are not required to be JSON or YAML. +**Note:** While APIs are described by OpenAPI documents in YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. ### File Structure From 98001f4dce37bb986da2e115c134940363eb1ee8 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 7 Jun 2017 10:19:16 +0100 Subject: [PATCH 0393/1801] Captitalise key words, update guidance to rfc8174 --- versions/3.0.md | 84 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 28d7f9f393..673da654ea 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2,7 +2,7 @@ #### Version 3.0.0-rc2 -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](http://www.ietf.org/rfc/rfc2119.txt). +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). @@ -115,7 +115,7 @@ The schema exposes two types of fields: Fixed fields, which have a declared name Patterned fields can have multiple occurrences as long as each has a unique name. -In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is recommended along with some additional constraints: +In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is RECOMMENDED along with some additional constraints: - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231) - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346) @@ -171,7 +171,7 @@ Relative references used in `$ref` are processed as per [JSON Reference](https:/ ### Schema -In the following description, if a field is not explicitly **Required** or described with a MUST or SHALL, it can be considered OPTIONAL. +In the following description, if a field is not explicitly **REQUIRED** or described with a MUST or SHALL, it can be considered OPTIONAL. #### OpenAPI Object @@ -182,10 +182,10 @@ It combines what previously was the Resource Listing and API Declaration (versio Field Name | Type | Description ---|:---:|--- -openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. -info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. +openapi | `string` | **REQUIRED**. Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.\*). Patch versions will correspond to patches of this document. +info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. -paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. +paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. @@ -211,12 +211,12 @@ The metadata can be used by the clients if needed, and can be presented in editi Field Name | Type | Description ---|:---:|--- -title | `string` | **Required.** The title of the application. +title | `string` | **REQUIRED**. The title of the application. description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **Required.** The version of the API definition (which is distinct from the OpenAPI specification version or the API implementation version). +version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the OpenAPI specification version or the API implementation version). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -293,7 +293,7 @@ License information for the exposed API. Field Name | Type | Description ---|:---:|--- -name | `string` | **Required.** The license name used for the API. +name | `string` | **REQUIRED**. The license name used for the API. url | `string` | A URL to the license used for the API. MUST be in the format of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -320,7 +320,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | **Required.** A URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. @@ -431,7 +431,7 @@ An object representing a Server Variable for server URL template substitution. Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. -default | `string` | **Required.** The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +default | `string` | **REQUIRED**. The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -804,10 +804,10 @@ Field Name | Type | Description summary | `string` | A short summary of what the operation does. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. -operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. -responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation. +responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. @@ -931,7 +931,7 @@ Allows referencing an external resource for extended documentation. Field Name | Type | Description ---|:---:|--- description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL. +url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -966,10 +966,10 @@ There are four possible parameter locations (as specified with the `in` field): ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
-in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path" or "cookie". +name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
+in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. +required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. @@ -1156,7 +1156,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **Required.** The content of the request body. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value is used to describe it. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1377,7 +1377,7 @@ requestBody: format: binary ``` -In addition, specific media types may be specified: +In addition, specific media types MAY be specified: ```yaml # multiple, specific media types may be specified: @@ -1417,7 +1417,7 @@ When passing complex objects in the `x-www-form-urlencoded` content type, the de ##### Special Considerations for `multipart` content -It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is required to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supporting mechanisms for multiple file uploads. +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supporting mechanisms for multiple file uploads. When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart/*`: @@ -1592,7 +1592,7 @@ Describes a single response from an API Operation, including design-time, static ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). @@ -1891,7 +1891,7 @@ Many operations require parameters to be passed, and these MAY be dynamic depend Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. +operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to the fragment of a valid OAS definition. operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | Map[`string` \| Any \| [{expression}](#variableSubstitution)] | A map representing parameters to pass to the operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. This represents the headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override. @@ -1953,7 +1953,7 @@ The variables generated can be used in locations prescribed by the definition. ##### Variable Substitution -In all cases, _variables_ from request and responses may be substituted for link generation. +In all cases, _variables_ from request and responses MAY be substituted for link generation. The table below provides examples of variable expressions and examples of their use in a value: Source Location | variable expression | example reference | notes @@ -1961,13 +1961,13 @@ Source Location | variable expression | example reference | notes HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` | Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters MUST be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers -Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references MAY be made to portions of the `requestBody` or the entire body itself Request URL | `$url` | `/track?url={$url}` | Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax. Response header | `$response.header` | `{$response.header.Server}` | Single header values only are available From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax. -For responses, the response payload may be used with the `$response` syntax. +For responses, the response payload MAY be used with the `$response` syntax. For both requests and responses, values will be substituted in the link in sections designated with a variable expression, surrounded by curly brackets `{}`. The variable expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax @@ -2320,7 +2320,7 @@ It is not mandatory to have a Tag Object per tag used there. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | **Required.** The name of the tag. +name | `string` | **REQUIRED**. The name of the tag. description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. @@ -2409,7 +2409,7 @@ For this specification, reference resolution is done as defined by the JSON Refe ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -$ref | `string` | **Required.** The reference string. +$ref | `string` | **REQUIRED**. The reference string. This object cannot be extended with additional properties and any properties added SHALL be ignored. @@ -2866,12 +2866,12 @@ Note, when using the discriminator, _inline_ schemas will not be considered when ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -propertyName | `string` | **required** the name of the property in the payload that will hold the discriminator value. +propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. -In OAS 3.0, a response payload may be described to be exactly one of any number of types: +In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: ``` MyResponseType: @@ -2881,7 +2881,7 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' ``` -which means the paylod _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator may act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: +which means the paylod _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: ``` @@ -2905,7 +2905,7 @@ The expectation now is that a property with name `pet_type` _MUST_ be present in Will indicate that the `Cat` schema be used in conjunction with this payload. -In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition may be used: +In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: ``` MyResponseType: @@ -2921,11 +2921,11 @@ MyResponseType: monster: 'https://gigantic-server.com/schemas/Monster/schema.json' ``` -Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation should fail. Note, mapping keys MUST be string values, but tooling may response values to strings for comparison. +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Note, mapping keys MUST be string values, but tooling MAY response values to strings for comparison. When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. -In both the `oneOf` and `anyOf` use cases, all possible schemas must be listed explicitly. To avoid redundancy, the discriminator may be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema. +In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema. For example: @@ -3351,14 +3351,14 @@ Supported schemes are HTTP authentication, an API key (either as a header or as ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. +type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used. -in | `string` | `apiKey` | **Required.** The location of the API key. Valid values are `"query"` or `"header"`. -scheme | `string` | `http` | **Required.** The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-4.2). +name | `string` | `apiKey` | **REQUIRED**. The name of the header or query parameter to be used. +in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"` or `"header"`. +scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. -flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **Required.** An object containing configuration information for the flow types supported. -openIdConnectUrl | `string` | `openIdConnect` | **Required.** OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. +flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. +openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -3458,10 +3458,10 @@ Configuration details for a supported OAuth Flow ##### Fixed Fields Field Name | Type | Validity | Description ---|:---:|---|--- -authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **Required.** The authorization URL to be used for this flow. This MUST be in the form of a URL. -tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **Required.** The token URL to be used for this flow. This MUST be in the form of a URL. +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. -scopes | Map[`string`, `string`] | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. +scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. This object can be extended with [Specification Extensions](#specificationExtensions). From 82be76e05f89cef207c3b40bce1f4c69c8b439cf Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Fri, 9 Jun 2017 06:34:48 -0700 Subject: [PATCH 0394/1801] agreed upon wording of an API description definition --- versions/3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2ed15baac8..1a8414c23a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -96,8 +96,7 @@ The available status codes are defined by [RFC7231](http://tools.ietf.org/html/r ### Format -The files describing the RESTful API in accordance with this specification consist of JSON objects and conform to the JSON standards. An OAS file written in -YAML, a superset of JSON, also complies with this specification. +An API description that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. For example, if a field has an array value, the JSON array representation will be used: From 79138b2d34f1559c018ff0674a0f7f510cb27737 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Fri, 9 Jun 2017 06:43:40 -0700 Subject: [PATCH 0395/1801] RESTful APIs > singular --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d89da313d7..1cd575afb9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,7 +8,7 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) is a project that provides mechanisms to describe and document RESTful APIs. +The OpenAPI Specification (OAS) is a project that provides mechanisms to describe and document a RESTful API. The OpenAPI Specification defines a set of files required to describe such APIs. From 1597a0bb8ee760ff48899e9881f96f74b9a4c1fb Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 9 Jun 2017 18:35:27 +0200 Subject: [PATCH 0396/1801] Fixed variable expression text --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ca8885927e..c38b5b4f26 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1737,7 +1737,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Key Expression -The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +The key used to identify the [Path Item Object](#pathItemObject) is a [runtime expression](#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be `$request.body#/url`. However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed. This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). From 48b0c953c178bcc56c33c4f1e34d4d4664cebec4 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Fri, 9 Jun 2017 09:38:36 -0700 Subject: [PATCH 0397/1801] An map to A map --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 112766cd25..c6b0bd2b4f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -993,7 +993,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing the representations for the parameter. The key is the media type and the value is used to describe it. The map MUST only contain one entry. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value is used to describe it. The map MUST only contain one entry. ##### Style Values @@ -1595,7 +1595,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **Required.** A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | An map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). From c65cc6550c05b8c00b66aeba470f2a170287f12b Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Fri, 9 Jun 2017 09:51:59 -0700 Subject: [PATCH 0398/1801] David and Darrel's change --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index aba5bd55b4..ce9d8c81ba 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -126,7 +126,7 @@ The OAS representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -It is RECOMMENDED that the OpenAPI Specification (OAS) file be named following convention: `openapi.json` or `openapi.yaml`. +It is RECOMMENDED that the OpenAPI definition file be named following convention: `openapi.json` or `openapi.yaml`. ### Data Types From c3d1ba2fe4f17618a89e60dd31b1c984c53061fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Fri, 9 Jun 2017 20:46:17 +0200 Subject: [PATCH 0399/1801] =?UTF-8?q?markdown=20formatting=20fix=20?= =?UTF-8?q?=E2=80=93=20finish=20bold=20span.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 36a06b8029..84e3b5a853 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -38,7 +38,7 @@ For each change in the specification we should _always_ consider the following: - Tooling. Strive to support code generation, software interfaces, and spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered during the change approval process. - Visualization. Can the specification change be graphically visualized somehow in a UI or other interface? -Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @fehguy". After voting criteria is met, any committer can merge the PR. (**TODO: we will want to formalize what voting criteria actually is). +Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @fehguy". After voting criteria is met, any committer can merge the PR. (**TODO**: we will want to formalize what voting criteria actually is). No change should be approved until there is documentation for it, supplied in an accompanying PR. From 2d439fc35bd5a5cc95d460f305b0957889da1f80 Mon Sep 17 00:00:00 2001 From: Ted Epstein Date: Sat, 10 Jun 2017 09:13:11 -0400 Subject: [PATCH 0400/1801] Added editors section with known OpenAPI 3.0 Editors Not sure if you want to include commercial tools, or just open source components. If this is only for open source tooling, you can remove the RepreZen API Studio row from the table. (Or comment on the PR, and I'll remove it.) --- IMPLEMENTATIONS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index a594b615b8..773e2595a9 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -20,6 +20,15 @@ These tools are not necessarily endorsed by the OAI. | Tavis.OpenApi | [GitHub/tavis-sofware/Tavis.OpenApi](https://github.com/tavis-software/Tavis.OpenApi/) | dotnet | C# based parser with definition validation and migration support from V2 | +#### Editors + +| Title | Project Link | Language |Description | +|----------------|--------------|----------|---------------------| +| KaiZen OpenAPI Editor | [GitHub/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | +| RepreZen API Studio | [RepreZen.com/OpenAPI](https://www.reprezen.com/OpenAPI) | Java | Commercial desktop IDE for API design, documentation & development | +| OpenApi-gui | [GitHub/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenApi / Swagger definitions | + + #### User Interfaces | Title | Project Link | Language |Description | From c88181f2cbfcc3b2def7d14becf35403211cd390 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 21:06:39 -0700 Subject: [PATCH 0401/1801] edit Relative Reference in URLs --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..2a6ba4e927 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -167,7 +167,7 @@ Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. -Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), i.e. using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). +Relative references used in `$ref` are processed as per the [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). ### Schema From e1ac1f6204c25a9de973b02d439776e73c44011d Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 21:21:02 -0700 Subject: [PATCH 0402/1801] edit Schema section --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2969ea65c5..2736eb49ca 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -176,7 +176,7 @@ In the following description, if a field is not explicitly **Required** or descr #### OpenAPI Object This is the root document object for the API specification. -It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. +The OpenAPI object combines the Resource Listing and API Declaration from version 1.2 and earlier into one document. ##### Fixed Fields From b9e09f72092c226175889e11eaafba708072c282 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 22:31:14 -0700 Subject: [PATCH 0403/1801] edit of Fixed Fields --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..d3e53f783c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -180,9 +180,9 @@ It combines what previously was the Resource Listing and API Declaration (versio Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.\*). Patch versions will correspond to patches of this document. +openapi | `string` | **REQUIRED**. Specifies the OpenAPI Specification version being used. It can be used by tooling specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.\*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [[Server Object](#serverObject)] | An array of Server Objects which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +servers | [[Server Object](#serverObject)] | An array of Server Objects that provides connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. From effaf4e21865dd12b309b41825db6e8feae73c14 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 22:48:00 -0700 Subject: [PATCH 0404/1801] edit OpenAPI Version String --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..1531075303 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -193,7 +193,7 @@ This object can be extended with [Specification Extensions](#specificationExtens #### OpenAPI Version String -The version string signifies the version of the OpenAPI Specification that the document complies to. The format for this string MUST be `major`.`minor`.`patch`. The `patch` MAY be suffixed by a hyphen and extra alphanumeric characters. +The version string signifies which OpenAPI Specification version the document complies to. The format for this string MUST be `major`.`minor`.`patch`. The `patch` MAY be suffixed by a hyphen and extra alphanumeric characters. A `major`.`minor` SHALL be used to designate the OpenAPI Specification version, and will be considered compatible with the OpenAPI Specification specified by that `major`.`minor` version. The patch version will not be considered by tooling, making no distinction between `3.0.0` and `3.0.1`. From 7ecb4ad002eb307156a075b05d7ca8ad342f7d5a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 22:55:32 -0700 Subject: [PATCH 0405/1801] edit Fixed Fields in Info Object section --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..085178b88d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -214,7 +214,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the OpenAPI specification version or the API implementation version). +version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the OpenAPI Specification version or the API implementation version). This object can be extended with [Specification Extensions](#specificationExtensions). From 4481ebaa991c8e07f9a2c06ec8dd6a0760da2406 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 23:06:00 -0700 Subject: [PATCH 0406/1801] edit Server Variable Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..1d16916b79 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -429,7 +429,7 @@ An object representing a Server Variable for server URL template substitution. Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. -default | `string` | **REQUIRED**. The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. This object can be extended with [Specification Extensions](#specificationExtensions). From 33e5b98cd71b31d1370c0995df49bf04c6419c16 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sat, 10 Jun 2017 23:40:10 -0700 Subject: [PATCH 0407/1801] edit Parameter Locations and its Fixed Fields --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..274db329af 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -954,7 +954,7 @@ Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). ##### Parameter Locations -There are four possible parameter locations (as specified with the `in` field): +There are four possible parameter locations specified by the `in` field: * path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. * query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. * header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. @@ -964,7 +964,7 @@ There are four possible parameter locations (as specified with the `in` field): ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.
+name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. From 44acc4f9844ec4834887183b50d18c5da2423fee Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 06:52:18 -0700 Subject: [PATCH 0408/1801] more edits to Parameter Locations --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 274db329af..a0e92c9118 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -972,25 +972,25 @@ Field Name | Type | Description allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can be used to describe the structure and syntax of the parameter. +For simplicity, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. Field Name | Type | Description ---|:---:|--- -style | `string` | Describes how the parameter value will be serialized depending on type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. -explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. -example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -For more complex scenarios the [`content`](#parameterContent) property can be used to define the media type and schema of the parameter. +For complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value is used to describe it. The map MUST only contain one entry. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. ##### Style Values From 892b69a4f84091fccf7343022bd376f7dd89283a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 07:06:43 -0700 Subject: [PATCH 0409/1801] Edit Style Examples in Parameter Locations --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..8a420f4376 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1009,14 +1009,14 @@ deepObject | `object` | `query` | Provides a simple way of rendering nested obje ##### Style Examples -Assuming a parameter named `color` with one of the following values: +Assume a parameter named `color` has one of the following values: ``` string -> "blue" array -> ["blue","black","brown"] object -> { "R": 100, "G": 200, "B": 150 } ``` -The following table shows examples of how those values would be rendered. +The following table shows examples of rendering differences for each value. [`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` ----------- | ------ | -------- | -------- | --------|------- From 07a52c75e3c647c61e270f72390e2c1732d417ab Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 07:29:27 -0700 Subject: [PATCH 0410/1801] Request Body Object edit --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..865cfe5a29 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1154,7 +1154,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. From bd9e1871ea167de8184fa31763cdec97b04586fa Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 07:40:46 -0700 Subject: [PATCH 0411/1801] edit Media Type Object --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..7f97807ee0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1268,15 +1268,15 @@ content: #### Media Type Object -Each Media Type Object provides schema and examples for a the media type identified by its key. +Each Media Type Object provides schema and examples for the media type identified by its key. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. -example | Any | Example of the media type. The example object SHOULD be in the correct format as specified in the media type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the the example provided by the schema. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD apply only to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). From 81d2ed851187f1fc77a6474e41862935f4889553 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 08:29:04 -0700 Subject: [PATCH 0412/1801] change per MR's and change mutually exclusive to > of 2x --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index a0e92c9118..20ae0c3c0e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -972,7 +972,7 @@ Field Name | Type | Description allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. -For simplicity, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. +For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. Field Name | Type | Description ---|:---:|--- @@ -980,10 +980,10 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. -example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -For complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. +For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. From 87498e796b27819bcc9a792dbca0a52a19eff52c Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 08:36:53 -0700 Subject: [PATCH 0413/1801] revert only edit per MR --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7f97807ee0..2532196dfd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1276,7 +1276,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD apply only to `requestBody` objects when the content type is `multipart`. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. This object can be extended with [Specification Extensions](#specificationExtensions). From 15c18b01d6f3e53879a0ae03c5a5e67782c79278 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Sun, 11 Jun 2017 08:49:56 -0700 Subject: [PATCH 0414/1801] make the clause refer to Server Objects --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d3e53f783c..853fb1bef0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -182,7 +182,7 @@ Field Name | Type | Description ---|:---:|--- openapi | `string` | **REQUIRED**. Specifies the OpenAPI Specification version being used. It can be used by tooling specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.\*). Patch versions will correspond to patches of this document. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. -servers | [[Server Object](#serverObject)] | An array of Server Objects that provides connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. From 85d1a150492381701dc4cd7829ec5d49c74dd957 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 08:29:55 -0700 Subject: [PATCH 0415/1801] edit 'Considerations for file uploads' and 'Support for x-www-form-urlencoded request bodies' --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..69b67019fd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1345,7 +1345,7 @@ application/json: ##### Considerations for file uploads -In contrast with the 2.0 specification, describing `file` input/output content in OpenAPI is +In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: ```yaml @@ -1360,9 +1360,9 @@ schema: format: binary ``` -Note that the above examples apply to either input payloads (i.e. file uploads) or response payloads. +These examples apply to either input payloads of file uploads or response payloads. -A `requestBody` example for submitting a file in a `POST` operation therefore may look like the following: +A `requestBody` for submitting a file in a `POST` operation, however, may look like the following example: ```yaml requestBody: @@ -1409,7 +1409,7 @@ requestBody: properties: {} ``` -Note that in the above example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when being passed to the server. In addition, the `address` field complex object will be stringified as well. +In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when being passed to the server. In addition, the `address` field complex object will be stringified. When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. From fada30bf641b286d005bc9362da4e513ee854140 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 08:42:17 -0700 Subject: [PATCH 0416/1801] initial caps for section heads consistent with previous parts of the spec --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 69b67019fd..7419049867 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1343,7 +1343,7 @@ application/json: $ref: "#/components/examples/frog-example" ``` -##### Considerations for file uploads +##### Considerations for File Uploads In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: @@ -1388,7 +1388,7 @@ requestBody: format: binary ``` -##### Support for x-www-form-urlencoded request bodies +##### Support for x-www-form-urlencoded Request Bodies To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following definition may be used: From e5ef16ebeb4c1a98be2694f9db58da42b2d5e577 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 09:30:07 -0700 Subject: [PATCH 0417/1801] edit Special Considerations for multipart Content --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..93c1155eee 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1413,9 +1413,9 @@ Note that in the above example, the contents in the `requestBody` MUST be string When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. -##### Special Considerations for `multipart` content +##### Special Considerations for `multipart` Content -It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This allows complex structures as well as supporting mechanisms for multiple file uploads. +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads. When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart/*`: @@ -1456,7 +1456,7 @@ requestBody: type: '#/components/schemas/Address' ``` -In scenarios where more control is needed over the Content-Type for `multipart` request bodies, an `encoding` attribute is introduced. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. +An `encoding` attribute is introduced to give you more control than boundaries provides over the Content-Type for `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. #### Encoding Object From 5f97fc526dc142329f914f9fdabc1cf4568c311f Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 09:38:25 -0700 Subject: [PATCH 0418/1801] DB's changes --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7419049867..e2931c96e1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1362,7 +1362,7 @@ schema: These examples apply to either input payloads of file uploads or response payloads. -A `requestBody` for submitting a file in a `POST` operation, however, may look like the following example: +A `requestBody` for submitting a file in a `POST` operation may look like the following example: ```yaml requestBody: @@ -1409,7 +1409,7 @@ requestBody: properties: {} ``` -In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when being passed to the server. In addition, the `address` field complex object will be stringified. +In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. From ecefdda207be27985d97f6ea5d2df50285daba1a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 09:53:39 -0700 Subject: [PATCH 0419/1801] remove 'the' --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2a6ba4e927..c4a04cf5bd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -167,7 +167,7 @@ Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. -Relative references used in `$ref` are processed as per the [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). +Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). ### Schema From 8bf54ca0ae6e67ac43e606decb78580c2cfa8449 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 16:14:04 -0700 Subject: [PATCH 0420/1801] edit Encoding Object --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..ce1811b3f5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1465,9 +1465,9 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The Content-Type to use for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. Note `Content-Type` is described separately and will be ignored from this section. -style | `string` | Describes how a specific property value will be serialized depending on its type . See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values allowed for `query` parameters, including default values. +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. +headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and ignored in this section. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From c06f8b9f1782092715dc79a8744b02a9351e5eae Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 20:26:03 -0700 Subject: [PATCH 0421/1801] edit Responses Object --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..a0f1647376 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1517,8 +1517,8 @@ requestBody: A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. -It is not expected for the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. -However, it is expected for the documentation to cover a successful operation response and any known errors. +The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. @@ -1529,7 +1529,7 @@ SHOULD be the response for a successful operation call. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's components/responses](#componentsResponses) section. +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A [Reference Object](#referenceObject) can link to a response that the [OpenAPI Object's components/responses](#componentsResponses) section defines. ##### Patterned Fields Field Pattern | Type | Description From 24e2beeae611624a3d43655da53b7ab950045248 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 20:42:06 -0700 Subject: [PATCH 0422/1801] edit Patterned Fields in Responses Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..13193f6cfc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1534,7 +1534,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be quoted for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined as well, the explicit code definition takes precedence over the range definition for that code. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined, the explicit code definition takes precedence over the range definition for that code. This object can be extended with [Specification Extensions](#specificationExtensions). From e772a2201fc8a27f9c6847f47ad85cd708de5a31 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 20:47:30 -0700 Subject: [PATCH 0423/1801] edit Reponses Object Example --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..6d4b632309 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1541,7 +1541,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Responses Object Example -A 200 response for successful operation and a default response for others (implying an error): +A 200 response for a successful operation and a default response for others that imply an error: ```json { From 654ddbb7a8ca3b32d5c57e97d09cf3ad0eed445d Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 20:53:01 -0700 Subject: [PATCH 0424/1801] noun-verb match --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6d4b632309..93a981a850 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1541,7 +1541,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Responses Object Example -A 200 response for a successful operation and a default response for others that imply an error: +A 200 response for a successful operation and a default response for others that implies an error: ```json { From dacd7ac50f8b8fe2f93cf39c928f67514319bbba Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 20:58:08 -0700 Subject: [PATCH 0425/1801] edit response-object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..ee3c641c1f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1591,7 +1591,7 @@ Describes a single response from an API Operation, including design-time, static Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). From 0f440bc08f134476d68fe17128f8ef59231d99ea Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 21:14:07 -0700 Subject: [PATCH 0426/1801] edit Callback Object --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..55afcf4f75 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1735,10 +1735,10 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Key Expression -The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be `$request.body#/url`. -However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed. -This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901). +The key that identifies the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL for the callback request. +A simple example is `$request.body#/url`. +However, using [variable substitution](#variableSubstitution) syntax, the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference. For example, given the following HTTP request: From e51c8abf973e72a2166fb5aa36bd1e594de9012f Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 21:18:46 -0700 Subject: [PATCH 0427/1801] add missing period --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 55afcf4f75..3f71c65927 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1729,7 +1729,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. This object can be extended with [Specification Extensions](#specificationExtensions). From f0c4e300a3485795e5ac5c604dcbc50b5f9864c3 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 21:33:45 -0700 Subject: [PATCH 0428/1801] edit Callback Object Example --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..ded85f64f1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1778,7 +1778,7 @@ $response.header.Location | http://example.org/subscription/1 ##### Callback Object Example -A callback to the URL specified by the `url` parameter in the request +The following example shows how to create a callback to the URL specified by the `url` parameter in the request: ```yaml From 80780939dd6437659e8e89e74a4c0c409b8f69af Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 21:43:38 -0700 Subject: [PATCH 0429/1801] edit Example Object --- versions/3.0.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..8ed800b4d3 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1804,15 +1804,14 @@ Field Name | Type | Description ---|:---:|--- summary | `string` | Short description for the example. description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. -externalValue | `string` | A URL that points to the literal example. This provides the ability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. +value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. This object can be extended with [Specification Extensions](#specificationExtensions). In all cases, the example value is expected to be compatible with the type schema -for the value that it is accompanying. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are not compatible. +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible. ##### Example Object Example From d825f56cfb0b048f273ef42c19f70c907b1a6201 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Mon, 12 Jun 2017 21:48:46 -0700 Subject: [PATCH 0430/1801] conform to original --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ded85f64f1..5d5d297185 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1778,7 +1778,7 @@ $response.header.Location | http://example.org/subscription/1 ##### Callback Object Example -The following example shows how to create a callback to the URL specified by the `url` parameter in the request: +The following example shows a callback to the URL specified by the `url` parameter in the request: ```yaml From 7c7d3e8a59de689e37e9b67d81c565335c7fabb4 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 09:00:06 -0700 Subject: [PATCH 0431/1801] edit Response Payload Values --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..37a5a70f2c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1908,8 +1908,8 @@ method for specifications with external references. Payload values are only available in parsable response payloads which match the advertised media type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an -empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is -required, and a parameter is not supplied, the client MAY choose to not follow the link definition. +empty value) and _not_ passed as a parameter to the linked resource. If a value is +required, and a parameter is not supplied, the client MAY choose not to follow the link definition. ##### Example @@ -1930,7 +1930,7 @@ lastname: Williams missingValue: null ``` -In situations where variables appear in an array, an array of variables will be extracted. +If variables appear in an array, an array of variables will be extracted. For example: ```json @@ -1947,7 +1947,7 @@ will be extracted as such: color: ["red", "green", "blue"] ``` -The variables generated can be used in locations prescribed by the definition. +The generated variables can be used in locations prescribed by the definition. ##### Variable Substitution From f3e44e243f9034c7c49e3ced481fa98059047a47 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 11:27:05 -0700 Subject: [PATCH 0432/1801] edit Header Object --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..cd83a1b3bd 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2285,7 +2285,7 @@ using JSON references. #### Header Object -The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes: +The Header Object follows the structure of the [Parameter Object](#parameterObject) with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. @@ -2293,7 +2293,7 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje ##### Header Object Example -A simple header with of an integer type: +A simple header of type integer: ```json { From 4f2c4a89350f6ee00ef97469e58ceb20da30f709 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 11:29:58 -0700 Subject: [PATCH 0433/1801] webron's change: remove obsolete sentence --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2736eb49ca..c08c637370 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -176,7 +176,6 @@ In the following description, if a field is not explicitly **Required** or descr #### OpenAPI Object This is the root document object for the API specification. -The OpenAPI object combines the Resource Listing and API Declaration from version 1.2 and earlier into one document. ##### Fixed Fields From fe26d415eebe4cd194dda6f0cdf28ef2d3dab8bf Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 11:42:11 -0700 Subject: [PATCH 0434/1801] edit Tab Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..a1dfa58b46 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2312,7 +2312,7 @@ schema: #### Tag Object -Allows adding meta data to a single tag that is used by the [Operation Object](#operationObject). +Adds metadata to a single tag that is used by the [Operation Object](#operationObject). It is not mandatory to have a Tag Object per tag used there. ##### Fixed Fields From 5810abf55c25c82b5e5860e7f239d43c04acadb8 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 14:41:28 -0700 Subject: [PATCH 0435/1801] Ron's change to Content-Type --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ce1811b3f5..70b409fa34 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1466,7 +1466,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and ignored in this section. +headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. From 7065b9e557a01b6a7f759fc04fa9ce21c8a75704 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 21:20:00 -0700 Subject: [PATCH 0436/1801] edit Tag Object Examples --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..172e0f99ad 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2340,15 +2340,15 @@ description: Pets operations #### Examples Object -Anywhere an `example` may be given, a JSON Reference MAY be used, with the +In an `example`, a JSON Reference MAY be used, with the explicit restriction that examples having a JSON format with object named -`$ref` are not allowed. This does mean that `example`, structurally, can be +`$ref` are not allowed. Therefore, that `example`, structurally, can be either a string primitive or an object, similar to `additionalProperties`. In all cases, the payload is expected to be compatible with the type schema -for the value that it is accompanying. Tooling implementations MAY choose to +for the associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if they -are not compatible. +are incompatible. ```yaml # in a model From 5c84bfd3bad9ef56c10d7dcec05ccfd69a7767e3 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 21:28:11 -0700 Subject: [PATCH 0437/1801] edit Reference Object --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..7f664a6879 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2402,7 +2402,7 @@ A simple object to allow referencing other components in the specification, inte The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. -For this specification, reference resolution is done as defined by the JSON Reference specification and not by the JSON Schema specification. +For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. ##### Fixed Fields Field Name | Type | Description From 7662ebb348dc718befdb1cb78b58ca9d3b8a2940 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 21:36:37 -0700 Subject: [PATCH 0438/1801] edit Schema Object --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..c4312837a9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2451,8 +2451,8 @@ The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). -Further information about the properties can be found in [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). -Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. +For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). +Unless stated otherwise, the property definitions follow the JSON Schema Specification Wright Draft 00. ##### Properties From cd634df5e1e071319dc5887068dfddf3f7f68b2c Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 22:00:14 -0700 Subject: [PATCH 0439/1801] edit Schema Object Properties and Fixed Fields --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..b5576df791 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2486,9 +2486,9 @@ The following properties are taken from the JSON Schema definition but their def - additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - description - [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. -- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, of `type` is `string`, then `default` can be `"foo"` but cannot be `1`. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. -Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions in place of defining them inline. +Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline. Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. @@ -2499,11 +2499,11 @@ Field Name | Type | Description ---|:---:|--- nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. -readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. -writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. -xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML format of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. -example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. This object can be extended with [Specification Extensions](#specificationExtensions). From 850a4f0975c79709affe55f96d9e4fdea3d20436 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 22:24:30 -0700 Subject: [PATCH 0440/1801] edit Composition and Inheritance --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..6c44c4519b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2511,15 +2511,15 @@ This object can be extended with [Specification Extensions](#specificationExtens ###### Composition and Inheritance (Polymorphism) The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. -`allOf` takes in an array of object definitions that are validated *independently* but together compose a single object. +`allOf` takes an array of object definitions that are validated *independently* but together compose a single object. While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field. -When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. +To support polymorphism, the OpenAPI Specification adds the `discriminator` field. +When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model. As such, the `discriminator` field MUST be a required field. There are are two ways to define the value of a discriminator for an inheriting instance. -- Use the schema's name. -- Override the schema's name by overriding the property with a new value. If exists, this takes precedence over the schema's name. +- Use the schema name. +- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. ###### XML Modeling From 152366670a98cdd9789c0909504e9c2992bbe4e3 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 22:46:09 -0700 Subject: [PATCH 0441/1801] edit Discriminator Object --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..dba30a83f9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2859,7 +2859,7 @@ components: When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. -Note, when using the discriminator, _inline_ schemas will not be considered when using the discriminator. +Note, when using the discriminator, _inline_ schemas will not be considered. ##### Fixed Fields Field Name | Type | Description @@ -2879,7 +2879,7 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' ``` -which means the paylod _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: +which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: ``` @@ -2919,11 +2919,11 @@ MyResponseType: monster: 'https://gigantic-server.com/schemas/Monster/schema.json' ``` -Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match a implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Note, mapping keys MUST be string values, but tooling MAY response values to strings for comparison. +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY map response values to strings for comparison. When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. -In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema. +In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema. For example: @@ -2967,7 +2967,7 @@ components: type: boolean ``` -a payload like this: +having a payload like this: ``` { From 5d0a96e6c0e09359d17e4dd9eba0c06fa4fbf7ee Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 22:51:00 -0700 Subject: [PATCH 0442/1801] undo last edit, remove missed Note --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index dba30a83f9..534b3831f9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2859,7 +2859,7 @@ components: When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. -Note, when using the discriminator, _inline_ schemas will not be considered. +When using the discriminator, _inline_ schemas will not be considered. ##### Fixed Fields Field Name | Type | Description @@ -2967,7 +2967,7 @@ components: type: boolean ``` -having a payload like this: +a payload like this: ``` { From 6c89e0ec6cf616891332a6e23c8a25ff6adc97df Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 23:04:13 -0700 Subject: [PATCH 0443/1801] edit XML Arrays --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..c918f82be0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3199,7 +3199,7 @@ animals: value ``` -Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally: +Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally: ```json { @@ -3231,7 +3231,7 @@ animals: ``` -To overcome the above example, the following definition can be used: +To overcome the naming problem in the example above, the following definition can be used: ```json { From 58004fddb97c78b200952e113813313f91f51c9f Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 23:18:17 -0700 Subject: [PATCH 0444/1801] edit all security sections --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2c9c85c356..c8f9404a5e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3343,7 +3343,7 @@ animals: #### Security Scheme Object -Allows the definition of a security scheme that can be used by the operations. +Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). ##### Fixed Fields @@ -3513,7 +3513,7 @@ The name used for each property MUST correspond to a security scheme declared in Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. -When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize. +When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. ##### Patterned Fields @@ -3566,15 +3566,15 @@ The extensions may or may not be supported by the available tooling, but those m ### Security Filtering -Some objects in the OpenAPI Specification MAY be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation. +Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation. -The reasoning behind it is to allow an additional layer of access control over the documentation itself. +The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization. -Two examples for this: +Two examples of this: 1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. -2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. ## Appendix A: Revision History From 018e2d21d1dbf0acc67f650d5ca1c231991ef15e Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Tue, 13 Jun 2017 23:22:38 -0700 Subject: [PATCH 0445/1801] wordsmithing --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index c8f9404a5e..7744ead32e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3574,7 +3574,7 @@ While not part of the specification itself, certain libraries MAY choose to allo Two examples of this: 1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. -2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. ## Appendix A: Revision History From ad75ef6e15ea09d5bf44114ffa1f6e89b183162a Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 07:01:34 -0700 Subject: [PATCH 0446/1801] there > in Operation Object instances --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index a1dfa58b46..4fb1b9fbd2 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2313,7 +2313,7 @@ schema: #### Tag Object Adds metadata to a single tag that is used by the [Operation Object](#operationObject). -It is not mandatory to have a Tag Object per tag used there. +It is not mandatory to have a Tag Object per tag used defined in the Operation Object instances. ##### Fixed Fields Field Name | Type | Description From 9751247fc94b5906a2e0ae421c3f77eeb57efbe7 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 07:05:44 -0700 Subject: [PATCH 0447/1801] add backticks --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd83a1b3bd..9f6f54100a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2293,7 +2293,7 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje ##### Header Object Example -A simple header of type integer: +A simple header of type `integer`: ```json { From 128a9ec5edad4bc935f7997daa383b5cbac17ec6 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 09:46:14 -0700 Subject: [PATCH 0448/1801] remove wording problem --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4fb1b9fbd2..d6cd4a6e75 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2313,7 +2313,7 @@ schema: #### Tag Object Adds metadata to a single tag that is used by the [Operation Object](#operationObject). -It is not mandatory to have a Tag Object per tag used defined in the Operation Object instances. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. ##### Fixed Fields Field Name | Type | Description From 2f4ce202a06c1a0c0347fb8fa51bb315710a9922 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 10:15:51 -0700 Subject: [PATCH 0449/1801] XML format > representation --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index b5576df791..204551b363 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2501,7 +2501,7 @@ Field Name | Type | Description discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. -xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML format of this property. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. From 38465fa7df7569df44a53db3fdce63d5d4fdaa07 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 10:20:08 -0700 Subject: [PATCH 0450/1801] remove Specification Write Draft 00 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index c4312837a9..838e696f8e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2452,7 +2452,7 @@ These types can be objects, but also primitives and arrays. This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). -Unless stated otherwise, the property definitions follow the JSON Schema Specification Wright Draft 00. +Unless stated otherwise, the property definitions follow the JSON Schema. ##### Properties From 3cac3f1fd80f6a56fa261af56e82d23c3e4fb5d0 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 10:26:09 -0700 Subject: [PATCH 0451/1801] put parenthetical back --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 93a981a850..66f5471d5c 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1541,7 +1541,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ##### Responses Object Example -A 200 response for a successful operation and a default response for others that implies an error: +A 200 response for a successful operation and a default response for others (implying an error): ```json { From 7db8cd4cdd1f961a66f52172227adae07b1a7f6f Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 10:50:53 -0700 Subject: [PATCH 0452/1801] add allowed wildcard ranges --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 13193f6cfc..1dd2723dd0 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1534,7 +1534,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks for compatibility between JSON and YAML (i.e. "200"), and MAY contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. If a response range is defined, and an explicit code within that range is defined, the explicit code definition takes precedence over the range definition for that code. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. This object can be extended with [Specification Extensions](#specificationExtensions). From 1f7bc507b0ce0833bb0cf2ca9bea82bb018bfaea Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 11:12:58 -0700 Subject: [PATCH 0453/1801] change my mistaken wording to 'control over the serialization of parts of ... --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 93c1155eee..d3ec5bd5d1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1456,7 +1456,7 @@ requestBody: type: '#/components/schemas/Address' ``` -An `encoding` attribute is introduced to give you more control than boundaries provides over the Content-Type for `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. #### Encoding Object From 5ed43075e9a070c5e13a148fab9fbfa48040dabd Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 14 Jun 2017 14:13:04 -0400 Subject: [PATCH 0454/1801] Document how OAS uses semantic versioning (semver). The specification itself is versioned using semver, so a new top level section describes specification versioning, what OAS 3.0 means, how patch levels are used, and how tools use the version. The `openapi` field in the root object is a semver string that identifies which OAS the definition file uses and conforms to. Added a definition of "OpenAPI definition file" to the Definitions section. Removed the "OpenAPI Version String" section as it is not needed: info about the `openapi` field is in the table, and info about the spec version is in the OpenAPI Version section. --- versions/3.0.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index cc72ea51b4..7b6e7e4a75 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -20,10 +20,12 @@ Additional utilities, such as testing tools, can also use the files. - [Definitions](#definitions) + - [OpenAPI Definition File](#oasDefinitionFile) - [Path Templating](#pathTemplating) - [Media Types](#mediaTypes) - [HTTP Status Codes](#httpCodes) - [Specification](#specification) + - [Versions](#versions) - [Format](#format) - [File Structure](#fileStructure) - [Data Types](#dataTypes) @@ -68,6 +70,9 @@ Additional utilities, such as testing tools, can also use the files. ## Definitions +##### OpenAPI Definition File +A file or set of files which defines an API. The OpenAPI definition file uses and conforms to the OpenAPI Specification. + ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. @@ -94,6 +99,17 @@ The available status codes are defined by [RFC7231](http://tools.ietf.org/html/r ## Specification +### Versions + +The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. +This document specifies OpenAPI Specification version `3.0.0-rc2`. + +The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. + +Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. + +An OpenAPI definition file compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 definition document contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) + ### Format An API description that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. @@ -120,7 +136,7 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA ### File Structure -The OAS representation of the API is made of a single file. +An OpenAPI definition file is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. @@ -141,7 +157,6 @@ Types that are not accompanied by a `format` property follow the type definition The formats defined by the OAS are: - Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments ----------- | ------ | -------- | -------- integer | `integer` | `int32` | signed 32 bits @@ -173,13 +188,13 @@ In the following description, if a field is not explicitly **REQUIRED** or descr #### OpenAPI Object -This is the root document object for the API specification. +This is the root document object of the [OpenAPI definition file](#oasDefinitionFile). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. Specifies the OpenAPI Specification version being used. It can be used by tooling specifications and clients to interpret the version. The structure SHALL be `major`.`minor`.`patch`, where `patch` versions MUST be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling SHOULD typically be compatible with the corresponding `major`.`minor` (3.0.\*). Patch versions will correspond to patches of this document. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition file uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition document. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. @@ -190,15 +205,6 @@ Field Name | Type | Description This object can be extended with [Specification Extensions](#specificationExtensions). -#### OpenAPI Version String - -The version string signifies which OpenAPI Specification version the document complies to. The format for this string MUST be `major`.`minor`.`patch`. The `patch` MAY be suffixed by a hyphen and extra alphanumeric characters. - -A `major`.`minor` SHALL be used to designate the OpenAPI Specification version, and will be considered compatible with the OpenAPI Specification specified by that `major`.`minor` version. The patch version will not be considered by tooling, making no distinction between `3.0.0` and `3.0.1`. - -In subsequent versions of the OpenAPI Specification, care will be given such that increments of the `minor` version SHOULD NOT interfere with operations of tooling developed to a lower minor version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. - - #### Info Object The object provides metadata about the API. @@ -213,7 +219,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the OpenAPI Specification version or the API implementation version). +version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). This object can be extended with [Specification Extensions](#specificationExtensions). From d8929f0d3d16dc25fd9ae325dbfe82d35f8270c1 Mon Sep 17 00:00:00 2001 From: Kristine Hahn Date: Wed, 14 Jun 2017 11:24:13 -0700 Subject: [PATCH 0455/1801] clarify behavior is n/a --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 20ae0c3c0e..3af17c50e7 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -969,7 +969,7 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. - allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, if behavior is `n/a`, the value of `allowEmptyValue` SHALL be ignored. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. From 2bbd6d219854d36c00809c3697de19876e410312 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Wed, 14 Jun 2017 14:25:04 -0400 Subject: [PATCH 0456/1801] tweak wording --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7b6e7e4a75..905b98919e 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -194,7 +194,7 @@ This is the root document object of the [OpenAPI definition file](#oasDefinition Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition file uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition document. This is *not* related to the API [`info.version`](#infoVersion) string. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition file uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition file. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. From fbaf8aa5d8b80c85b565bb25e0426d424775c695 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 15 Jun 2017 01:05:23 +0100 Subject: [PATCH 0457/1801] Allow apiKey in cookie refs #15 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..2623fb1cc5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3350,7 +3350,7 @@ Field Name | Type | Validity | Description type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. name | `string` | `apiKey` | **REQUIRED**. The name of the header or query parameter to be used. -in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"` or `"header"`. +in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-4.2). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. From 97951b1cc8ddfec98f9fc15f71d3f7fc267d5915 Mon Sep 17 00:00:00 2001 From: Brendan Abbott Date: Thu, 15 Jun 2017 13:30:56 +1000 Subject: [PATCH 0458/1801] Update link to RFC7235 section in Security Scheme --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..599e78e175 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3351,7 +3351,7 @@ Field Name | Type | Validity | Description description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. name | `string` | `apiKey` | **REQUIRED**. The name of the header or query parameter to be used. in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"` or `"header"`. -scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-4.2). +scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. From f67bcffe1e1049b135df5f3a15626e4099f079e6 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 14 Jun 2017 23:37:47 -0700 Subject: [PATCH 0459/1801] no more red --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..93bbfd1fac 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -102,7 +102,7 @@ For example, if a field has an array value, the JSON array representation will b ```json { - "field": [...] + "field": [ 1, 2, 3 ] } ``` All field names in the specification are **case sensitive**. From 9a9ef7a6d74ddffbbc3862abca7c58bfa7907d57 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 14 Jun 2017 23:54:39 -0700 Subject: [PATCH 0460/1801] Clarified path matching --- versions/3.0.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..5b471c4b30 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -632,10 +632,33 @@ The path is appended to the URL from the [`Server Object`](#serverObject) in ord Field Pattern | Type | Description ---|:---:|--- -/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. This object can be extended with [Specification Extensions](#specificationExtensions). +##### Path Templating Matching + +Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used: + +``` + /pets/{petId} + /pets/mine +``` + +The following paths are considered identical and invalid: + +``` + /pets/{petId} + /pets/{name} +``` + +The following may lead to ambiguous resolution: + +``` + /{entity}/me + /books/{id} +``` + ##### Paths Object Example ```json From 3f72b7ad3ffa9d504e4dd8d058080e2ff3765a54 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 15 Jun 2017 07:18:23 -0700 Subject: [PATCH 0461/1801] added full example, link --- examples/v3.0/callback-example.yaml | 56 +++++++++++++++++++++++++++++ versions/3.0.md | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 examples/v3.0/callback-example.yaml diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml new file mode 100644 index 0000000000..8db4568022 --- /dev/null +++ b/examples/v3.0/callback-example.yaml @@ -0,0 +1,56 @@ +paths: + /streams: + post: + description: subscribes a client to receive out-of-band data + parameters: + - name: callbackUrl + in: query + required: true + description: | + the location where data will be sent. Must be network accessible + by the source server + schema: + type: string + format: uri + example: https://tonys-server.com + responses: + 201: + description: subscription successfully created + content: + application/json: + schema: + description: subscription information + required: + - subscriptionId + properties: + subscriptionId: + description: this unique identifier allows management of the subscription + type: string + example: 2531329f-fb09-4ef7-887e-84e648214436 + callbacks: + # the name `onData` is a convenience locator + onData: + # when data is sent, it will be sent to the `callbackUrl` provided + # when making the subscription PLUS the suffix `/data` + $request.query.callbackUrl/data: + post: + requestBody: + description: subscription payload + content: + application/json: + schema: + properties: + timestamp: + type: string + format: date-time + userData: + $ref: '#/components/schemas/UserLogData' + responses: + 202: + description: | + Your server implementation should return this HTTP status code + if the data was received successfully + 204: + description: | + Your server should return this HTTP status code if no longer interested + in further updates diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..81e464930b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1728,7 +1728,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A full example may be found at https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/examples/v3.0/callback-example.yaml This object can be extended with [Specification Extensions](#specificationExtensions). From e459cb18cdc506fd8f778ba10d6e49a7db14d2f2 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 15 Jun 2017 08:03:19 -0700 Subject: [PATCH 0462/1801] Quoted numeric keys --- examples/v3.0/callback-example.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index 8db4568022..54c310eb01 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -46,11 +46,11 @@ paths: userData: $ref: '#/components/schemas/UserLogData' responses: - 202: + '202': description: | Your server implementation should return this HTTP status code if the data was received successfully - 204: + '204': description: | Your server should return this HTTP status code if no longer interested in further updates From a845c008d5b8d887804115eefb169c31e409c5a5 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 15 Jun 2017 12:06:17 -0400 Subject: [PATCH 0463/1801] Updates based comments. --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index c38b5b4f26..6c467c84f5 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1752,7 +1752,7 @@ Content-Length: 123 { "failedUrl" : "http://clientdomain.com/failed" - "successUrls : [ + "successUrls" : [ "http://clientdomain.com/fast", "http://clientdomain.com/medium", "http://clientdomain.com/slow" @@ -1779,12 +1779,12 @@ $response.header.Location | http://example.org/subscription/1 ##### Callback Object Example -A callback to the URL specified by the `url` property in the request body. +A callback to the URL specified by the `id` and `email` property in the request body. ```yaml myWebhook: - 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}}': + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': post: requestBody: description: Callback payload @@ -1884,15 +1884,15 @@ The presence of a link does not guarantee the caller's ability to successfully i As opposed to _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. -For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in a response and using them as parameters while invoking the linked operation. +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition. +operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string` \| Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. From 406e63adc86553da9a6f2cd3f6e1b63f3e37b068 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Thu, 15 Jun 2017 09:09:13 -0700 Subject: [PATCH 0464/1801] Create callback-example.yaml --- examples/v3.0/callback-example.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index 54c310eb01..426ee39a76 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -14,7 +14,7 @@ paths: format: uri example: https://tonys-server.com responses: - 201: + '201': description: subscription successfully created content: application/json: From d4f91e86e0af5c83b6149a15951664825571e956 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 15 Jun 2017 18:20:20 +0100 Subject: [PATCH 0465/1801] Update apiKey name field description --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index e773821d05..149d7cc024 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3372,7 +3372,7 @@ Field Name | Type | Validity | Description ---|:---:|---|--- type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -name | `string` | `apiKey` | **REQUIRED**. The name of the header or query parameter to be used. +name | `string` | `apiKey` | **REQUIRED**. The name of the header, query or cookie parameter to be used. in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. From 72d15fd2498f2d935cd9a74afdb6412bf6357c95 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 15 Jun 2017 14:22:07 -0400 Subject: [PATCH 0466/1801] Updates based on TDC Call --- versions/3.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6c467c84f5..ec834c7641 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1954,7 +1954,7 @@ paths: description: the user's address ``` -When a runtime expression evaluates to null, no parameter value is passed to the target operation. +When a runtime expression fails to evaluate, no parameter value is passed to the target operation. Values from the response body can be used to drive a linked operation. @@ -1981,7 +1981,7 @@ value), references MAY also be made through a relative `operationRef`: links: UserRepositories: # returns array of '#/components/schemas/repository' - operationRef: '#paths~12.0~1repositories~1/{username}' + operationRef: '#/paths~12.0~1repositories~1/{username}/get' parameters: username: $response.body#/username ``` @@ -1992,7 +1992,7 @@ or an absolute `operationRef`: links: UserRepositories: # returns array of '#/components/schemas/repository' - operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get' parameters: username: $response.body#/username ``` @@ -2009,7 +2009,7 @@ This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#ca The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax ``` - expression = ( "$url" | "$method" | "$request." [ source ] | "$response." [ source ]) + expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source ) source = ( header-reference | query-reference | path-reference | body-reference ) header-reference = "header." token query-reference = "query." name @@ -2028,7 +2028,7 @@ The table below provides examples of runtime expressions and examples of their u ##### Examples Source Location | example expression | notes ----|:---|:---|:--- +---|:---|:---| HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation Requested media type | `$request.header.accept` | Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section for the parent operation or they cannot be evaluated. This includes request headers. From b00d0818c6d7e680b35b8282130c64b932dad1dc Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 14:34:08 -0700 Subject: [PATCH 0467/1801] Clarified multi media types --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index d83f57acce..588def448a 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -989,7 +989,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. The map MUST only contain one entry. ##### Style Values @@ -1153,7 +1153,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1464,7 +1464,7 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. @@ -1591,7 +1591,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). From 95d78c808e8ecf38c1e6e5109e6b54df816c87e4 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 17:01:24 -0700 Subject: [PATCH 0468/1801] multipart clarifications --- versions/3.0.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e773821d05..cd524a6aa1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1298,7 +1298,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHOULD only apply to `requestBody` objects when the content type is `multipart`. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the content type is `multipart` or `x-www-form-urlencoded`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1367,8 +1367,7 @@ application/json: ##### Considerations for File Uploads -In contrast with the 2.0 specification, `file` input/output content in OpenAPI is -described with the same semantics as any other schema type. Specifically: +In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: ```yaml # content transferred with base64 encoding @@ -1410,6 +1409,23 @@ requestBody: format: binary ``` +To upload multiple files, a `multipart` media type MUST be used: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + properties: + # The property name 'file' will be used for all files. + file: + type: array + items: + type: string + format: binary + +``` + ##### Support for x-www-form-urlencoded Request Bodies To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following @@ -1433,7 +1449,7 @@ requestBody: In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. -When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`. +When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. ##### Special Considerations for `multipart` Content @@ -1488,10 +1504,10 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. -headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. -style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. -explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. -allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. +headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. This object can be extended with [Specification Extensions](#specificationExtensions). From e5919e9e5b2efa1ca8bb8d73bef54219d600d06d Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 15 Jun 2017 17:11:46 -0700 Subject: [PATCH 0469/1801] clarified wording for #1121 --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e773821d05..8eeb2930dc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2759,8 +2759,8 @@ components: "Pet": { "type": "object", "discriminator": { - "propertyName": "petType" - }, + "propertyName": "petType" + }, "properties": { "name": { "type": "string" @@ -2940,7 +2940,7 @@ MyResponseType: monster: 'https://gigantic-server.com/schemas/Monster/schema.json' ``` -Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY map response values to strings for comparison. +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison. When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. From 870405ff4d48e062351e3051ead48d43cd5a63d0 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 15 Jun 2017 17:13:43 -0700 Subject: [PATCH 0470/1801] spaces are better --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8eeb2930dc..6b58afba79 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2759,8 +2759,8 @@ components: "Pet": { "type": "object", "discriminator": { - "propertyName": "petType" - }, + "propertyName": "petType" + }, "properties": { "name": { "type": "string" From c9a00d7a86a08d07e1a5f08c4664d3e4d6eea1c7 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 17:38:27 -0700 Subject: [PATCH 0471/1801] wording update --- versions/3.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 588def448a..623fcfb3f6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -989,7 +989,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. The map MUST only contain one entry. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. The map MUST only contain one entry. ##### Style Values @@ -1153,7 +1153,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1464,7 +1464,7 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. @@ -1591,7 +1591,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. The key can be a single media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). From a34ff4018885c45fb937fce8195abb039d60e8ab Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 17:45:27 -0700 Subject: [PATCH 0472/1801] fixed example --- versions/3.0.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6b58afba79..6691a128f9 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -850,7 +850,9 @@ This object can be extended with [Specification Extensions](#specificationExtens "in": "path", "description": "ID of pet that needs to be updated", "required": true, - "type": "string" + "schema": { + "type": "string" + } } ], "requestBody": { @@ -910,7 +912,8 @@ parameters: in: path description: ID of pet that needs to be updated required: true - type: string + schema: + type: string requestBody: content: 'application/x-www-form-urlencoded': From 104529c4c5ce2bcd2b69779a5791e48111dac927 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 17:57:57 -0700 Subject: [PATCH 0473/1801] added example --- versions/3.0.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/versions/3.0.md b/versions/3.0.md index 6b58afba79..c3a2584db3 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1168,6 +1168,51 @@ schema: style: form ``` +A complex parameter using `content` to define serialization: + +```json +{ + "in": "query", + "name": "coordinates", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "lat", + "long" + ], + "properties": { + "lat": { + "type": "number" + }, + "long": { + "type": "number" + } + } + } + } + } +} +``` + +```yaml +in: query +name: coordinates +content: + application/json: + schema: + type: object + required: + - lat + - long + properties: + lat: + type: number + long: + type: number +``` + #### Request Body Object Describes a single request body. From cb8e15715f1153352af861f2d77e8313a784c785 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 15 Jun 2017 18:12:02 -0700 Subject: [PATCH 0474/1801] Fixed table headers --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 6b58afba79..6554d5aea1 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3368,7 +3368,7 @@ Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code). ##### Fixed Fields -Field Name | Type | Validity | Description +Field Name | Type | Applies To | Description ---|:---:|---|--- type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. @@ -3475,7 +3475,7 @@ This object can be extended with [Specification Extensions](#specificationExtens Configuration details for a supported OAuth Flow ##### Fixed Fields -Field Name | Type | Validity | Description +Field Name | Type | Applies To | Description ---|:---:|---|--- authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. From 98a8692bc13492833e657f0eb3718b90b5750d28 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 07:41:54 -0700 Subject: [PATCH 0475/1801] content type -> media type --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index cd524a6aa1..5a6ed41386 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1298,7 +1298,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the content type is `multipart` or `x-www-form-urlencoded`. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `x-www-form-urlencoded`. This object can be extended with [Specification Extensions](#specificationExtensions). From c65e232b1520c5020bff0c7a9ea65eb7241c280b Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 07:48:33 -0700 Subject: [PATCH 0476/1801] fixed example --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 5a6ed41386..25e72dd162 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1434,7 +1434,7 @@ definition may be used: ```yaml requestBody: content: - x-www-form-urlencoded: + application/x-www-form-urlencoded: schema: type: object properties: From 6bfbe5d0bef7a020c991c3edb743c57b5b3f2052 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 07:51:03 -0700 Subject: [PATCH 0477/1801] x-www-form-urlencoded -> application/x-www-form-urlencoded --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 25e72dd162..8356b25afa 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1298,7 +1298,7 @@ Field Name | Type | Description schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. -encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `x-www-form-urlencoded`. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -1449,7 +1449,7 @@ requestBody: In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. -When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. +When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. ##### Special Considerations for `multipart` Content @@ -1494,7 +1494,7 @@ requestBody: type: '#/components/schemas/Address' ``` -An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `x-www-form-urlencoded` request bodies. +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `application/x-www-form-urlencoded` request bodies. #### Encoding Object @@ -1505,9 +1505,9 @@ Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. -style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. -explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. -allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `x-www-form-urlencoded`. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. This object can be extended with [Specification Extensions](#specificationExtensions). From 9cf27781fa452ad2d0a4d57e806fd8ecbae529c4 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 11:49:21 -0400 Subject: [PATCH 0478/1801] Fixed runtime expression in callback example --- examples/v3.0/callback-example.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index 426ee39a76..c698b9704c 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -32,7 +32,7 @@ paths: onData: # when data is sent, it will be sent to the `callbackUrl` provided # when making the subscription PLUS the suffix `/data` - $request.query.callbackUrl/data: + {$request.query.callbackUrl}/data: post: requestBody: description: subscription payload From 567a5199cbee7542eb6982d38fcfa636dae44eb6 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Fri, 16 Jun 2017 12:12:54 -0400 Subject: [PATCH 0479/1801] Remove restatement of this being 3.0.0-rc2 --- versions/3.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 905b98919e..ad0b1f8a74 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -102,7 +102,6 @@ The available status codes are defined by [RFC7231](http://tools.ietf.org/html/r ### Versions The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. -This document specifies OpenAPI Specification version `3.0.0-rc2`. The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. From bd0ff8be74202fe1f46f550e74a8b9b9033062f6 Mon Sep 17 00:00:00 2001 From: "Rob Dolin (MSFT)" Date: Fri, 16 Jun 2017 09:38:42 -0700 Subject: [PATCH 0480/1801] [Contributors] Add contributors with >25 PRs Addresses #1156 --- CONTRIBUTORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4a2f1256fc..817f37a53d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,7 +1,9 @@ * Darrel Miller [@darrelmiller](https://github.com/darrelmiller) * Jason Harmon [@jharmn](https://github.com/jharmn) * Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Kris Hahn [@KrisHahn](https://github.com/krishahn) * Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Mike Ralphson [@MikeRalphson](https://github.com/mikeralphson) * Rob Dolin [@RobDolinMS](https://github.com/robdolinms) * Ron Ratovsky [@webron](https://github.com/webron) * Tony Tam [@fehguy](https://github.com/fehguy) From f854739d0c9128365f7dfceeaf9aa13f1f625c9d Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 10:11:46 -0700 Subject: [PATCH 0481/1801] multipart/* -> multipart --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 8356b25afa..7ced7635af 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1455,7 +1455,7 @@ When passing complex objects in the `application/x-www-form-urlencoded` content It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads. -When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart/*`: +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart`: * If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` * If the property is complex, or an array of complex values, the default Content-Type is `application/json` @@ -1494,7 +1494,7 @@ requestBody: type: '#/components/schemas/Address' ``` -An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart/*` and `application/x-www-form-urlencoded` request bodies. +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart` and `application/x-www-form-urlencoded` request bodies. #### Encoding Object From 54a23031c81e0185c4a6e995dbf1862120689aee Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 15:31:39 -0400 Subject: [PATCH 0482/1801] Fixed ambuiguity with link parameters Also added support for passing requestbody --- versions/3.0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2147705183..022f9634b6 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1979,7 +1979,8 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location '[{location}.]{name}' for operations that use the same parameter name in different locations. e.g. path.id +requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression)] to use as a request body when calling the target operation. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. From e1c7e57e5136112efc9834e14f46ca59d8871d3b Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 16:16:20 -0400 Subject: [PATCH 0483/1801] Fixed link parameter stuff --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 022f9634b6..ba35aaa7eb 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1979,7 +1979,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location '[{location}.]{name}' for operations that use the same parameter name in different locations. e.g. path.id +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression)] to use as a request body when calling the target operation. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | a server object to be used by the target operation. From aa70aec00aa712ad7caede1c43b093f7157faf6c Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 16:29:11 -0400 Subject: [PATCH 0484/1801] Update to force refresh --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index ba35aaa7eb..397933f26f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1978,7 +1978,7 @@ For computing links, and providing instructions to execute them, a [runtime expr Field Name | Type | Description ---|:---:|--- operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to an [Operation Object](#operationObject). -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. +operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression)] to use as a request body when calling the target operation. description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). From 556dda715f6ded6dcf4ecce735b3db3bdc066407 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 14:08:04 -0700 Subject: [PATCH 0485/1801] Revert 'content' changes --- versions/3.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 623fcfb3f6..2ea6e6c339 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -989,7 +989,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. The map MUST only contain one entry. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. ##### Style Values @@ -1153,7 +1153,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1591,7 +1591,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. The key can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object can be extended with [Specification Extensions](#specificationExtensions). From b19ae267a22f0722298656304b33be528d123961 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 17:09:38 -0400 Subject: [PATCH 0486/1801] Grammar fixes copied from Kris' PRs --- versions/3.0.md | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2147705183..240fe13107 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1852,7 +1852,7 @@ Content-Length: 123 Location: http://example.org/subscription/1 ``` -Here are the examples of how the various expressions evaluate, assuming a the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. +The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. Expression | Value ---|:--- @@ -1969,7 +1969,7 @@ schemas: The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. -As opposed to _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime. +Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. @@ -1977,18 +1977,18 @@ For computing links, and providing instructions to execute them, a [runtime expr Field Name | Type | Description ---|:---:|--- -operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and MUST point to an [Operation Object](#operationObject). -operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. +operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). +operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. -description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/). -server | [Server Object](#serverObject) | a server object to be used by the target operation. +description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). +server | [Server Object](#serverObject) | A server object to be used by the target operation. This object can be extended with [Specification Extensions](#specificationExtensions). Locating a linked resource MAY be performed by either a `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, consider the `operationRef` syntax as the preferred -method for specifications with external references. +Because of the potential for name clashes, the `operationRef` syntax is preferred +for specifications with external references. ##### Examples @@ -2053,8 +2053,8 @@ links: userUuid: $response.body#/uuid ``` -As with all links, it is at the clients' discretion to follow them, neither -permissions nor the ability to make a successful call to that link is guaranteed +Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship. @@ -2100,7 +2100,7 @@ The runtime expression is defined by the following [ABNF](https://tools.ietf.org header-reference = "header." token query-reference = "query." name path-reference = "path." name - body-reference = "body#" fragment + body-reference = "body" ["#" fragment] fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) name = *( char ) char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) @@ -2115,21 +2115,16 @@ The table below provides examples of runtime expressions and examples of their u Source Location | example expression | notes ---|:---|:---| -HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation +HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. Requested media type | `$request.header.accept` | -Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section for the parent operation or they cannot be evaluated. This includes request headers. -Request body property | `$request.body#/user/uuid` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself +Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. +Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. Request URL | `$url` | -Response value | `$response.body#/status` | Only the payload in the response can be accessed with the `$response` syntax. +Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. Response header | `$response.header.Server` | Single header values only are available Runtime expressions preserve the type of the referenced value. -Expression values can be embeded into string values by surrounding the expression with `{}` curly braces. - -`$request.body`and `$response.body`expressions are only available in payloads which that can be accessed using a JSON Pointer. -If a value does _not_ exist, the result of the expression will be considered a `null` value (as opposed to an empty value). - - +Expressions can be embeded into string values by surrounding the expression with `{}` curly braces. #### Header Object From 111f7543f65026d14a2d22ad40455ddef79d9e93 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 14:19:00 -0700 Subject: [PATCH 0487/1801] brought uniqueness back --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 4eb1e17ef3..8086d44755 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1020,7 +1020,7 @@ When `example` or `examples` are provided in conjunction with the `schema` objec Field Name | Type | Description ---|:---:|--- -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. ##### Style Values From 7d76b424ff6dd4b77cfe898d871a8561d17ca09a Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 17:36:31 -0400 Subject: [PATCH 0488/1801] Fixed a bonus ] --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 240fe13107..1448320633 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1979,7 +1979,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression) | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | A server object to be used by the target operation. From 88db84421b08cf5b526489e9d2d00981d2739167 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 16 Jun 2017 19:28:21 -0400 Subject: [PATCH 0489/1801] Updated callback example link --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 2147705183..4d09572805 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1820,7 +1820,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A full example may be found at https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/examples/v3.0/callback-example.yaml +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/examples/v3.0/callback-example.yaml) is available. This object can be extended with [Specification Extensions](#specificationExtensions). From 57ac22bd6a98bd194c88c14e65723ea1724271e6 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 16 Jun 2017 16:33:56 -0700 Subject: [PATCH 0490/1801] modified revision history --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index 12515bb7a0..95d382c1f4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -3424,6 +3424,7 @@ Two examples of this: Version | Date | Notes --- | --- | --- +3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification 3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification 3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification 2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative From f2ccf07f36bf7d68c0573ddfce8c9556ccc83f1d Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 18 Jun 2017 13:44:05 +0100 Subject: [PATCH 0491/1801] Update intro wording, OAS definition [file] fixup --- versions/3.0.md | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..b07a32c946 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,26 +8,22 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) is a project that provides mechanisms to describe and document a RESTful API. +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. - -The OpenAPI Specification defines a set of files required to describe such APIs. -These files can then be used by documentation generation tools to display the API and code generation tools to generate clients in various programming languages. - -Additional utilities, such as testing tools, can also use the files. +An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. ## Table of Contents - [Definitions](#definitions) - - [OpenAPI Definition File](#oasDefinitionFile) + - [OpenAPI Definition](#oasDefinition) - [Path Templating](#pathTemplating) - [Media Types](#mediaTypes) - [HTTP Status Codes](#httpCodes) - [Specification](#specification) - [Versions](#versions) - [Format](#format) - - [File Structure](#fileStructure) + - [Document Structure](#documentStructure) - [Data Types](#dataTypes) - [Rich Text Formatting](#richText) - [Relative References In URLs](#relativeReferences) @@ -70,8 +66,8 @@ Additional utilities, such as testing tools, can also use the files. ## Definitions -##### OpenAPI Definition File -A file or set of files which defines an API. The OpenAPI definition file uses and conforms to the OpenAPI Specification. +##### OpenAPI Definition +A document or set of documents which defines an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. @@ -107,7 +103,7 @@ The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate th Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. -An OpenAPI definition file compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 definition document contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) +An OpenAPI definition compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 definition documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) ### Format @@ -133,13 +129,13 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA **Note:** While APIs are described by OpenAPI documents in YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. -### File Structure +### Document Structure -An OpenAPI definition file is made of a single file. -However, parts of the definitions can be split into separate files, at the discretion of the user. +An OpenAPI definition MAY be made up of a single document. +However, parts of the definitions MAY be split into separate documents, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -It is RECOMMENDED that the OpenAPI definition file be named following convention: `openapi.json` or `openapi.yaml`. +It is RECOMMENDED that the root OpenAPI definition document be named: `openapi.json` or `openapi.yaml`. ### Data Types @@ -187,13 +183,13 @@ In the following description, if a field is not explicitly **REQUIRED** or descr #### OpenAPI Object -This is the root document object of the [OpenAPI definition file](#oasDefinitionFile). +This is the root document object of the [OpenAPI definition](#oasDefinition). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition file uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition file. This is *not* related to the API [`info.version`](#infoVersion) string. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. @@ -2267,7 +2263,7 @@ This object cannot be extended with additional properties and any properties add $ref: '#/components/schemas/Pet' ``` -##### Relative Schema File Example +##### Relative Schema Document Example ```json { "$ref": "Pet.json" @@ -2278,7 +2274,7 @@ $ref: '#/components/schemas/Pet' $ref: Pet.yaml ``` -##### Relative Files With Embedded Schema Example +##### Relative Documents With Embedded Schema Example ```json { "$ref": "definitions.json#/Pet" From d7f8adb254fdd39f6feca7828357b408d0c1eed5 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 18 Jun 2017 11:56:54 +0100 Subject: [PATCH 0492/1801] Make callback example link relative --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..d2c5952ac4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1820,7 +1820,7 @@ The key value used to identify the callback object is an expression, evaluated a ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/examples/v3.0/callback-example.yaml) is available. +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available. This object can be extended with [Specification Extensions](#specificationExtensions). From 0a5b58e8736768470d23f336dbb5bd028d5a53b0 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Mon, 19 Jun 2017 17:40:22 -0400 Subject: [PATCH 0493/1801] Fix callback-example.yaml The runtime expression [must be quoted](http://www.yaml.org/spec/1.2/spec.html#id2788859) as it starts with a '{' - an [indicator character](http://www.yaml.org/spec/1.2/spec.html#c-indicator) Also added 'openapi' and 'info' properties because they are required and, thus, the spec file is invalid without them. --- examples/v3.0/callback-example.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index c698b9704c..d6ff92af80 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -1,3 +1,7 @@ +openapi: 3.0.0 +info: + title: Callback Example + version: 1.0.0 paths: /streams: post: @@ -32,7 +36,7 @@ paths: onData: # when data is sent, it will be sent to the `callbackUrl` provided # when making the subscription PLUS the suffix `/data` - {$request.query.callbackUrl}/data: + '{$request.query.callbackUrl}/data': post: requestBody: description: subscription payload From 4a1c864ab2e265dbef4bfddda3f4def5c2639193 Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Fri, 23 Jun 2017 14:08:21 +0300 Subject: [PATCH 0494/1801] Fixed a typo: embeded -> embedded --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..391fd845d8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2125,7 +2125,7 @@ Response value | `$response.body#/status` | In operations which r Response header | `$response.header.Server` | Single header values only are available Runtime expressions preserve the type of the referenced value. -Expressions can be embeded into string values by surrounding the expression with `{}` curly braces. +Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. #### Header Object From b3475959b52b6a619bffcf712fd9c5e26e9a6f0d Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Fri, 23 Jun 2017 14:10:29 +0300 Subject: [PATCH 0495/1801] Fixed missing comma in JSON request example in "Key Expression" --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..eb948b1fda 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1840,7 +1840,7 @@ Content-Type: application/json Content-Length: 123 { - "failedUrl" : "http://clientdomain.com/failed" + "failedUrl" : "http://clientdomain.com/failed", "successUrls" : [ "http://clientdomain.com/fast", "http://clientdomain.com/medium", From 3555c1176065ea82c3c8c948a254b93fec5fd6b6 Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Fri, 23 Jun 2017 14:27:03 +0300 Subject: [PATCH 0496/1801] Updated Content-Length to match the actual payload length --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index eb948b1fda..a320fa73d4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1837,7 +1837,7 @@ For example, given the following HTTP request: POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 Host: example.org Content-Type: application/json -Content-Length: 123 +Content-Length: 187 { "failedUrl" : "http://clientdomain.com/failed", From b610cf6c5990f44109c6eb4efb781dd8fa86c294 Mon Sep 17 00:00:00 2001 From: Eric Wittmann Date: Mon, 26 Jun 2017 13:53:16 -0400 Subject: [PATCH 0497/1801] Fixed an invalid example (Encoding Object Example) --- versions/3.0.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..c373bdde9b 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1599,8 +1599,9 @@ requestBody: contentType: image/png, image/jpeg headers: X-Rate-Limit-Limit: - description: The number of allowed requests in the current period - type: integer + description: The number of allowed requests in the current period + schema: + type: integer ``` #### Responses Object From dd0f1f2588f99195dea4ecb79c166f8dc9b0da6a Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 30 Jun 2017 08:00:16 -0700 Subject: [PATCH 0498/1801] Changed language in Link Object to ensure either OperationRef or OperationId is present --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..6180f996ae 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1971,7 +1971,7 @@ The presence of a link does not guarantee the caller's ability to successfully i Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. -For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. ##### Fixed Fields @@ -1986,7 +1986,7 @@ Field Name | Type | Description This object can be extended with [Specification Extensions](#specificationExtensions). -Locating a linked resource MAY be performed by either a `operationRef` or `operationId`. +A linked operation MUST be identified using either an `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the `operationRef` syntax is preferred for specifications with external references. From e67454c4e485fc343e0f54ab0583ba2c26db9f98 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 30 Jun 2017 08:05:01 -0700 Subject: [PATCH 0499/1801] Removed bonus character from requestBody description --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..a1c1e4df3d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1980,7 +1980,7 @@ Field Name | Type | Description operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | Map[`string`, Any \| [{expression}](#runtimeExpression) | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). -requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression)] to use as a request body when calling the target operation. +requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | A server object to be used by the target operation. From 63c7604a2394994d659dadf3d51c8eadaad9b81b Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 30 Jun 2017 09:07:16 -0700 Subject: [PATCH 0500/1801] Prep for next version --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 95d382c1f4..d0c5dc1a7d 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1,6 +1,6 @@ # OpenAPI Specification -#### Version 3.0.0-rc2 +#### Version 3.0.0-rc3 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. From ccf4651b206502fb1e11daf8f93bacdc76502d92 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 30 Jun 2017 13:10:40 -0700 Subject: [PATCH 0501/1801] Prefer `description` when referring to an OAS document Usage of description and definition to refer to an OAS document was mixed. This makes it more consistent, and prefers "description" of the service, since as a possible-truth it is more broad than "definition," which suggests an actual truth. (note: definition does still occur in the doc, but those refer to specific parts of the document rather than the document as a whole) --- versions/3.0.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 0e6565f2ae..db7c84c728 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,15 +8,15 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly described, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. -An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. +An OpenAPI description can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. ## Table of Contents - [Definitions](#definitions) - - [OpenAPI Definition](#oasDefinition) + - [OpenAPI Description](#oasDescription) - [Path Templating](#pathTemplating) - [Media Types](#mediaTypes) - [HTTP Status Codes](#httpCodes) @@ -66,8 +66,8 @@ An OpenAPI definition can then be used by documentation generation tools to disp ## Definitions -##### OpenAPI Definition -A document or set of documents which defines an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. +##### OpenAPI Description +A document or set of documents that describe an API. An OpenAPI description uses and conforms to the OpenAPI Specification. ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. @@ -103,7 +103,7 @@ The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate th Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. -An OpenAPI definition compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 definition documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) +An OpenAPI description compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 description documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) ### Format @@ -131,11 +131,11 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA ### Document Structure -An OpenAPI definition MAY be made up of a single document. -However, parts of the definitions MAY be split into separate documents, at the discretion of the user. +An OpenAPI description MAY be made up of a single document. +However, parts of the description MAY be split into separate documents, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -It is RECOMMENDED that the root OpenAPI definition document be named: `openapi.json` or `openapi.yaml`. +It is RECOMMENDED that the root OpenAPI description document be named: `openapi.json` or `openapi.yaml`. ### Data Types @@ -183,13 +183,13 @@ In the following description, if a field is not explicitly **REQUIRED** or descr #### OpenAPI Object -This is the root document object of the [OpenAPI definition](#oasDefinition). +This is the root document object of the [OpenAPI description](#oasDescription). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition. This is *not* related to the API [`info.version`](#infoVersion) string. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI description uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI description. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. @@ -214,7 +214,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). +version | `string` | **REQUIRED**. The version of the API description (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -318,7 +318,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI description is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. From 16e7257d3303768d092aa46489c8d132f94ea44e Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 7 Jul 2017 12:20:32 -0700 Subject: [PATCH 0502/1801] Use `document` in place of `description` or `definition` --- versions/3.0.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index db7c84c728..9372561139 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,15 +8,15 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly described, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly documented, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. -An OpenAPI description can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. +An OpenAPI document can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. ## Table of Contents - [Definitions](#definitions) - - [OpenAPI Description](#oasDescription) + - [OpenAPI Document](#oasDocument) - [Path Templating](#pathTemplating) - [Media Types](#mediaTypes) - [HTTP Status Codes](#httpCodes) @@ -66,8 +66,8 @@ An OpenAPI description can then be used by documentation generation tools to dis ## Definitions -##### OpenAPI Description -A document or set of documents that describe an API. An OpenAPI description uses and conforms to the OpenAPI Specification. +##### OpenAPI Document +A document or set of files that document an API. An OpenAPI document uses and conforms to the OpenAPI Specification. ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. @@ -103,11 +103,11 @@ The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate th Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. -An OpenAPI description compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 description documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) +An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) ### Format -An API description that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. +An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. For example, if a field has an array value, the JSON array representation will be used: @@ -127,22 +127,22 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). -**Note:** While APIs are described by OpenAPI documents in YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. +**Note:** While APIs may be described by OpenAPI documents in YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. ### Document Structure -An OpenAPI description MAY be made up of a single document. -However, parts of the description MAY be split into separate documents, at the discretion of the user. +An OpenAPI document MAY be made up of a single document. +However, parts of the document MAY be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. -It is RECOMMENDED that the root OpenAPI description document be named: `openapi.json` or `openapi.yaml`. +It is RECOMMENDED that the root OpenAPI document be named: `openapi.json` or `openapi.yaml`. ### Data Types Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. `null` is not supported as a type (see [`nullable`](#schemaNullable) for an alternative solution). -Models are described using the [Schema Object](#schemaObject) which is an extended subset of JSON Schema Specification Wright Draft 00. +Models are defined using the [Schema Object](#schemaObject), which is an extended subset of JSON Schema Specification Wright Draft 00. Primitives have an optional modifier property: `format`. OAS uses several known formats to define in fine detail the data type being used. @@ -183,13 +183,13 @@ In the following description, if a field is not explicitly **REQUIRED** or descr #### OpenAPI Object -This is the root document object of the [OpenAPI description](#oasDescription). +This is the root document object of the [OpenAPI document](#oasDocument). ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI description uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI description. This is *not* related to the API [`info.version`](#infoVersion) string. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. @@ -214,7 +214,7 @@ Field Name | Type | Description termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. -version | `string` | **REQUIRED**. The version of the API description (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). +version | `string` | **REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). This object can be extended with [Specification Extensions](#specificationExtensions). @@ -318,7 +318,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- -url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI description is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. From 962f14166d3970330ec8307a2141b6959c9a7d94 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 7 Jul 2017 23:16:38 +0100 Subject: [PATCH 0503/1801] Fix example; server variable default and enum must be strings --- versions/3.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index fad152b922..be0eda8b42 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -386,10 +386,10 @@ The following shows how variables can be used for a server configuration: }, "port": { "enum": [ - 8443, - 443 + "8443", + "443" ], - "default": 8443 + "default": "8443" }, "basePath": { "default": "v2" @@ -411,9 +411,9 @@ servers: description: this value is assigned by the service provider, in this example `gigantic-server.com` port: enum: - - 8443 - - 443 - default: 8443 + - '8443' + - '443' + default: '8443' basePath: # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` default: v2 From ccf01692e5a522514e0394db5b10f22d17f36bfa Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Sun, 9 Jul 2017 17:35:44 -0400 Subject: [PATCH 0504/1801] =?UTF-8?q?Address=20@whitlockjc=E2=80=99s=20com?= =?UTF-8?q?ment=20to=20PR=20#1228:=20Fix=20callback-example.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace lines 1-4 with # ... (this will be our way to indicate "omitted for brevity") Resolve the $ref on line 51 by replace $ref with an inline schema --- examples/v3.0/callback-example.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index d6ff92af80..56ab18e27d 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -1,7 +1,4 @@ -openapi: 3.0.0 -info: - title: Callback Example - version: 1.0.0 +# ... paths: /streams: post: @@ -48,7 +45,7 @@ paths: type: string format: date-time userData: - $ref: '#/components/schemas/UserLogData' + type: string responses: '202': description: | From 5030a69d06b3a6fd898b293ccf1f5c1e63422c95 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Sun, 9 Jul 2017 17:56:43 -0400 Subject: [PATCH 0505/1801] Allow $refs in the EncodingObject#headers map As discussed in PR #1126 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index fad152b922..dd3aaa4319 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1553,7 +1553,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. -headers | Map[`string`, [Header Object](#headerObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. From de6ec79b3b9bac1a560c534422d531cf7ebb2d61 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Tue, 11 Jul 2017 15:22:28 -0400 Subject: [PATCH 0506/1801] EncodingObject#headers description: change 'a string map' to just 'a map' --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index dd3aaa4319..8775f0abfe 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1553,7 +1553,7 @@ A single encoding definition applied to a single schema property. Field Name | Type | Description ---|:---:|--- contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. -headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A string map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. From 67455c870748fbd55c856d496f714a83981b57ed Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 12 Jul 2017 15:48:18 -0700 Subject: [PATCH 0507/1801] Fixed type in the Link Object fixes #1234 --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index fad152b922..e8ac5f2ff8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1976,7 +1976,7 @@ Field Name | Type | Description ---|:---:|--- operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. -parameters | Map[`string`, Any \| [{expression}](#runtimeExpression) | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). server | [Server Object](#serverObject) | A server object to be used by the target operation. From 3d478376ad5a9a7ff1b90f53e992240d4882a197 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 13 Jul 2017 13:59:15 +0100 Subject: [PATCH 0508/1801] Standardise description commonmark wording --- versions/3.0.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e8ac5f2ff8..7f96a320ae 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -210,7 +210,7 @@ The metadata can be used by the clients if needed, and can be presented in editi Field Name | Type | Description ---|:---:|--- title | `string` | **REQUIRED**. The title of the application. -description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. contact | [Contact Object](#contactObject) | The contact information for the exposed API. license | [License Object](#licenseObject) | The license information for the exposed API. @@ -319,7 +319,7 @@ An object representing a Server. Field Name | Type | Description ---|:---:|--- url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. -description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -430,7 +430,7 @@ Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. -description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -714,7 +714,7 @@ Field Name | Type | Description ---|:---:|--- $ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. summary| `string` | An optional, string summary, intended to apply to all operations in this path. -description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. get | [Operation Object](#operationObject) | A definition of a GET operation on this path. put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. post | [Operation Object](#operationObject) | A definition of a POST operation on this path. @@ -823,7 +823,7 @@ Field Name | Type | Description ---|:---:|--- tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. summary | `string` | A short summary of what the operation does. -description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). @@ -954,7 +954,7 @@ Allows referencing an external resource for extended documentation. Field Name | Type | Description ---|:---:|--- -description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -992,7 +992,7 @@ Field Name | Type | Description ---|:---:|--- name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". -description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. @@ -1224,7 +1224,7 @@ Describes a single request body. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1678,7 +1678,7 @@ Describes a single response from an API Operation, including design-time, static ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). @@ -1889,7 +1889,7 @@ myWebhook: Field Name | Type | Description ---|:---:|--- summary | `string` | Short description for the example. -description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. @@ -1978,7 +1978,7 @@ Field Name | Type | Description operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. -description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). +description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. server | [Server Object](#serverObject) | A server object to be used by the target operation. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -2160,7 +2160,7 @@ It is not mandatory to have a Tag Object per tag defined in the Operation Object Field Name | Type | Description ---|:---:|--- name | `string` | **REQUIRED**. The name of the tag. -description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -2325,7 +2325,7 @@ The following properties are taken from the JSON Schema definition but their def - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). - additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. -- description - [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. @@ -3191,7 +3191,7 @@ Supported schemes are HTTP authentication, an API key (either as a header or as Field Name | Type | Applies To | Description ---|:---:|---|--- type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. -description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. +description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. name | `string` | `apiKey` | **REQUIRED**. The name of the header, query or cookie parameter to be used. in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). From bb9900176fcfac3a438a0e3f741e0121a8f91a70 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Thu, 13 Jul 2017 15:19:53 -0400 Subject: [PATCH 0509/1801] Address #1267 by moving sentence to the right row in the table. Also change "in the OAS" to "In the OpenAPI definition" since a ref must link to an operation in an OpenAPI **definition** file, not in the OAS itself. This language may change if --- versions/3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index e8ac5f2ff8..bd757fac13 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1974,8 +1974,8 @@ For computing links, and providing instructions to execute them, a [runtime expr Field Name | Type | Description ---|:---:|--- -operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). -operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS. +operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OpenAPI definition. +operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. description | `string` | A description of the link. Supports [CommonMark syntax](http://spec.commonmark.org/). From 45971dfe66be360b731cc4456b1839644b16b6ee Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 13 Jul 2017 18:05:26 -0600 Subject: [PATCH 0510/1801] Initial schema commit --- schemas/v3.0/schema.yaml | 1400 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 1400 insertions(+) create mode 100644 schemas/v3.0/schema.yaml diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml new file mode 100644 index 0000000000..1b098199d1 --- /dev/null +++ b/schemas/v3.0/schema.yaml @@ -0,0 +1,1400 @@ +type: object +required: + - openapi + - info + - paths +properties: + openapi: + type: string + enum: + - 3.0.0 + info: + $ref: '#/definitions/Info' + externalDocs: + $ref: '#/definitions/ExternalDocumentation' + servers: + type: array + items: + $ref: '#/definitions/Server' + security: + type: array + items: + $ref: '#/definitions/SecurityRequirement' + tags: + type: array + items: + $ref: '#/definitions/Tag' + paths: + $ref: '#/definitions/Paths' + components: + $ref: '#/definitions/Components' +patternProperties: + '^x-': {} +additionalProperties: false +definitions: + Reference: + type: object + properties: + $ref: + type: string + format: uri-ref + Info: + type: object + required: + - title + - version + properties: + title: + type: string + description: + type: string + termsOfService: + type: string + format: uri-ref + contact: + $ref: '#/definitions/Contact' + license: + $ref: '#/definitions/License' + version: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + + Contact: + type: object + properties: + name: + type: string + url: + type: string + format: uri-ref + email: + type: string + format: email + patternProperties: + '^x-': {} + additionalProperties: false + + License: + type: object + required: + - name + properties: + name: + type: string + url: + type: string + format: uri-ref + patternProperties: + '^x-': {} + additionalProperties: false + + Server: + type: object + required: + - url + properties: + url: + type: string + format: uri-ref + description: + type: string + variables: + type: object + additionalProperties: + $ref: '#/definitions/ServerVariable' + patternProperties: + '^x-': {} + additionalProperties: false + + ServerVariable: + type: object + required: + - default + properties: + enum: + type: string + default: + type: string + description: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + Components: + type: object + properties: + schemas: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Schema' + responses: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Response' + parameters: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Parameter' + examples: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Example' + requestBodies: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/RequestBody' + headers: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Header' + securitySchemes: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/SecurityScheme' + links: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Link' + callbacks: + type: object + patternProperties: + '^[a-zA-Z0-9\.\-_]+$': + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Callback' + patternProperties: + '^x-': {} + additionalProperties: false + + Schema: + type: object + properties: + title: + type: string + multipleOf: + type: number + minimum: 0 + exclusiveMinimum: true + maximum: + type: number + exclusiveMaximum: + type: boolean + default: false + minimum: + type: number + exclusiveMinimum: + type: boolean + default: false + maxLength: + type: integer + minimum: 0 + minLength: + type: integer + minimum: 0 + default: 0 + pattern: + type: string + format: regex + maxItems: + type: integer + minimum: 0 + minItems: + type: integer + minimum: 0 + default: 0 + uniqueItems: + type: boolean + default: false + maxProperties: + type: integer + minimum: 0 + minProperties: + type: integer + minimum: 0 + default: 0 + required: + type: array + items: + type: string + minItems: 1 + uniqueItems: true + enum: + type: array + items: {} + minItems: 1 + uniqueItems: true + type: + type: string + enum: + - array + - boolean + - integer + - number + - object + - string + not: + $ref: '#/definitions/Schema' + properties: + type: object + additionalProperties: + $ref: '#/definitions/Schema' + additionalProperties: + oneOf: + - $ref: '#/definitions/Schema' + - type: boolean + default: true + description: + type: string + format: + type: string + default: {} + $ref: + type: string + format: uri-ref + nullable: + type: boolean + default: false + discriminator: + $ref: '#/definitions/Discriminator' + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + example: {} + externalDocs: + $ref: '#/definitions/ExternalDocumentation' + deprecated: + type: boolean + default: false + xml: + $ref: '#/definitions/XML' + patternProperties: + '^x-': {} + additionalProperties: false + + Discriminator: + type: object + required: + - propertyName + properties: + propertyName: + type: string + mapping: + type: object + additionalProperties: + type: string + + XML: + type: object + properties: + name: + type: string + namespace: + type: string + format: url + prefix: + type: string + attribute: + type: boolean + default: false + wrapperd: + type: boolean + default: false + patternProperties: + '^x-': {} + additionalProperties: false + + Response: + type: object + required: + - description + properties: + description: + type: string + headers: + additionalProperties: + oneOf: + - $ref: '#/definitions/Header' + - $ref: '#/definitions/Reference' + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + links: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Link' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + MediaType: + oneOf: + - $ref: '#/definitions/MediaTypeWithExample' + - $ref: '#/definitions/MediaTypeWithExamples' + + MediaTypeWithExample: + type: object + properties: + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + encoding: + type: object + additionalProperties: + $ref: '#/definitions/Encoding' + patternProperties: + '^x-': {} + additionalProperties: false + + MediaTypeWithExamples: + type: object + properties: + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + encoding: + type: object + additionalProperties: + $ref: '#/definitions/Encoding' + patternProperties: + '^x-': {} + additionalProperties: false + + Example: + type: object + properties: + summary: + type: string + description: + type: string + value: + type: string + externalValue: + type: string + format: uri-ref + patternProperties: + '^x-': {} + additionalProperties: false + + Header: + type: object + properties: + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - simple + default: simple + explode: + type: boolean + enum: + - false + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: array + items: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + example: {} + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + patternProperties: + '^x-': {} + additionalProperties: false + + Paths: + type: object + patternProperties: + '^\/': + $ref: '#/definitions/PathItem' + '^x-': {} + additionalProperties: false + + PathItem: + type: object + properties: + $ref: + type: string + summary: + type: string + description: + type: string + get: + $ref: '#/definitions/Operation' + put: + $ref: '#/definitions/Operation' + post: + $ref: '#/definitions/Operation' + delete: + $ref: '#/definitions/Operation' + options: + $ref: '#/definitions/Operation' + head: + $ref: '#/definitions/Operation' + patch: + $ref: '#/definitions/Operation' + trace: + $ref: '#/definitions/Operation' + servers: + type: array + items: + $ref: '#/definitions/Server' + parameters: + type: array + items: + oneOf: + - $ref: '#/definitions/Parameter' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + Operation: + type: object + required: + - responses + properties: + tags: + type: array + items: + type: string + summary: + type: string + description: + type: string + externalDocs: + $ref: '#/definitions/ExternalDocumentation' + operationId: + type: string + parameters: + type: array + items: + oneOf: + - $ref: '#/definitions/Parameter' + - $ref: '#/definitions/Reference' + requestBody: + oneOf: + - $ref: '#/definitions/RequestBody' + - $ref: '#/definitions/Reference' + responses: + $ref: '#/definitions/Responses' + callbacks: + type: object + additionalProperties: + $ref: '#/definitions/Callback' + deprecated: + type: boolean + default: false + security: + type: array + items: + $ref: '#/definitions/SecurityRequirement' + servers: + type: array + items: + $ref: '#/definitions/Server' + patternProperties: + '^x-': {} + additionalProperties: false + + Responses: + allOf: + - $ref: '#/definitions/Extensions' + type: object + properties: + default: + oneOf: + - $ref: '#/definitions/Response' + - $ref: '#/definitions/Reference' + patternProperties: + '[1-5](?:\d{2}|XX)': + oneOf: + - $ref: '#/definitions/Response' + - $ref: '#/definitions/Reference' + '^x-': {} + minProperties: 1 + additionalProperties: false + not: + type: object + patternProperties: + '^x-': {} + + + SecurityRequirement: + type: object + additionalProperties: + type: array + items: + type: string + + Tag: + type: object + required: + - name + properties: + name: + type: string + description: + type: string + externalDocs: + $ref: '#/definitions/ExternalDocumentation' + patternProperties: + '^x-': {} + additionalProperties: false + + ExternalDocumentation: + type: object + required: + - url + properties: + description: + type: string + url: + type: string + format: uri-ref + patternProperties: + '^x-': {} + additionalProperties: false + + Parameter: + oneOf: + - $ref: '#/definitions/ParameterWithSchema' + - $ref: '#/definitions/ParameterWithContent' + + ParameterWithSchema: + oneOf: + - $ref: '#/definitions/ParameterWithSchemaWithExample' + - $ref: '#/definitions/ParameterWithSchemaWithExamples' + + ParameterWithSchemaWithExample: + oneOf: + - $ref: '#/definitions/ParameterWithSchemaWithExampleInPath' + - $ref: '#/definitions/ParameterWithSchemaWithExampleInQuery' + - $ref: '#/definitions/ParameterWithSchemaWithExampleInHeader' + - $ref: '#/definitions/ParameterWithSchemaWithExampleInCookie' + + ParameterWithSchemaWithExampleInPath: + type: object + required: + - name + - in + - schema + - required + properties: + name: + type: string + in: + type: string + enum: + - path + description: + type: string + required: + type: boolean + enum: + - true + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - matrix + - label + - simple + default: simple + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExampleInQuery: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - query + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - form + - spaceDelimited + - pipeDelimited + - deepObject + default: form + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExampleInHeader: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - header + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - simple + default: simple + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExampleInCookie: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - cookie + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - form + default: form + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExamples: + oneOf: + - $ref: '#/definitions/ParameterWithSchemaWithExamplesInPath' + - $ref: '#/definitions/ParameterWithSchemaWithExamplesInQuery' + - $ref: '#/definitions/ParameterWithSchemaWithExamplesInHeader' + - $ref: '#/definitions/ParameterWithSchemaWithExamplesInCookie' + + ParameterWithSchemaWithExamplesInPath: + type: object + required: + - name + - in + - schema + - required + properties: + name: + type: string + in: + type: string + enum: + - path + description: + type: string + required: + type: boolean + enum: + - true + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - matrix + - label + - simple + default: simple + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExamplesInQuery: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - query + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - form + - spaceDelimited + - pipeDelimited + - deepObject + default: form + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExamplesInHeader: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - header + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - simple + default: simple + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithSchemaWithExamplesInCookie: + type: object + required: + - name + - in + - schema + properties: + name: + type: string + in: + type: string + enum: + - cookie + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string + enum: + - form + default: form + explode: + type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithContent: + oneOf: + - $ref: '#/definitions/ParameterWithContentInPath' + - $ref: '#/definitions/ParameterWithContentNotInPath' + + ParameterWithContentInPath: + type: object + required: + - name + - in + - content + properties: + name: + type: string + in: + type: string + enum: + - path + description: + type: string + required: + type: boolean + enum: + - true + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + minProperties: 1 + maxProperties: 1 + patternProperties: + '^x-': {} + additionalProperties: false + + ParameterWithContentNotInPath: + type: object + required: + - name + - in + - content + properties: + name: + type: string + in: + type: string + enum: + - query + - header + - cookie + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + minProperties: 1 + maxProperties: 1 + patternProperties: + '^x-': {} + additionalProperties: false + + RequestBody: + type: object + required: + - content + properties: + description: + type: string + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + required: + type: boolean + default: false + patternProperties: + '^x-': {} + additionalProperties: false + + SecurityScheme: + oneOf: + - $ref: '#/definitions/APIKeySecurityScheme' + - $ref: '#/definitions/HTTPSecurityScheme' + - $ref: '#/definitions/OAuth2SecurityScheme' + - $ref: '#/definitions/OpenIdConnectSecurityScheme' + + APIKeySecurityScheme: + type: object + required: + - type + - name + - in + properties: + type: + type: string + enum: + - apiKey + name: + type: string + in: + type: string + enum: + - header + - query + - cookie + description: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + HTTPSecurityScheme: + oneOf: + - $ref: '#/definitions/NonBearerHTTPSecurityScheme' + - $ref: '#/definitions/BearerHTTPSecurityScheme' + + NonBearerHTTPSecurityScheme: + not: + type: object + properties: + scheme: + type: string + enum: + - bearer + type: object + required: + - scheme + - type + properties: + scheme: + type: string + description: + type: string + type: + type: string + enum: + - http + patternProperties: + '^x-': {} + additionalProperties: false + + BearerHTTPSecurityScheme: + type: object + required: + - type + - scheme + properties: + scheme: + type: string + enum: + - bearer + bearerFormat: + type: string + type: + type: string + enum: + - http + description: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + OAuth2SecurityScheme: + type: object + required: + - type + - flows + properties: + type: + type: string + enum: + - oauth2 + flows: + $ref: '#/definitions/OAuthFlows' + description: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + OpenIdConnectSecurityScheme: + type: object + required: + - type + - openIdConnect + properties: + type: + type: string + enum: + - openIdConnect + openIdConnectUrl: + type: string + format: url + description: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + OAuthFlows: + type: object + properties: + implicit: + $ref: '#/definitions/ImplicitOAuthFlow' + password: + $ref: '#/definitions/PasswordOAuthFlow' + clientCredentials: + $ref: '#/definitions/ClientCredentialsFlow' + authorizationCode: + $ref: '#/definitions/AuthorizationCodeOAuthFlow' + patternProperties: + '^x-': {} + additionalProperties: false + + ImplicitOAuthFlow: + type: object + required: + - authorizationUrl + - scopes + properties: + authorizationUrl: + type: string + format: uri-ref + refreshUrl: + type: string + format: uri-ref + scopes: + type: object + additionalProperties: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + PasswordOAuthFlow: + type: object + required: + - tokenUrl + properties: + tokenUrl: + type: string + format: uri-ref + refreshUrl: + type: string + format: uri-ref + scopes: + type: object + additionalProperties: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + ClientCredentialsFlow: + type: object + required: + - tokenUrl + properties: + tokenUrl: + type: string + format: uri-ref + refreshUrl: + type: string + format: uri-ref + scopes: + type: object + additionalProperties: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + AuthorizationCodeOAuthFlow: + type: object + required: + - authorizationUrl + - tokenUrl + properties: + authorizationUrl: + type: string + format: uri-ref + tokenUrl: + type: string + format: uri-ref + refreshUrl: + type: string + format: uri-ref + scopes: + type: object + additionalProperties: + type: string + patternProperties: + '^x-': {} + additionalProperties: false + + Link: + oneOf: + - $ref: '#/definitions/LinkWithOperationRef' + - $ref: '#/definitions/LinkWithOperationId' + + LinkWithOperationRef: + type: object + properties: + operationRef: + type: string + format: uri-ref + parameters: + type: object + additionalProperties: {} + requestBody: {} + description: + type: string + server: + $ref: '#/definitions/Server' + patternProperties: + '^x-': {} + additionalProperties: false + + LinkWithOperationId: + type: object + properties: + operationId: + type: string + parameters: + type: object + additionalProperties: {} + requestBody: {} + description: + type: string + server: + $ref: '#/definitions/Server' + patternProperties: + '^x-': {} + additionalProperties: false + + Callback: + type: object + additionalProperties: + $ref: '#/definitions/PathItem' + patternProperties: + '^x-': {} + additionalProperties: false + + Encoding: + type: object + properties: + contentType: + type: string + headers: + type: object + additionalProperties: + $ref: '#/definitions/Header' + style: + type: string + enum: + - form + - spaceDelimited + - pipeDelimited + - deepObject + explode: + type: boolean + allowReserved: + type: boolean + default: false + additionalProperties: false \ No newline at end of file From 99cfcba0cfd533a2814970f845433493a9c74312 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 14 Jul 2017 15:54:32 +0100 Subject: [PATCH 0511/1801] Fix petstore-expanded.yaml example - style Style `simple` is only applicable to in: `header` or `path`. --- examples/v3.0/petstore-expanded.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml index 26e533e7a1..f587075899 100644 --- a/examples/v3.0/petstore-expanded.yaml +++ b/examples/v3.0/petstore-expanded.yaml @@ -27,7 +27,7 @@ paths: in: query description: tags to filter by required: false - style: simple + style: form schema: type: array items: From 60c74eaff21ecd798ef7d0ce7652718ebf3bcda7 Mon Sep 17 00:00:00 2001 From: person Date: Mon, 17 Jul 2017 18:22:45 +0100 Subject: [PATCH 0512/1801] Added missing Discriminator Object link to Table of Contents (3.0.md) --- versions/3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions/3.0.md b/versions/3.0.md index e8ac5f2ff8..f9be367da8 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -52,6 +52,7 @@ An OpenAPI definition can then be used by documentation generation tools to disp - [Tag Object](#tagObject) - [Reference Object](#referenceObject) - [Schema Object](#schemaObject) + - [Discriminator Object](#discriminatorObject) - [XML Object](#xmlObject) - [Security Scheme Object](#securitySchemeObject) - [OAuth Flows Object](#oauthFlowsObject) From bda42189ad7f69cda8bf4761e9acb2c1775d3dc0 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 17 Jul 2017 17:31:40 -0700 Subject: [PATCH 0513/1801] so many fixes --- schemas/v3.0/schema.yaml | 182 ++++++++++++++++++++++++++++++--------- 1 file changed, 141 insertions(+), 41 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 1b098199d1..96ac602acc 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -6,8 +6,7 @@ required: properties: openapi: type: string - enum: - - 3.0.0 + pattern: ^3\.0\.\d(-.+)?$ info: $ref: '#/definitions/Info' externalDocs: @@ -34,10 +33,12 @@ additionalProperties: false definitions: Reference: type: object + required: + - $ref properties: $ref: type: string - format: uri-ref + format: uriref Info: type: object required: @@ -50,7 +51,7 @@ definitions: type: string termsOfService: type: string - format: uri-ref + format: uriref contact: $ref: '#/definitions/Contact' license: @@ -69,7 +70,7 @@ definitions: type: string url: type: string - format: uri-ref + format: uriref email: type: string format: email @@ -86,7 +87,7 @@ definitions: type: string url: type: string - format: uri-ref + format: uriref patternProperties: '^x-': {} additionalProperties: false @@ -98,7 +99,7 @@ definitions: properties: url: type: string - format: uri-ref + format: uriref description: type: string variables: @@ -254,21 +255,50 @@ definitions: type: type: string enum: - - array - - boolean - - integer - - number - - object - - string + - array + - boolean + - integer + - number + - object + - string not: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + allOf: + type: array + items: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + oneOf: + type: array + items: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + anyOf: + type: array + items: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + items: + type: array + items: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' properties: type: object additionalProperties: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' additionalProperties: oneOf: - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' - type: boolean default: true description: @@ -276,9 +306,6 @@ definitions: format: type: string default: {} - $ref: - type: string - format: uri-ref nullable: type: boolean default: false @@ -327,7 +354,7 @@ definitions: attribute: type: boolean default: false - wrapperd: + wrapped: type: boolean default: false patternProperties: @@ -383,6 +410,8 @@ definitions: MediaTypeWithExamples: type: object + required: + - examples properties: schema: oneOf: @@ -409,17 +438,28 @@ definitions: type: string description: type: string - value: - type: string + value: {} externalValue: type: string - format: uri-ref + format: uriref patternProperties: '^x-': {} additionalProperties: false Header: + oneOf: + - $ref: '#/definitions/HeaderWithSchema' + - $ref: '#/definitions/HeaderWithContent' + + HeaderWithSchema: + oneOf: + - $ref: '#/definitions/HeaderWithSchemaWithExample' + - $ref: '#/definitions/HeaderWithSchemaWithExamples' + + HeaderWithSchemaWithExample: type: object + required: + - schema properties: description: type: string @@ -439,24 +479,81 @@ definitions: default: simple explode: type: boolean + allowReserved: + type: boolean + default: false + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + HeaderWithSchemaWithExamples: + type: object + required: + - schema + - examples + properties: + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false + style: + type: string enum: - - false + - simple + default: simple + explode: + type: boolean + allowReserved: + type: boolean default: false schema: oneOf: - $ref: '#/definitions/Schema' - $ref: '#/definitions/Reference' examples: - type: array - items: + type: object + additionalProperties: oneOf: - $ref: '#/definitions/Example' - $ref: '#/definitions/Reference' - example: {} + patternProperties: + '^x-': {} + additionalProperties: false + + HeaderWithContent: + type: object + required: + - content + properties: + description: + type: string + required: + type: boolean + default: false + deprecated: + type: boolean + default: false + allowEmptyValue: + type: boolean + default: false content: type: object additionalProperties: $ref: '#/definitions/MediaType' + minProperties: 1 + maxProperties: 1 patternProperties: '^x-': {} additionalProperties: false @@ -557,8 +654,6 @@ definitions: additionalProperties: false Responses: - allOf: - - $ref: '#/definitions/Extensions' type: object properties: default: @@ -577,6 +672,7 @@ definitions: type: object patternProperties: '^x-': {} + additionalProperties: false SecurityRequirement: @@ -610,7 +706,7 @@ definitions: type: string url: type: string - format: uri-ref + format: uriref patternProperties: '^x-': {} additionalProperties: false @@ -825,6 +921,7 @@ definitions: - in - schema - required + - examples properties: name: type: string @@ -876,6 +973,7 @@ definitions: - name - in - schema + - examples properties: name: type: string @@ -927,6 +1025,7 @@ definitions: - name - in - schema + - examples properties: name: type: string @@ -975,6 +1074,7 @@ definitions: - name - in - schema + - examples properties: name: type: string @@ -1187,8 +1287,8 @@ definitions: type: string type: type: string - enum: - - http + enum: + - http description: type: string patternProperties: @@ -1255,10 +1355,10 @@ definitions: properties: authorizationUrl: type: string - format: uri-ref + format: uriref refreshUrl: type: string - format: uri-ref + format: uriref scopes: type: object additionalProperties: @@ -1274,10 +1374,10 @@ definitions: properties: tokenUrl: type: string - format: uri-ref + format: uriref refreshUrl: type: string - format: uri-ref + format: uriref scopes: type: object additionalProperties: @@ -1293,10 +1393,10 @@ definitions: properties: tokenUrl: type: string - format: uri-ref + format: uriref refreshUrl: type: string - format: uri-ref + format: uriref scopes: type: object additionalProperties: @@ -1313,13 +1413,13 @@ definitions: properties: authorizationUrl: type: string - format: uri-ref + format: uriref tokenUrl: type: string - format: uri-ref + format: uriref refreshUrl: type: string - format: uri-ref + format: uriref scopes: type: object additionalProperties: @@ -1338,7 +1438,7 @@ definitions: properties: operationRef: type: string - format: uri-ref + format: uriref parameters: type: object additionalProperties: {} From 1eb22f0b6536a85001e18e09690e2e74a0c64a79 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 17 Jul 2017 22:32:06 -0700 Subject: [PATCH 0514/1801] items array -> object --- schemas/v3.0/schema.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 96ac602acc..b57f79112c 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -284,11 +284,9 @@ definitions: - $ref: '#/definitions/Schema' - $ref: '#/definitions/Reference' items: - type: array - items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' properties: type: object additionalProperties: From bd277c66fe002a35bbbd1ac2594ae2a246e305cf Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 18 Jul 2017 08:13:08 -0700 Subject: [PATCH 0515/1801] A couple more fixes --- schemas/v3.0/schema.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index b57f79112c..098eee0631 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -1315,7 +1315,7 @@ definitions: type: object required: - type - - openIdConnect + - openIdConnectUrl properties: type: type: string @@ -1472,7 +1472,6 @@ definitions: $ref: '#/definitions/PathItem' patternProperties: '^x-': {} - additionalProperties: false Encoding: type: object From fbdab2414595fa86e70f44dd574f660fc9b5801e Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 13 Jul 2017 16:18:15 +0100 Subject: [PATCH 0516/1801] Change some 'can be's to 'MAY be' --- versions/3.0.md | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 7f0a62b4ef..886c8b7d4f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -148,7 +148,7 @@ Models are described using the [Schema Object](#schemaObject) which is an extend Primitives have an optional modifier property: `format`. OAS uses several known formats to define in fine detail the data type being used. However, to support documentation needs, the `format` property is an open `string`-valued property, and can have any value. -Formats such as `"email"`, `"uuid"`, and so on, can be used even though undefined by this specification. +Formats such as `"email"`, `"uuid"`, and so on, MAY be used even though undefined by this specification. Types that are not accompanied by a `format` property follow the type definition in the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` is not specified. The formats defined by the OAS are: @@ -191,7 +191,7 @@ This is the root document object of the [OpenAPI definition](#oasDefinition). Field Name | Type | Description ---|:---:|--- openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI definition uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI definition. This is *not* related to the API [`info.version`](#infoVersion) string. -info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata can be used by the clients if needed. +info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. @@ -199,12 +199,12 @@ Field Name | Type | Description tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). #### Info Object The object provides metadata about the API. -The metadata can be used by the clients if needed, and can be presented in editing or documentation generation tools for convenience. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. ##### Fixed Fields @@ -218,7 +218,7 @@ Field Name | Type | Description version | `string` | **REQUIRED**. The version of the API definition (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Info Object Example: @@ -266,7 +266,7 @@ Field Name | Type | Description url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Contact Object Example: @@ -295,7 +295,7 @@ Field Name | Type | Description name | `string` | **REQUIRED**. The license name used for the API. url | `string` | A URL to the license used for the API. MUST be in the format of a URL. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### License Object Example: @@ -323,7 +323,7 @@ Field Name | Type | Description description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Server Object Example @@ -433,7 +433,7 @@ Field Name | Type | Description default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). #### Components Object @@ -455,7 +455,7 @@ Field Name | Type | Description links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Link Objects](#linkObject). callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Callback Objects](#callbackObject). -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. @@ -636,7 +636,7 @@ Field Pattern | Type | Description ---|:---:|--- /{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Path Templating Matching @@ -728,7 +728,7 @@ Field Name | Type | Description parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Path Item Object Example @@ -835,7 +835,7 @@ Field Name | Type | Description security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Operation Object Example @@ -958,7 +958,7 @@ Field Name | Type | Description description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### External Documentation Object Example @@ -1059,7 +1059,7 @@ spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Parameter Object Examples @@ -1230,7 +1230,7 @@ Field Name | Type | Description required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Request Body Examples @@ -1350,7 +1350,7 @@ Field Name | Type | Description examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Media Type Examples @@ -1559,7 +1559,7 @@ Field Name | Type | Description explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Encoding Object Example @@ -1626,7 +1626,7 @@ Field Pattern | Type | Description [HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Responses Object Example @@ -1684,7 +1684,7 @@ Field Name | Type | Description content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Response Object Examples @@ -1820,7 +1820,7 @@ Field Pattern | Type | Description ---|:---:|--- {expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Key Expression @@ -1894,7 +1894,7 @@ Field Name | Type | Description value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to @@ -1982,7 +1982,7 @@ Field Name | Type | Description description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. server | [Server Object](#serverObject) | A server object to be used by the target operation. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). A linked operation MUST be identified using either an `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. @@ -2164,7 +2164,7 @@ Field Name | Type | Description description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Tag Object Example @@ -2348,7 +2348,7 @@ Field Name | Type | Description example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ###### Composition and Inheritance (Polymorphism) @@ -2846,7 +2846,7 @@ Field Name | Type | Description attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### XML Object Examples @@ -3200,7 +3200,7 @@ Field Name | Type | Applies To | Description flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### Security Scheme Object Example @@ -3289,7 +3289,7 @@ Field Name | Type | Description clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). #### OAuth Flow Object @@ -3303,7 +3303,7 @@ Field Name | Type | Applies To | Description refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. -This object can be extended with [Specification Extensions](#specificationExtensions). +This object MAY be extended with [Specification Extensions](#specificationExtensions). ##### OAuth Flow Object Examples From 069367f4d7535736fd261b6e590a8b209314b00a Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 18 Jul 2017 10:28:37 -0700 Subject: [PATCH 0517/1801] Fixed restriction on Server's url --- schemas/v3.0/schema.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 098eee0631..a8bbde31df 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -99,7 +99,6 @@ definitions: properties: url: type: string - format: uriref description: type: string variables: From 629cd7c3e821d09dd63c6442f02bae15b97b4207 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 18 Jul 2017 15:28:23 -0700 Subject: [PATCH 0518/1801] make callbacks great again! --- schemas/v3.0/schema.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index a8bbde31df..16658eb0b0 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -634,7 +634,9 @@ definitions: callbacks: type: object additionalProperties: - $ref: '#/definitions/Callback' + oneOf: + - $ref: '#/definitions/Callback' + - $ref: '#/definitions/Reference' deprecated: type: boolean default: false From c401ae6d3ed313733d3318c7ff222d65ce527085 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Wed, 19 Jul 2017 17:11:46 -0700 Subject: [PATCH 0519/1801] Update guidelines for v3 and Swagger --> OAS --- guidelines/README.md | 4 ---- guidelines/{ => v2.0}/EXTENSIONS.md | 28 ++++++++++++++-------------- guidelines/v2.0/README.md | 4 ++++ guidelines/{ => v2.0}/REUSE.md | 0 4 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 guidelines/README.md rename guidelines/{ => v2.0}/EXTENSIONS.md (61%) create mode 100644 guidelines/v2.0/README.md rename guidelines/{ => v2.0}/REUSE.md (100%) diff --git a/guidelines/README.md b/guidelines/README.md deleted file mode 100644 index b18a2a2b1d..0000000000 --- a/guidelines/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## Guidelines for Swagger definitions - -* [Reuse](REUSE.md) of Swagger definitions -* [Extending](EXTENSIONS.md) Swagger definitions with custom metadata diff --git a/guidelines/EXTENSIONS.md b/guidelines/v2.0/EXTENSIONS.md similarity index 61% rename from guidelines/EXTENSIONS.md rename to guidelines/v2.0/EXTENSIONS.md index be10b14984..52e2a1f69f 100644 --- a/guidelines/EXTENSIONS.md +++ b/guidelines/v2.0/EXTENSIONS.md @@ -1,21 +1,21 @@ -# Swagger Extensions +# OpenAPI Extensions -The Swagger 2.0 specification allows for custom properties to be added at several places within a Swagger definition, allowing +The OpenAPI Specification version 2.0 allows for custom properties to be added at several places within an OpenAPI definition, allowing API providers to extend the meta-data provided for their REST APIs as needed. Extension properties are always prefixed by "x-" and can have any valid JSON format value. Currently extension properties are supported in the following definition objects: -* within the [info object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#info-object) -* within the [paths object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#paths-object) -* within the [path-item object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#path-item-object) -* within the [operation object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#operationObject) -* within the [parameter object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#parameterObject) -* within the [responses object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#responses-object) -* within the [tag object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#tag-object) -* within the [security-scheme object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#security-scheme-object) +* within the [info object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#info-object) +* within the [paths object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#paths-object) +* within the [path-item object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#path-item-object) +* within the [operation object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#operationObject) +* within the [parameter object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#parameterObject) +* within the [responses object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#responses-object) +* within the [tag object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#tag-object) +* within the [security-scheme object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#security-scheme-object) -For example, a vendor extension that adds apis.json specific metadata a Swagger definition might look as follows: +For example, a vendor extension that adds apis.json specific metadata to an OpenAPI definition might look as follows: ```json { @@ -59,8 +59,8 @@ For example, a vendor extension that adds apis.json specific metadata a Swagger } ``` -This could be used by corresponding tooling that builds apis.json files for swagger definitions, the advantage being that all metadata -for a Swagger API is within one definition instead of spread out amongst multiple files. +This could be used by corresponding tooling that builds apis.json files for OpenAPI definitions, the advantage being that all metadata +for the API is within one definition instead of spread out amongst multiple files. Another (simplified) example could be how to specify a [JWE encryption](http://hdknr.github.io/docs/identity/jwe.html) policy to parameters, for example as follows: @@ -89,4 +89,4 @@ An API consumer reading these parameter definitions could interpret this as havi ## Annotations -The Swagger-specific annotations currently available for jax-rs APIs do not support the addition of extension data. +The OpenAPI-specific annotations currently available for jax-rs APIs do not support the addition of extension data. diff --git a/guidelines/v2.0/README.md b/guidelines/v2.0/README.md new file mode 100644 index 0000000000..4b1bea7f98 --- /dev/null +++ b/guidelines/v2.0/README.md @@ -0,0 +1,4 @@ +## Guidelines for OpenAPI Definitions + +* [Reuse](REUSE.md) of OpenAPI definitions +* [Extending](EXTENSIONS.md) OpenAPI definitions with custom metadata diff --git a/guidelines/REUSE.md b/guidelines/v2.0/REUSE.md similarity index 100% rename from guidelines/REUSE.md rename to guidelines/v2.0/REUSE.md From 3fd491d0a3a7764b917d7df1a9b0a2aacf29dde8 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Wed, 19 Jul 2017 17:29:16 -0700 Subject: [PATCH 0520/1801] First draft of readme for v3 Incorporated first batch of suggestions from TDC, before any changes from the gdoc. --- README.md | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index aa21756748..554a7ab1ee 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,52 @@ # The OpenAPI Specification -### Draft implementations of tooling supporting the 3.0.0 specification can be found here! +[![Build Status](https://travis-ci.org/OAI/OpenAPI-Specification.svg?branch=master)](https://travis-ci.org/OAI/OpenAPI-Specification) -[3.0.0 Implementations](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/IMPLEMENTATIONS.md) +![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) -This is the working branch for the next version of the OpenAPI Specification. You can read more about the Open API Initiative (OAI) at [https://openapis.org](https://openapis.org). +The OpenAPI Specification is a community driven, open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. -The current, released version of the OpenAPI Specification is 2.0, through donation of the Swagger Specification to the OAI by SmartBear Software. If you are interested in the release specification, see the [master branch](https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) of this project. +The OpenAPI Specification defines a standard, language-agnostic interface description for REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, additional documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes the guesswork in calling the service. -Development of the next version of the OpenAPI Specification is guided by the [OAI Technical Contributors Board](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the OpenAPI Specification, this branch will be merged to master. +Use cases for machine-readable API interfaces include interactive documentation; code generation for documentation, client, and server; and automated test cases. OpenAPI descriptions describe APIs via YAML or JSON documents that adhere to the OpenAPI Specification. These documents can either be produced and served statically, or be generated dynamically from your application. -The current process for development of the OpenAPI Specification is described in [Development Guidelines](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md). +The OpenAPI Specification does not require you to rewrite your existing API. It does not require binding any software to a service--the service being described may not even be yours. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI--this specification is not intended to cover every possible use-case of a REST API. The OpenAPI Specification does not define a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. + +This GitHub project is the starting point for OpenAPI. +Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, +and some general information regarding the project. + +## Current Version - 3.0 + +The current version of the OpenAPI specification is [OpenAPI Specification 3.0](versions/3.0.md). + +### Previous Versions + +This repository also contains the [OpenAPI Specification 2.0](versions/2.0), which is identical to the Swagger 2.0 specification, +as well as the Swagger 1.2 and Swagger 2.0 specifications. + +Each folder in this repository, such as [examples](examples) and [schemas](schemas), should contain folders pertaining to the current and previous versions of the specification. + +## See it in Action + +If you just want to see it work, check out the [list of current examples](examples/v3.0). + +## Tools and Libraries + +Looking to see how you can create your own OpenAPI definition, present it or otherwise use it? Check out the growing +[list of 3.0 Implementations](IMPLEMENTATIONS.md). ## Participation -The OpenAPI Specification is a community driven, open project hosted by the Linux Foundation. The OAI encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: +The current process for development of the OpenAPI Specification is described in +[Development Guidelines](DEVELOPMENT.md). +Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC) and governed by the [TDC Contributors](CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. + +The Open API Initiative encourages participation from individuals and companies alike. +If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: -* Review the [current specification](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md). The human-readable markdown file _is the source of truth_ for the specification. -* Review the [development](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/DEVELOPMENT.md) process so you understand how the spec is evolving. +* Review the [current specification](versions/3.0.md). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [development](DEVELOPMENT.md) process so you understand how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern. If possible, propose a solution. @@ -25,7 +54,7 @@ Not all feedback can be accommodated and there may be solid arguments for or aga ## License -Copyright 2016 The Linux Foundation +Copyright 2016, 2017 The Linux Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 8eb061f80f8297907479637666aff0f3d8ce40c0 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 20 Jul 2017 18:08:35 -0400 Subject: [PATCH 0521/1801] Added fix for media type examples --- versions/3.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 886c8b7d4f..1ad353a2db 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -1452,11 +1452,15 @@ In addition, specific media types MAY be specified: # multiple, specific media types may be specified: requestBody: content: - 'image/png, image/jpeg': # a binary file of type png or jpeg + 'image/jpeg': schema: type: string format: binary + 'image/png': + schema: + type: string + format: binary ``` To upload multiple files, a `multipart` media type MUST be used: From 47f5fecdbe9fd29af83c150a26a29f3a1c3eb67b Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 21 Jul 2017 09:03:28 +0100 Subject: [PATCH 0522/1801] Fix examples object example and api-with-examples --- examples/v3.0/api-with-examples.yaml | 20 ++++++++++++-------- versions/3.0.md | 23 ++++++++++++++--------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml index ea0ce3f7dc..8fdee415ad 100644 --- a/examples/v3.0/api-with-examples.yaml +++ b/examples/v3.0/api-with-examples.yaml @@ -14,7 +14,8 @@ paths: content: application/json: examples: - - { + foo: + value: { "versions": [ { "status": "CURRENT", @@ -46,10 +47,11 @@ paths: content: application/json: examples: - - | - { + foo: + value: | + { "versions": [ - { + { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", "id": "v2.0", @@ -72,7 +74,7 @@ paths: ] } ] - } + } /v2: get: operationId: getVersionDetailsv2 @@ -84,7 +86,8 @@ paths: content: application/json: examples: - - { + foo: + value: { "version": { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", @@ -128,7 +131,8 @@ paths: content: application/json: examples: - - { + foo: + value: { "version": { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", @@ -160,4 +164,4 @@ paths: } ] } - } \ No newline at end of file + } diff --git a/versions/3.0.md b/versions/3.0.md index 1ad353a2db..321aae3b89 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2205,21 +2205,25 @@ schemas: example: $ref: http://foo.bar#/examples/name-example -# in a request body, note the plural `examples` as the Content-Type is set to `*`: +# in a request body, note the plural `examples` requestBody: content: 'application/json': schema: $ref: '#/components/schemas/Address' - examples: - - {"foo": "bar"} - - {"bar": "baz"} + examples: + foo: + value: {"foo": "bar"} + bar: + value: {"bar": "baz"} 'application/xml': - examples: - - $ref: 'http://foo.bar#/examples/address-example.xml' + examples: + xml: + externalValue: 'http://foo.bar/examples/address-example.xml' 'text/plain': - examples: - - $ref: 'http://foo.bar#/examples/address-example.txt' + examples: + text: + externalValue: 'http://foo.bar/examples/address-example.txt' # in a parameter parameters: @@ -2230,7 +2234,8 @@ schemas: format: 'zip-code' example: $ref: 'http://foo.bar#/examples/zip-example' -# in a response, note the plural `examples`: + +# in a response, note the singular `example`: responses: '200': description: your car appointment has been booked From d0ae4794d2488a4dd5b6d793622379491d2b8110 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 21 Jul 2017 11:56:13 +0100 Subject: [PATCH 0523/1801] Ensure all yaml/json examples parse ok --- versions/3.0.md | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 1ad353a2db..f2bdc3b1ad 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -474,28 +474,27 @@ my.org.User ```json "components": { "schemas": { - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" } } } @@ -606,7 +605,7 @@ components: GeneralError: description: General Error content: - application/json + application/json: schema: $ref: '#/components/schemas/GeneralError' securitySchemes: @@ -927,8 +926,8 @@ requestBody: status: description: Updated status of the pet type: string - required: - - status + required: + - status responses: '200': description: Pet updated. @@ -1424,7 +1423,9 @@ In contrast with the 2.0 specification, `file` input/output content in OpenAPI i schema: type: string format: base64 +``` +```yaml # content transferred in binary (octet-stream): schema: type: string @@ -2016,7 +2017,7 @@ paths: schema: type: object properties: - uuid: the unique user id + uuid: # the unique user id type: string format: uuid links: From 37ddaf2f335ef4773438bb228484abb6106646c8 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 21 Jul 2017 07:33:47 -0700 Subject: [PATCH 0524/1801] Addressing comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This attempts to use `document` in its various forms when discussing the artifact (replaces `file` in the most part), though I tried to avoid mixing the file-like instances with the API documentation ones. Some instances have been changed to use `define` (or similar forms), though based on the comments suggesting that both `definition` and `description` are used in common parlance, `description` has not been fully expunged—hopefully this is a reasonable middle ground, but if upon review there is strong support for that, I'll re-submit. --- versions/3.0.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/versions/3.0.md b/versions/3.0.md index 9372561139..037b202965 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -8,9 +8,9 @@ This document is licensed under [The Apache License, Version 2.0](http://www.apa ## Introduction -The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly documented, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. -An OpenAPI document can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools and many other use cases. +An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases. ## Table of Contents @@ -67,7 +67,7 @@ An OpenAPI document can then be used by documentation generation tools to displa ## Definitions ##### OpenAPI Document -A document or set of files that document an API. An OpenAPI document uses and conforms to the OpenAPI Specification. +A document (or set of documents) that define or describe an API. An OpenAPI document uses and conforms to the OpenAPI Specification. ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. @@ -127,13 +127,11 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA - Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). - Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). -**Note:** While APIs may be described by OpenAPI documents in YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. +**Note:** While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. ### Document Structure -An OpenAPI document MAY be made up of a single document. -However, parts of the document MAY be split into separate files, at the discretion of the user. -This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions. +An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, `$ref` fields MUST be used in the specification to reference those parts as follows from the [JSON Schema](http://json-schema.org) definitions. It is RECOMMENDED that the root OpenAPI document be named: `openapi.json` or `openapi.yaml`. From 04215293cb5e746854421d6e04e393513515f308 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Fri, 21 Jul 2017 07:42:31 -0700 Subject: [PATCH 0525/1801] Update per the Google doc Work by people in the TDC and marketing committee --- README.md | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 554a7ab1ee..20b86e969b 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,14 @@ The OpenAPI Specification is a community driven, open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. -The OpenAPI Specification defines a standard, language-agnostic interface description for REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, additional documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes the guesswork in calling the service. +The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. -Use cases for machine-readable API interfaces include interactive documentation; code generation for documentation, client, and server; and automated test cases. OpenAPI descriptions describe APIs via YAML or JSON documents that adhere to the OpenAPI Specification. These documents can either be produced and served statically, or be generated dynamically from your application. +Use cases for machine-readable API definition documents include, but are not limited to, interactive documentation; code generation for documentation, clients, and servers; and automation of test cases. OpenAPI documents describe an API's services and are represented in either YAML or JSON formats. These documents may either be produced and served statically or be generated dynamically from an application. -The OpenAPI Specification does not require you to rewrite your existing API. It does not require binding any software to a service--the service being described may not even be yours. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI--this specification is not intended to cover every possible use-case of a REST API. The OpenAPI Specification does not define a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. +The OpenAPI Specification does not require rewriting existing APIs. It does not require binding any software to a service—the service being described may not even be owned by the creator of its description. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI—this specification is not intended to cover every possible style of REST APIs. The OpenAPI Specification does not mandate a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. This GitHub project is the starting point for OpenAPI. -Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, -and some general information regarding the project. +Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, and some general information regarding the project. ## Current Version - 3.0 @@ -22,12 +21,12 @@ The current version of the OpenAPI specification is [OpenAPI Specification 3.0]( ### Previous Versions -This repository also contains the [OpenAPI Specification 2.0](versions/2.0), which is identical to the Swagger 2.0 specification, +This repository also contains the [OpenAPI Specification 2.0](versions/2.0), which is identical to the Swagger 2.0 specification before it was renamed to “OpenAPI Specification”, as well as the Swagger 1.2 and Swagger 2.0 specifications. Each folder in this repository, such as [examples](examples) and [schemas](schemas), should contain folders pertaining to the current and previous versions of the specification. -## See it in Action +## See It in Action If you just want to see it work, check out the [list of current examples](examples/v3.0). @@ -40,7 +39,7 @@ Looking to see how you can create your own OpenAPI definition, present it or oth The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). -Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC) and governed by the [TDC Contributors](CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. +Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC) and governed by the [TDC Contributors](CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: @@ -54,14 +53,8 @@ Not all feedback can be accommodated and there may be solid arguments for or aga ## License -Copyright 2016, 2017 The Linux Foundation -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) +See: [License (MIT)](https://github.com/OAI/OpenAPI-Specification/blob/master/LICENSE) -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + +![Analytics](https://ga-beacon.appspot.com/UA-831873-42/readme.md?pixel) From 000e5693b83667532b5728316bacc18b6fe1e7c5 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 21 Jul 2017 09:30:13 -0700 Subject: [PATCH 0526/1801] Fixing verb agreement, reverting one instance of document to definition --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 037b202965..a3d2787cb4 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -67,7 +67,7 @@ An OpenAPI definition can then be used by documentation generation tools to disp ## Definitions ##### OpenAPI Document -A document (or set of documents) that define or describe an API. An OpenAPI document uses and conforms to the OpenAPI Specification. +A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. ##### Path Templating Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. From 7f26f7d29f9d92a380f4bc711cbc12137dc7214b Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Fri, 21 Jul 2017 10:12:52 -0700 Subject: [PATCH 0527/1801] Remove reference to contributors (for now) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 20b86e969b..fcd073ad0a 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Looking to see how you can create your own OpenAPI definition, present it or oth The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). -Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC) and governed by the [TDC Contributors](CONTRIBUTORS.md). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. +Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From 92b66a638981588da25110583858a8a806c4f3f6 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Fri, 21 Jul 2017 10:13:54 -0700 Subject: [PATCH 0528/1801] Add missing comma --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fcd073ad0a..88bddecabc 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you just want to see it work, check out the [list of current examples](exampl ## Tools and Libraries -Looking to see how you can create your own OpenAPI definition, present it or otherwise use it? Check out the growing +Looking to see how you can create your own OpenAPI definition, present it, or otherwise use it? Check out the growing [list of 3.0 Implementations](IMPLEMENTATIONS.md). ## Participation From f5b1cf00b9b3b6ef62ce4643cf677204ddee722d Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 21 Jul 2017 11:47:49 -0700 Subject: [PATCH 0529/1801] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88bddecabc..8771fc5089 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Not all feedback can be accommodated and there may be solid arguments for or aga ## License -See: [License (MIT)](https://github.com/OAI/OpenAPI-Specification/blob/master/LICENSE) +See: [License (Apache-2.0)](https://github.com/OAI/OpenAPI-Specification/blob/master/LICENSE) ![Analytics](https://ga-beacon.appspot.com/UA-831873-42/readme.md?pixel) From a4e7f9c53027bcbd82d375a09c2ea0e37335732d Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Mon, 24 Jul 2017 17:10:48 -0400 Subject: [PATCH 0530/1801] Added a missing / separator after the paths in operationRef, now it's '#/paths/~12.0~1repositories~1/{username}/get' == '#/paths/<'/2.0/repositories/{username}'.encode()>/get --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 866b327a16..769319901f 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2069,7 +2069,7 @@ value), references MAY also be made through a relative `operationRef`: links: UserRepositories: # returns array of '#/components/schemas/repository' - operationRef: '#/paths~12.0~1repositories~1/{username}/get' + operationRef: '#/paths/~12.0~1repositories~1/{username}/get' parameters: username: $response.body#/username ``` From be6f83db1923e21f82a90729a0a43283cd38cc76 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Mon, 24 Jul 2017 17:33:31 -0400 Subject: [PATCH 0531/1801] That would translate to: paths: /2.0/repositories/{username}: get: --- versions/3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.md b/versions/3.0.md index 769319901f..6b07fe7cfc 100644 --- a/versions/3.0.md +++ b/versions/3.0.md @@ -2069,7 +2069,7 @@ value), references MAY also be made through a relative `operationRef`: links: UserRepositories: # returns array of '#/components/schemas/repository' - operationRef: '#/paths/~12.0~1repositories~1/{username}/get' + operationRef: '#/paths/~12.0~1repositories~1{username}/get' parameters: username: $response.body#/username ``` From b4805dc48fb614a79bfd40a70cd4387637f3cfb3 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 24 Jul 2017 15:11:00 -0700 Subject: [PATCH 0532/1801] rename file --- DEVELOPMENT.md | 2 +- README.md | 4 ++-- versions/{3.0.md => 3.0.0.md} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename versions/{3.0.md => 3.0.0.md} (100%) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 84e3b5a853..d5f6fff76b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -20,7 +20,7 @@ The specification _will change_ from the original 2.0 version. We should typica ## Tracking Process - Use GitHub for all spec designs, use cases, and so on. - - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.md for example). + - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.0.md for example). - The `master` branch shall remain the current, released OpenAPI Specification (i.e., 2.0). We will work in an OpenAPI.next branch, which shall be described and linked to on the **default** README.md on master. - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal. - New features should be done in feature branches which, upon approval, are merged into the OpenAPI.next branch. diff --git a/README.md b/README.md index 8771fc5089..301161dfb1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Here you will find the information you need about the OpenAPI Specification, sim ## Current Version - 3.0 -The current version of the OpenAPI specification is [OpenAPI Specification 3.0](versions/3.0.md). +The current version of the OpenAPI specification is [OpenAPI Specification 3.0](versions/3.0.0.md). ### Previous Versions @@ -44,7 +44,7 @@ Development of the next version of the OpenAPI Specification is guided by the [T The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: -* Review the [current specification](versions/3.0.md). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [current specification](versions/3.0.0.md). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](DEVELOPMENT.md) process so you understand how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern. If possible, propose a solution. diff --git a/versions/3.0.md b/versions/3.0.0.md similarity index 100% rename from versions/3.0.md rename to versions/3.0.0.md From 49e784d7b7800da8732103aa3ac56bc7ccde5cfb Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 24 Jul 2017 15:33:13 -0700 Subject: [PATCH 0533/1801] fixed servervariable.enum --- schemas/v3.0/schema.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 16658eb0b0..67bd3750d0 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -115,7 +115,9 @@ definitions: - default properties: enum: - type: string + type: array + items: + type: string default: type: string description: From 61471699b338b19eda2e451070afda1b26e0cd1a Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 25 Jul 2017 10:19:57 -0400 Subject: [PATCH 0534/1801] Updated content key descriptions --- versions/3.0.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index 6b07fe7cfc..048e6749c9 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -1223,7 +1223,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is the media type and the value describes it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, the only the most specific key is applicable. e.g. text/plain overrides text/* required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1684,7 +1684,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, the only the most specific key is applicable. e.g. text/plain overrides text/* links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object MAY be extended with [Specification Extensions](#specificationExtensions). From 405c0e14483b596aab7b3fcd6e0ccd811329183d Mon Sep 17 00:00:00 2001 From: Darrel Date: Tue, 25 Jul 2017 10:25:07 -0400 Subject: [PATCH 0535/1801] Removed a word. --- versions/3.0.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index 048e6749c9..3650f5d957 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -1223,7 +1223,7 @@ Describes a single request body. Field Name | Type | Description ---|:---:|--- description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, the only the most specific key is applicable. e.g. text/plain overrides text/* +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. @@ -1684,7 +1684,7 @@ Field Name | Type | Description ---|:---:|--- description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. -content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, the only the most specific key is applicable. e.g. text/plain overrides text/* +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). This object MAY be extended with [Specification Extensions](#specificationExtensions). From 6d40370256a0bab01201c9474a9d584060c8dcd4 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Tue, 25 Jul 2017 11:41:36 -0700 Subject: [PATCH 0536/1801] Update the references in EXTENSIONS.md to refer to whatever is the current version --- guidelines/v2.0/EXTENSIONS.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/guidelines/v2.0/EXTENSIONS.md b/guidelines/v2.0/EXTENSIONS.md index 52e2a1f69f..952a3f182a 100644 --- a/guidelines/v2.0/EXTENSIONS.md +++ b/guidelines/v2.0/EXTENSIONS.md @@ -6,14 +6,14 @@ prefixed by "x-" and can have any valid JSON format value. Currently extension properties are supported in the following definition objects: -* within the [info object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#info-object) -* within the [paths object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#paths-object) -* within the [path-item object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#path-item-object) -* within the [operation object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#operationObject) -* within the [parameter object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#parameterObject) -* within the [responses object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#responses-object) -* within the [tag object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#tag-object) -* within the [security-scheme object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#security-scheme-object) +* within the [info object](/versions/2.0.md#info-object) +* within the [paths object](/versions/2.0.md#paths-object) +* within the [path-item object](/versions/2.0.md#path-item-object) +* within the [operation object](/versions/2.0.md#operationObject) +* within the [parameter object](/versions/2.0.md#parameterObject) +* within the [responses object](/versions/2.0.md#responses-object) +* within the [tag object](/versions/2.0.md#tag-object) +* within the [security-scheme object](/versions/2.0.md#security-scheme-object) For example, a vendor extension that adds apis.json specific metadata to an OpenAPI definition might look as follows: From 84f999189cacbffa178e412a377757f88a4fdf82 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Tue, 25 Jul 2017 11:44:28 -0700 Subject: [PATCH 0537/1801] definition -> document --- guidelines/v2.0/EXTENSIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guidelines/v2.0/EXTENSIONS.md b/guidelines/v2.0/EXTENSIONS.md index 952a3f182a..e0c1124034 100644 --- a/guidelines/v2.0/EXTENSIONS.md +++ b/guidelines/v2.0/EXTENSIONS.md @@ -1,6 +1,6 @@ # OpenAPI Extensions -The OpenAPI Specification version 2.0 allows for custom properties to be added at several places within an OpenAPI definition, allowing +The OpenAPI Specification version 2.0 allows for custom properties to be added at several places within an OpenAPI document., allowing API providers to extend the meta-data provided for their REST APIs as needed. Extension properties are always prefixed by "x-" and can have any valid JSON format value. From 2070f3c3afae7006c9daa0a386fdcae4b05391d1 Mon Sep 17 00:00:00 2001 From: Uri Sarid Date: Tue, 25 Jul 2017 11:47:57 -0700 Subject: [PATCH 0538/1801] Add EXTENSIONS.md file at the root of the guidelines folder to avoid link breakage --- guidelines/EXTENSIONS.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 guidelines/EXTENSIONS.md diff --git a/guidelines/EXTENSIONS.md b/guidelines/EXTENSIONS.md new file mode 100644 index 0000000000..2bddf6fd9b --- /dev/null +++ b/guidelines/EXTENSIONS.md @@ -0,0 +1 @@ +For OpenAPI Specification version 2.0, please see [v2.0/EXTENSIONS.md](v2.0/EXTENSIONS.md) From 27cac2c282c6d88f2fbb8f74e8bbb898f33445aa Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Jul 2017 14:30:15 -0700 Subject: [PATCH 0539/1801] version update --- versions/3.0.0.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index 3650f5d957..b344867bdd 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -1,6 +1,6 @@ # OpenAPI Specification -#### Version 3.0.0-rc3 +#### Version 3.0.0 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. @@ -3428,13 +3428,14 @@ Two examples of this: ## Appendix A: Revision History -Version | Date | Notes ---- | --- | --- +Version | Date | Notes +--- | --- | --- +3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification 3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification 3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification -2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative -2.0 | 2014-09-08 | Release of Swagger 2.0 -1.2 | 2014-03-14 | Initial release of the formal document. -1.1 | 2012-08-22 | Release of Swagger 1.1 -1.0 | 2011-08-10 | First release of the Swagger Specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification From 771adff68185c563118c4649efeb98767d71c404 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 25 Jul 2017 15:09:18 -0700 Subject: [PATCH 0540/1801] link change --- versions/3.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index b344867bdd..30a041ad84 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -104,7 +104,7 @@ The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate th Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. -An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](http://swagger.io/specification/#swaggerObject) and value `"2.0"`.) +An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerObject) and value `"2.0"`.) ### Format From e9c539d86f080f133aa35c3e7db33ef004496625 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 26 Jul 2017 00:31:09 -0700 Subject: [PATCH 0541/1801] Fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 301161dfb1..7eaf9ba26d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The current version of the OpenAPI specification is [OpenAPI Specification 3.0]( ### Previous Versions -This repository also contains the [OpenAPI Specification 2.0](versions/2.0), which is identical to the Swagger 2.0 specification before it was renamed to “OpenAPI Specification”, +This repository also contains the [OpenAPI Specification 2.0](versions/2.0.md), which is identical to the Swagger 2.0 specification before it was renamed to “OpenAPI Specification”, as well as the Swagger 1.2 and Swagger 2.0 specifications. Each folder in this repository, such as [examples](examples) and [schemas](schemas), should contain folders pertaining to the current and previous versions of the specification. From 970566d5ca236a5ce1a02fb7d617fdbd07df88db Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Wed, 26 Jul 2017 11:29:30 +0300 Subject: [PATCH 0542/1801] Add quotes around response statuses in standalone 3.0 examples --- examples/v3.0/api-with-examples.yaml | 8 ++++---- examples/v3.0/petstore-expanded.yaml | 8 ++++---- examples/v3.0/petstore.yaml | 6 +++--- examples/v3.0/uber.yaml | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml index 8fdee415ad..ae491420e5 100644 --- a/examples/v3.0/api-with-examples.yaml +++ b/examples/v3.0/api-with-examples.yaml @@ -8,7 +8,7 @@ paths: operationId: listVersionsv2 summary: List API versions responses: - 200: + "200": description: |- 200 response content: @@ -41,7 +41,7 @@ paths: } ] } - 300: + "300": description: |- 300 response content: @@ -80,7 +80,7 @@ paths: operationId: getVersionDetailsv2 summary: Show API version details responses: - 200: + "200": description: |- 200 response content: @@ -125,7 +125,7 @@ paths: ] } } - 203: + "203": description: |- 203 response content: diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml index f587075899..6c6195199c 100644 --- a/examples/v3.0/petstore-expanded.yaml +++ b/examples/v3.0/petstore-expanded.yaml @@ -40,7 +40,7 @@ paths: type: integer format: int32 responses: - 200: + '200': description: pet response content: application/json: @@ -65,7 +65,7 @@ paths: schema: $ref: '#/components/schemas/NewPet' responses: - 200: + '200': description: pet response content: application/json: @@ -90,7 +90,7 @@ paths: type: integer format: int64 responses: - 200: + '200': description: pet response content: application/json: @@ -114,7 +114,7 @@ paths: type: integer format: int64 responses: - 204: + '204': description: pet deleted default: description: unexpected error diff --git a/examples/v3.0/petstore.yaml b/examples/v3.0/petstore.yaml index b444f02531..5fdfba907d 100644 --- a/examples/v3.0/petstore.yaml +++ b/examples/v3.0/petstore.yaml @@ -22,7 +22,7 @@ paths: type: integer format: int32 responses: - 200: + '200': description: An paged array of pets headers: x-next: @@ -45,7 +45,7 @@ paths: tags: - pets responses: - 201: + '201': description: Null response default: description: unexpected error @@ -67,7 +67,7 @@ paths: schema: type: string responses: - 200: + '200': description: Expected response to a valid request content: application/json: diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml index 2c77b440f9..735b8c8ed0 100644 --- a/examples/v3.0/uber.yaml +++ b/examples/v3.0/uber.yaml @@ -32,7 +32,7 @@ paths: tags: - Products responses: - 200: + "200": description: An array of products content: application/json: @@ -80,7 +80,7 @@ paths: tags: - Estimates responses: - 200: + "200": description: An array of price estimates by product content: application/json: @@ -127,7 +127,7 @@ paths: tags: - Estimates responses: - 200: + "200": description: An array of products content: application/json: @@ -148,7 +148,7 @@ paths: tags: - User responses: - 200: + "200": description: Profile information for a user content: application/json: @@ -180,7 +180,7 @@ paths: tags: - User responses: - 200: + "200": description: History information for the given user content: application/json: From adeabf3209fda9235b226b863dc0075ec65c2cbe Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 3 Aug 2017 14:58:14 -0700 Subject: [PATCH 0543/1801] Added swagger-ui/editor --- IMPLEMENTATIONS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 773e2595a9..5bcfc85245 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -27,13 +27,14 @@ These tools are not necessarily endorsed by the OAI. | KaiZen OpenAPI Editor | [GitHub/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | | RepreZen API Studio | [RepreZen.com/OpenAPI](https://www.reprezen.com/OpenAPI) | Java | Commercial desktop IDE for API design, documentation & development | | OpenApi-gui | [GitHub/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenApi / Swagger definitions | - +| swagger-editor | [GitHub/swagger-api](https://github.com/swagger-api/swagger-editor) | JavaScript | Web-Based editor for creating, editing, validating and testing OpenAPI\Swagger definitions | #### User Interfaces | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| | openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | +| swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | #### Server Implementations From 19a0cb3c38e63c8e1576d4d6960443a8a567b190 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 4 Aug 2017 09:46:59 +0100 Subject: [PATCH 0544/1801] Update heading text of IMPLEMENTATIONS.md --- IMPLEMENTATIONS.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 5bcfc85245..09e622462b 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -1,10 +1,6 @@ ### Implementations -Below is a list of known tooling that implements the 3.0.0 specification. Because -the 3.0.0 specification has not yet been released, refer to the details of projects listed below for any notes about stability and roadmap. The process -to create the best possible 3.0.0 specification includes feedback from end-users -and tooling creators. We strongly encourage draft tooling be -made available for early users of the OAS. +Below is a list of known tooling that implements the 3.0.0 specification. While support for the 3.0.0 specification matures, refer to the details of projects listed below for any notes about stability and roadmap. The process to improve the 3.x specification includes feedback from end-users and tooling creators. We strongly encourage draft tooling be made available for early users of OAS drafts. These tools are not necessarily endorsed by the OAI. From 093f8f718a364fbd1cdcbd0988582019557e6fd0 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Fri, 18 Aug 2017 16:17:13 +0200 Subject: [PATCH 0545/1801] [IMPLEMENTATIONS] Add odata-openapi Add OData-to-OpenAPI converter to the list of low-level tools --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 5bcfc85245..c815fcb6cf 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -18,6 +18,7 @@ These tools are not necessarily endorsed by the OAI. | openapi3-ts | [GitHub/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | | swagger2openapi | [GitHub/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | | Tavis.OpenApi | [GitHub/tavis-sofware/Tavis.OpenApi](https://github.com/tavis-software/Tavis.OpenApi/) | dotnet | C# based parser with definition validation and migration support from V2 | +| odata-openapi | [GitHub/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | #### Editors From c730342560a01a56a78c26ad205c793c5153f004 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 21 Aug 2017 11:36:01 -0700 Subject: [PATCH 0546/1801] Created 3.0.1 --- README.md | 2 + versions/3.0.1.md | 3442 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 3444 insertions(+) create mode 100644 versions/3.0.1.md diff --git a/README.md b/README.md index 7eaf9ba26d..1f694a5db4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) +**This is the WIP branch for the next patch version of the spec - 3.0.1. Patch level corrections should be submitted against this branch, specifically against [3.0.1.md](https://github.com/OAI/OpenAPI-Specification/blob/v3.0.1/versions/3.0.1.md).** + The OpenAPI Specification is a community driven, open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. diff --git a/versions/3.0.1.md b/versions/3.0.1.md new file mode 100644 index 0000000000..906c1f96c1 --- /dev/null +++ b/versions/3.0.1.md @@ -0,0 +1,3442 @@ +# OpenAPI Specification + +#### Version 3.0.1 + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. + +This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). + +## Introduction + +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. + +An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases. + +## Table of Contents + + +- [Definitions](#definitions) + - [OpenAPI Document](#oasDocument) + - [Path Templating](#pathTemplating) + - [Media Types](#mediaTypes) + - [HTTP Status Codes](#httpCodes) +- [Specification](#specification) + - [Versions](#versions) + - [Format](#format) + - [Document Structure](#documentStructure) + - [Data Types](#dataTypes) + - [Rich Text Formatting](#richText) + - [Relative References In URLs](#relativeReferences) + - [Schema](#schema) + - [OpenAPI Object](#oasObject) + - [Info Object](#infoObject) + - [Contact Object](#contactObject) + - [License Object](#licenseObject) + - [Server Object](#serverObject) + - [Server Variable Object](#serverVariableObject) + - [Components Object](#componentsObject) + - [Paths Object](#pathsObject) + - [Path Item Object](#pathItemObject) + - [Operation Object](#operationObject) + - [External Documentation Object](#externalDocumentationObject) + - [Parameter Object](#parameterObject) + - [Request Body Object](#requestBodyObject) + - [Media Type Object](#mediaTypeObject) + - [Encoding Object](#encodingObject) + - [Responses Object](#responsesObject) + - [Response Object](#responseObject) + - [Callback Object](#callbackObject) + - [Example Object](#exampleObject) + - [Link Object](#linkObject) + - [Header Object](#headerObject) + - [Tag Object](#tagObject) + - [Reference Object](#referenceObject) + - [Schema Object](#schemaObject) + - [Discriminator Object](#discriminatorObject) + - [XML Object](#xmlObject) + - [Security Scheme Object](#securitySchemeObject) + - [OAuth Flows Object](#oauthFlowsObject) + - [OAuth Flow Object](#oauthFlowObject) + - [Security Requirement Object](#securityRequirementObject) + - [Specification Extensions](#specificationExtensions) + - [Security Filtering](#securityFiltering) +- [Appendix A: Revision History](#revisionHistory) + + + + +## Definitions + +##### OpenAPI Document +A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. + +##### Path Templating +Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. + +##### Media Types +Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [RFC6838](http://tools.ietf.org/html/rfc6838). + +Some examples of possible media type definitions: +``` + text/plain; charset=utf-8 + application/json + application/vnd.github+json + application/vnd.github.v3+json + application/vnd.github.v3.raw+json + application/vnd.github.v3.text+json + application/vnd.github.v3.html+json + application/vnd.github.v3.full+json + application/vnd.github.v3.diff + application/vnd.github.v3.patch +``` +##### HTTP Status Codes +The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [RFC7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). + +## Specification + +### Versions + +The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. + +The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. + +Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. + +An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerObject) and value `"2.0"`.) + +### Format + +An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. + +For example, if a field has an array value, the JSON array representation will be used: + +```json +{ + "field": [ 1, 2, 3 ] +} +``` +All field names in the specification are **case sensitive**. + +The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. + +Patterned fields MUST have unique names within the containing object. + +In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is RECOMMENDED along with some additional constraints: + +- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). + +**Note:** While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. + +### Document Structure + +An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, `$ref` fields MUST be used in the specification to reference those parts as follows from the [JSON Schema](http://json-schema.org) definitions. + +It is RECOMMENDED that the root OpenAPI document be named: `openapi.json` or `openapi.yaml`. + +### Data Types + +Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). +Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. +`null` is not supported as a type (see [`nullable`](#schemaNullable) for an alternative solution). +Models are defined using the [Schema Object](#schemaObject), which is an extended subset of JSON Schema Specification Wright Draft 00. + +Primitives have an optional modifier property: `format`. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the `format` property is an open `string`-valued property, and can have any value. +Formats such as `"email"`, `"uuid"`, and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a `format` property follow the type definition in the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` is not specified. + +The formats defined by the OAS are: + +Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments +----------- | ------ | -------- | -------- +integer | `integer` | `int32` | signed 32 bits +long | `integer` | `int64` | signed 64 bits +float | `number` | `float` | | +double | `number` | `double` | | +string | `string` | | | +byte | `string` | `byte` | base64 encoded characters +binary | `string` | `binary` | any sequence of octets +boolean | `boolean` | | | +date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +password | `string` | `password` | A hint to UIs to obscure input. + +### Rich Text Formatting +Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. + +### Relative References in URLs + +Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). +Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. + +Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). + +### Schema + +In the following description, if a field is not explicitly **REQUIRED** or described with a MUST or SHALL, it can be considered OPTIONAL. + +#### OpenAPI Object + +This is the root document object of the [OpenAPI document](#oasDocument). + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. +info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. +servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. +components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. +tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Info Object + +The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +title | `string` | **REQUIRED**. The title of the application. +description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. +contact | [Contact Object](#contactObject) | The contact information for the exposed API. +license | [License Object](#licenseObject) | The license information for the exposed API. +version | `string` | **REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Info Object Example: + +```json +{ + "title": "Sample Pet Store App", + "description": "This is a sample server for a pet store.", + "termsOfService": "http://example.com/terms/", + "contact": { + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0.1" +} +``` + +```yaml +title: Sample Pet Store App +description: This is a sample server for a pet store. +termsOfService: http://example.com/terms/ +contact: + name: API Support + url: http://www.example.com/support + email: support@example.com +license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +version: 1.0.1 +``` + +#### Contact Object + +Contact information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | The identifying name of the contact person/organization. +url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. +email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Contact Object Example: + +```json +{ + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" +} +``` + +```yaml +name: API Support +url: http://www.example.com/support +email: support@example.com +``` + +#### License Object + +License information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The license name used for the API. +url | `string` | A URL to the license used for the API. MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### License Object Example: + +```json +{ + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" +} +``` + +```yaml +name: Apache 2.0 +url: http://www.apache.org/licenses/LICENSE-2.0.html +``` + +#### Server Object + +An object representing a Server. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Server Object Example + +A single server would be described as: + +```json +{ + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" +} +``` + +```yaml +url: https://development.gigantic-server.com/v1 +description: Development server +``` + +The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers): + +```json +{ + "servers": [ + { + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" + }, + { + "url": "https://staging.gigantic-server.com/v1", + "description": "Staging server" + }, + { + "url": "https://api.gigantic-server.com/v1", + "description": "Production server" + } + ] +} +``` + +```yaml +servers: +- url: https://development.gigantic-server.com/v1 + description: Development server +- url: https://staging.gigantic-server.com/v1 + description: Staging server +- url: https://api.gigantic-server.com/v1 + description: Production server +``` + +The following shows how variables can be used for a server configuration: + +```json +{ + "servers": [ + { + "url": "https://{username}.gigantic-server.com:{port}/{basePath}", + "description": "The production API server", + "variables": { + "username": { + "default": "demo", + "description": "this value is assigned by the service provider, in this example `gigantic-server.com`" + }, + "port": { + "enum": [ + "8443", + "443" + ], + "default": "8443" + }, + "basePath": { + "default": "v2" + } + } + } + ] +} +``` + +```yaml +servers: +- url: https://{username}.gigantic-server.com:{port}/{basePath} + description: The production API server + variables: + username: + # note! no enum here means it is an open value + default: demo + description: this value is assigned by the service provider, in this example `gigantic-server.com` + port: + enum: + - '8443' + - '443' + default: '8443' + basePath: + # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` + default: v2 +``` + + +#### Server Variable Object + +An object representing a Server Variable for server URL template substitution. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. +default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Components Object + +Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + + +##### Fixed Fields + +Field Name | Type | Description +---|:---|--- + schemas | Map[`string`, [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Response Object](#responseObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Response Objects](#responseObject). + parameters | Map[`string`, [Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Parameter Objects](#parameterObject). + examples | Map[`string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). + headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Header Objects](#headerObject). + securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). + links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Callback Objects](#callbackObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. + +Field Name Examples: + +``` +User +User_1 +User_Name +user-name +my.org.User +``` + +##### Components Object Example + +```json +"components": { + "schemas": { + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + } + }, + "parameters": { + "skipParam": { + "name": "skip", + "in": "query", + "description": "number of items to skip", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + }, + "limitParam": { + "name": "limit", + "in": "query", + "description": "max records to return", + "required": true, + "schema" : { + "type": "integer", + "format": "int32" + } + } + }, + "responses": { + "NotFound": { + "description": "Entity not found." + }, + "IllegalInput": { + "description": "Illegal input for operation." + }, + "GeneralError": { + "description": "General Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralError" + } + } + } + } + }, + "securitySchemes": { + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "http://example.org/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + } + } +} +``` + +```yaml +components: + schemas: + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limit + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 + responses: + NotFound: + description: Entity not found. + IllegalInput: + description: Illegal input for operation. + GeneralError: + description: General Error + content: + application/json: + schema: + $ref: '#/components/schemas/GeneralError' + securitySchemes: + api_key: + type: apiKey + name: api_key + in: header + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Paths Object + +Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Templating Matching + +Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used: + +``` + /pets/{petId} + /pets/mine +``` + +The following paths are considered identical and invalid: + +``` + /pets/{petId} + /pets/{name} +``` + +The following may lead to ambiguous resolution: + +``` + /{entity}/me + /books/{id} +``` + +##### Paths Object Example + +```json +{ + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to", + "responses": { + "200": { + "description": "A list of pets.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pet" + } + } + } + } + } + } + } + } +} +``` + +```yaml +/pets: + get: + description: Returns all pets from the system that the user has access to + responses: + '200': + description: A list of pets. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/pet' +``` + +#### Path Item Object + +Describes the operations available on a single path. +A Path Item MAY be empty, due to [ACL constraints](#securityFiltering). +The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +$ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +summary| `string` | An optional, string summary, intended to apply to all operations in this path. +description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +get | [Operation Object](#operationObject) | A definition of a GET operation on this path. +put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. +post | [Operation Object](#operationObject) | A definition of a POST operation on this path. +delete | [Operation Object](#operationObject) | A definition of a DELETE operation on this path. +options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. +head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. +patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service all operations in this path. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Item Object Example + +```json +{ + "get": { + "description": "Returns pets based on ID", + "summary": "Find pets by ID", + "operationId": "getPetsById", + "responses": { + "200": { + "description": "pet response", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "default": { + "description": "error payload", + "content": { + "text/html": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to use", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "simple" + } + ] +} +``` + +```yaml +get: + description: Returns pets based on ID + summary: Find pets by ID + operationId: getPetsById + responses: + '200': + description: pet response + content: + '*/*' : + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: error payload + content: + 'text/html': + schema: + $ref: '#/components/schemas/ErrorModel' +parameters: +- name: id + in: path + description: ID of pet to use + required: true + schema: + type: array + style: simple + items: + type: string +``` + +#### Operation Object + +Describes a single API operation on a path. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +summary | `string` | A short summary of what the operation does. +description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). +requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Operation Object Example + +```json +{ + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "operationId": "updatePetWithForm", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be updated", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "description": "Updated name of the pet", + "type": "string" + }, + "status": { + "description": "Updated status of the pet", + "type": "string" + } + }, + "required": ["status"] + } + } + } + }, + "responses": { + "200": { + "description": "Pet updated.", + "content": { + "application/json": {}, + "application/xml": {} + } + }, + "405": { + "description": "Invalid input", + "content": { + "application/json": {}, + "application/xml": {} + } + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] +} +``` + +```yaml +tags: +- pet +summary: Updates a pet in the store with form data +operationId: updatePetWithForm +parameters: +- name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string +requestBody: + content: + 'application/x-www-form-urlencoded': + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status +responses: + '200': + description: Pet updated. + content: + 'application/json': {} + 'application/xml': {} + '405': + description: Invalid input + content: + 'application/json': {} + 'application/xml': {} +security: +- petstore_auth: + - write:pets + - read:pets +``` + + +#### External Documentation Object + +Allows referencing an external resource for extended documentation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### External Documentation Object Example + +```json +{ + "description": "Find more info here", + "url": "https://example.com" +} +``` + +```yaml +description: Find more info here +url: https://example.com +``` + +#### Parameter Object + +Describes a single operation parameter. + +A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). + +##### Parameter Locations +There are four possible parameter locations specified by the `in` field: +* path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. +* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +* cookie - Used to pass a specific cookie value to the API. + + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
+in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". +description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. + deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. + +The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. + +Field Name | Type | Description +---|:---:|--- +style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. + +For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. +A parameter MUST contain either a `schema` property, or a `content` property, but not both. +When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. + + +Field Name | Type | Description +---|:---:|--- +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. + +##### Style Values + +In order to support common ways of serializing simple parameters, a set of `style` values are defined. + +`style` | [`type`](#dataTypes) | `in` | Comments +----------- | ------ | -------- | -------- +matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) +label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0. +simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0. +spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. +pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. +deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. + + +##### Style Examples + +Assume a parameter named `color` has one of the following values: + +``` + string -> "blue" + array -> ["blue","black","brown"] + object -> { "R": 100, "G": 200, "B": 150 } +``` +The following table shows examples of rendering differences for each value. + +[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` +----------- | ------ | -------- | -------- | --------|------- +matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 +matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 +label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 +label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 +form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 +form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 +simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 +simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150 +spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 +pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 +deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Parameter Object Examples + +A header parameter with an array of 64 bit integer numbers: + +```json +{ + "name": "token", + "in": "header", + "description": "token to be passed as a header", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "style": "simple" +} +``` + +```yaml +name: token +in: header +description: token to be passed as a header +required: true +schema: + type: array + items: + type: integer + format: int64 +style: simple +``` + +A path parameter of a string value: +```json +{ + "name": "username", + "in": "path", + "description": "username to fetch", + "required": true, + "schema": { + "type": "string" + } +} +``` + +```yaml +name: username +in: path +description: username to fetch +required: true +schema: + type: string +``` + +An optional query parameter of a string value, allowing multiple values by repeating the query parameter: +```json +{ + "name": "id", + "in": "query", + "description": "ID of the object to fetch", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "form", + "explode": true +} +``` + +```yaml +name: id +in: query +description: ID of the object to fetch +required: false +schema: + type: array + items: + type: string +style: form +explode: true +``` + +A free-form query parameter, allowing undefined parameters of a specific type: +```json +{ + "in": "query", + "name": "freeForm", + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer" + }, + }, + "style": "form" +} +``` + +```yaml +in: query +name: freeForm +schema: + type: object + additionalProperties: + type: integer +style: form +``` + +A complex parameter using `content` to define serialization: + +```json +{ + "in": "query", + "name": "coordinates", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "lat", + "long" + ], + "properties": { + "lat": { + "type": "number" + }, + "long": { + "type": "number" + } + } + } + } + } +} +``` + +```yaml +in: query +name: coordinates +content: + application/json: + schema: + type: object + required: + - lat + - long + properties: + lat: + type: number + long: + type: number +``` + +#### Request Body Object + +Describes a single request body. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Request Body Examples + +A request body with a referenced model definition. +```json +{ + "description": "user to add to the system", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User Example", + "externalValue": "http://foo.bar/examples/user-example.json" + } + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User example in XML", + "externalValue": "http://foo.bar/examples/user-example.xml" + } + } + }, + "text/plain": { + "examples": { + "user" : { + "summary": "User example in Plain text", + "externalValue": "http://foo.bar/examples/user-example.txt" + } + } + }, + "*/*": { + "examples": { + "user" : { + "summary": "User example in other format", + "externalValue": "http://foo.bar/examples/user-example.whatever" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +content: + 'application/json': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example + externalValue: 'http://foo.bar/examples/user-example.json' + 'application/xml': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example in XML + externalValue: 'http://foo.bar/examples/user-example.xml' + 'text/plain': + examples: + user: + summary: User example in text plain format + externalValue: 'http://foo.bar/examples/user-example.txt' + '*/*': + examples: + user: + summary: User example in other format + externalValue: 'http://foo.bar/examples/user-example.whatever' +``` + +A body parameter that is an array of string values: +```json +{ + "description": "user to add to the system", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +required: true +content: + text/plain: + schema: + type: array + items: + type: string +``` + + +#### Media Type Object +Each Media Type Object provides schema and examples for the media type identified by its key. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Media Type Examples + +```js +{ + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + }, + "examples": { + "cat" : { + "summary": "An example of a cat", + "value": + { + "name": "Fluffy", + "petType": "Cat", + "color": "White", + "gender": "male", + "breed": "Persian" + } + }, + "dog": { + "summary": "An example of a dog with a cat's name", + "value" : { + "name": "Puma", + "petType": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + }, + "frog": { + "$ref": "#/components/examples/frog-example" + } + } + } + } +} +``` + +```yaml +application/json: + schema: + $ref: "#/components/schemas/Pet" + examples: + cat: + summary: An example of a cat + value: + name: Fluffy + petType: Cat + color: White + gender: male + breed: Persian + dog: + summary: An example of a dog with a cat's name + value: + name: Puma + petType: Dog + color: Black + gender: Female + breed: Mixed + frog: + $ref: "#/components/examples/frog-example" +``` + +##### Considerations for File Uploads + +In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: + +```yaml +# content transferred with base64 encoding +schema: + type: string + format: base64 +``` + +```yaml +# content transferred in binary (octet-stream): +schema: + type: string + format: binary +``` + +These examples apply to either input payloads of file uploads or response payloads. + +A `requestBody` for submitting a file in a `POST` operation may look like the following example: + +```yaml +requestBody: + content: + application/octet-stream: + # any media type is accepted, functionally equivalent to `*/*` + schema: + # a binary file of any type + type: string + format: binary +``` + +In addition, specific media types MAY be specified: + +```yaml +# multiple, specific media types may be specified: +requestBody: + content: + # a binary file of type png or jpeg + 'image/jpeg': + schema: + type: string + format: binary + 'image/png': + schema: + type: string + format: binary +``` + +To upload multiple files, a `multipart` media type MUST be used: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + properties: + # The property name 'file' will be used for all files. + file: + type: array + items: + type: string + format: binary + +``` + +##### Support for x-www-form-urlencoded Request Bodies + +To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following +definition may be used: + +```yaml +requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # complex types are stringified to support RFC 1866 + type: object + properties: {} +``` + +In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. + +When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. + +##### Special Considerations for `multipart` Content + +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads. + +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart`: + +* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` +* If the property is complex, or an array of complex values, the default Content-Type is `application/json` +* If the property is a `type: string` with `format: binary` or `format: base64` (aka a file object), the default Content-Type is `application/octet-stream` + + +Examples: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # default Content-Type for objects is `application/json` + type: object + properties: {} + profileImage: + # default Content-Type for string/binary is `application/octet-stream` + type: string + format: binary + children: + # default Content-Type for arrays is based on the `inner` type (text/plain here) + type: array + items: + type: string + addresses: + # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example) + type: array + items: + type: '#/components/schemas/Address' +``` + +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart` and `application/x-www-form-urlencoded` request bodies. + +#### Encoding Object + +A single encoding definition applied to a single schema property. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Encoding Object Example + +```yaml +requestBody: + content: + multipart/mixed: + schema: + type: object + properties: + id: + # default is text/plain + type: string + format: uuid + address: + # default is application/json + type: object + properties: {} + historyMetadata: + # need to declare XML format! + description: metadata in XML format + type: object + properties: {} + profileImage: + # default is application/octet-stream, need to declare an image type only! + type: string + format: binary + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer +``` + +#### Responses Object + +A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response. + +The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors. + +The `default` MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification. + +The `Responses Object` MUST contain at least one response code, and it +SHOULD be the response for a successful operation call. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A [Reference Object](#referenceObject) can link to a response that the [OpenAPI Object's components/responses](#componentsResponses) section defines. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Responses Object Example + +A 200 response for a successful operation and a default response for others (implying an error): + +```json +{ + "200": { + "description": "a pet to be returned", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } +} +``` + +```yaml +'200': + description: a pet to be returned + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' +``` + +#### Response Object +Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Response Object Examples + +Response of an array of a complex type: + +```json +{ + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VeryComplexType" + } + } + } + } +} +``` + +```yaml +description: A complex object array response +content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/VeryComplexType' +``` + +Response with a string type: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + +} +``` + +```yaml +description: A simple string response +representations: + text/plain: + schema: + type: string +``` + +Plain text response with headers: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + }, + "headers": { + "X-Rate-Limit-Limit": { + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Remaining": { + "description": "The number of remaining requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Reset": { + "description": "The number of seconds left in the current period", + "schema": { + "type": "integer" + } + } + } +} +``` + +```yaml +description: A simple string response +content: + text/plain: + schema: + type: string + example: 'whoa!' +headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer + X-Rate-Limit-Remaining: + description: The number of remaining requests in the current period + schema: + type: integer + X-Rate-Limit-Reset: + description: The number of seconds left in the current period + schema: + type: integer +``` + +Response with no return value: + +```json +{ + "description": "object created" +} +``` + +```yaml +description: object created +``` + +#### Callback Object + +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Key Expression + +The key that identifies the [Path Item Object](#pathItemObject) is a [runtime expression](#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be `$request.body#/url`. +However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference. + +For example, given the following HTTP request: + +```http +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 +Host: example.org +Content-Type: application/json +Content-Length: 187 + +{ + "failedUrl" : "http://clientdomain.com/failed", + "successUrls" : [ + "http://clientdomain.com/fast", + "http://clientdomain.com/medium", + "http://clientdomain.com/slow" + ] +} + +201 Created +Location: http://example.org/subscription/1 +``` + +The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. + +Expression | Value +---|:--- +$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +$method | POST +$request.path.eventType | myevent +$request.query.queryUrl | http://clientdomain.com/stillrunning +$request.header.content-Type | application/json +$request.body#/failedUrl | http://clientdomain.com/stillrunning +$request.body#/successUrls/2 | http://clientdomain.com/medium +$response.header.Location | http://example.org/subscription/1 + + +##### Callback Object Example + +The following example shows a callback to the URL specified by the `id` and `email` property in the request body. + +```yaml +myWebhook: + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': + post: + requestBody: + description: Callback payload + content: + 'application/json': + schema: + $ref: '#/components/schemas/SomePayload' + responses: + '200': + description: webhook successfully processed and no retries will be performed +``` + + +#### Example Object + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +summary | `string` | Short description for the example. +description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible. + +##### Example Object Example + +```yaml +# in a model +schemas: + properties: + name: + type: string + examples: + name: + $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example + +# in a request body: + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + summary: A foo example + value: {"foo": "bar"} + bar: + summary: A bar example + value: {"bar": "baz"} + 'application/xml': + examples: + xmlExample: + summary: This is an example in XML + externalValue: 'http://example.org/examples/address-example.xml' + 'text/plain': + examples: + textExample: + summary: This is a text example + externalValue: 'http://foo.bar/examples/address-example.txt' + + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + examples: + zip-example: + $ref: '#/components/examples/zip-example' + +# in a response + responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + examples: + confirmation-success: + $ref: '#/components/examples/confirmation-success' +``` + + +#### Link Object + +The `Link object` represents a possible design-time link for a response. +The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. + +Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. + +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OpenAPI definition. +operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). +requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. +description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +server | [Server Object](#serverObject) | A server object to be used by the target operation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +A linked operation MUST be identified using either an `operationRef` or `operationId`. +In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the `operationRef` syntax is preferred +for specifications with external references. + +##### Examples + +Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation. + +```yaml +paths: + /users/{id}: + parameters: + - name: id + in: path + required: true + description: the user identifier, as userId + schema: + type: string + get: + responses: + '200': + description: the user being returned + content: + application/json: + schema: + type: object + properties: + uuid: # the unique user id + type: string + format: uuid + links: + address: + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: $request.path.id + # the path item of the linked operation + /users/{userid}/address: + parameters: + - name: userid + in: path + required: true + description: the user identifier, as userId + schema: + type: string + # linked operation + get: + operationId: getUserAddress + responses: + '200': + description: the user's address +``` + +When a runtime expression fails to evaluate, no parameter value is passed to the target operation. + +Values from the response body can be used to drive a linked operation. + +```yaml +links: + address: + operationId: getUserAddressByUUID + parameters: + # get the `id` field from the request path parameter named `id` + userUuid: $response.body#/uuid +``` + +Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship. + + +##### OperationRef Examples + +As references to `operationId` MAY NOT be possible (the `operationId` is an optional +value), references MAY also be made through a relative `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: '#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +or an absolute `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when +using JSON references. + + +##### Runtime Expressions + +Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#callbackObject). + +The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source ) + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body" ["#" fragment] + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + +The table below provides examples of runtime expressions and examples of their use in a value: + +##### Examples + +Source Location | example expression | notes +---|:---|:---| +HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. +Requested media type | `$request.header.accept` | +Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. +Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. +Request URL | `$url` | +Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. +Response header | `$response.header.Server` | Single header values only are available + +Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. + +#### Header Object + +The Header Object follows the structure of the [Parameter Object](#parameterObject) with the following changes: + +1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. +1. `in` MUST NOT be specified, it is implicitly in `header`. +1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). + +##### Header Object Example + +A simple header of type `integer`: + +```json +{ + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } +} +``` + +```yaml +description: The number of allowed requests in the current period +schema: + type: integer +``` + +#### Tag Object + +Adds metadata to a single tag that is used by the [Operation Object](#operationObject). +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the tag. +description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Tag Object Example + +```json +{ + "name": "pet", + "description": "Pets operations" +} +``` + +```yaml +name: pet +description: Pets operations +``` + +#### Examples Object + +In an `example`, a JSON Reference MAY be used, with the +explicit restriction that examples having a JSON format with object named +`$ref` are not allowed. Therefore, that `example`, structurally, can be +either a string primitive or an object, similar to `additionalProperties`. + +In all cases, the payload is expected to be compatible with the type schema +for the associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are incompatible. + +```yaml +# in a model +schemas: + properties: + name: + type: string + example: + $ref: http://foo.bar#/examples/name-example + +# in a request body, note the plural `examples` + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + value: {"foo": "bar"} + bar: + value: {"bar": "baz"} + 'application/xml': + examples: + xml: + externalValue: 'http://foo.bar/examples/address-example.xml' + 'text/plain': + examples: + text: + externalValue: 'http://foo.bar/examples/address-example.txt' + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + example: + $ref: 'http://foo.bar#/examples/zip-example' + +# in a response, note the singular `example`: + responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + example: + $ref: http://foo.bar#/examples/address-example.json +``` + +#### Reference Object + +A simple object to allow referencing other components in the specification, internally and externally. + +The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. + +For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +$ref | `string` | **REQUIRED**. The reference string. + +This object cannot be extended with additional properties and any properties added SHALL be ignored. + +##### Reference Object Example + +```json +{ + "$ref": "#/components/schemas/Pet" +} +``` + +```yaml +$ref: '#/components/schemas/Pet' +``` + +##### Relative Schema Document Example +```json +{ + "$ref": "Pet.json" +} +``` + +```yaml +$ref: Pet.yaml +``` + +##### Relative Documents With Embedded Schema Example +```json +{ + "$ref": "definitions.json#/Pet" +} +``` + +```yaml +$ref: definitions.yaml#/Pet +``` + +#### Schema Object + +The Schema Object allows the definition of input and output data types. +These types can be objects, but also primitives and arrays. +This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). + +For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). +Unless stated otherwise, the property definitions follow the JSON Schema. + +##### Properties + +The following properties are taken directly from the JSON Schema definition and follow the same specifications: + +- title +- multipleOf +- maximum +- exclusiveMaximum +- minimum +- exclusiveMinimum +- maxLength +- minLength +- pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5) dialect) +- maxItems +- minItems +- uniqueItems +- maxProperties +- minProperties +- required +- enum + +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. +- type - Value MUST be a string. Multiple types via an array are not supported. +- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. +- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. + +Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline. + +Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. + +Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation: + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. +discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. +example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. + deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +###### Composition and Inheritance (Polymorphism) + +The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. +`allOf` takes an array of object definitions that are validated *independently* but together compose a single object. + +While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the `discriminator` field. +When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model. +As such, the `discriminator` field MUST be a required field. +There are are two ways to define the value of a discriminator for an inheriting instance. +- Use the schema name. +- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. +As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. + +###### XML Modeling + +The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. +The [XML Object](#xmlObject) contains additional information about the available options. + +##### Schema Object Examples + +###### Primitive Sample + +```json +{ + "type": "string", + "format": "email" +} +``` + +```yaml +type: string +format: email +``` + +###### Simple Model + +```json +{ + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "age": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + } +} +``` + +```yaml +type: object +required: +- name +properties: + name: + type: string + address: + $ref: '#/components/schemas/Address' + age: + type: integer + format: int32 + minimum: 0 +``` + +###### Model with Map/Dictionary Properties + +For a simple string to string mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "type": "string" + } +} +``` + +```yaml +type: object +additionalProperties: + type: string +``` + +For a string to model mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ComplexModel" + } +} +``` + +```yaml +type: object +additionalProperties: + $ref: '#/components/schemas/ComplexModel' +``` + +###### Model with Example + +```json +{ + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "example": { + "name": "Puma", + "id": 1 + } +} +``` + +```yaml +type: object +properties: + id: + type: integer + format: int64 + name: + type: string +required: +- name +example: + name: Puma + id: 1 +``` + +###### Models with Composition + +```json +{ + "components": { + "schemas": { + "ErrorModel": { + "type": "object", + "required": [ + "message", + "code" + ], + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer", + "minimum": 100, + "maximum": 600 + } + } + }, + "ExtendedErrorModel": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorModel" + }, + { + "type": "object", + "required": [ + "rootCause" + ], + "properties": { + "rootCause": { + "type": "string" + } + } + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + ErrorModel: + type: object + required: + - message + - code + properties: + message: + type: string + code: + type: integer + minimum: 100 + maximum: 600 + ExtendedErrorModel: + allOf: + - $ref: '#/components/schemas/ErrorModel' + - type: object + required: + - rootCause + properties: + rootCause: + type: string +``` + +###### Models with Polymorphism Support + +```json +{ + "components": { + "schemas": { + "Pet": { + "type": "object", + "discriminator": { + "propertyName": "petType" + }, + "properties": { + "name": { + "type": "string" + }, + "petType": { + "type": "string" + } + }, + "required": [ + "name", + "petType" + ] + }, + "Cat": { + "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "huntingSkill": { + "type": "string", + "description": "The measured skill for hunting", + "default": "lazy", + "enum": [ + "clueless", + "lazy", + "adventurous", + "aggressive" + ] + } + }, + "required": [ + "huntingSkill" + ] + } + ] + }, + "Dog": { + "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "packSize": { + "type": "integer", + "format": "int32", + "description": "the size of the pack the dog is from", + "default": 0, + "minimum": 0 + } + }, + "required": [ + "packSize" + ] + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: ## "Cat" will be used as the discriminator value + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: ## "Dog" will be used as the discriminator value + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize +``` + +#### Discriminator Object + +When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. + +When using the discriminator, _inline_ schemas will not be considered. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. + mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. + +The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. + +In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' +``` + +which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: + + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: pet_type +``` + +The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: + +``` +{ + "id": 12345, + "pet_type": "Cat" +} +``` + +Will indicate that the `Cat` schema be used in conjunction with this payload. + +In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' +``` + +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison. + +When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. + +In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema. + +For example: + +``` +components: + schemas: + Pet: + type: object + required: + - pet_type + properties: + pet_type: + type: string + discriminator: + propertyName: pet_type + mapping: + cachorro: Dog + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Cat` + properties: + name: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Dog` + properties: + bark: + type: string + Lizard: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Lizard` + properties: + lovesRocks: + type: boolean +``` + +a payload like this: + +``` +{ + "pet_type": "Cat", + "name": "misty" +} +``` + +will indicate that the `Cat` schema be used. Likewise this schema: + +``` +{ + "pet_type": "cachorro", + "bark": "soft" +} +``` + +will map to `Dog` because of the definition in the `mappings` element. + + +#### XML Object + +A metadata object that allows for more fine-tuned XML model definitions. + +When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. +See examples for expected behavior. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. +namespace | `string` | The URI of the namespace definition. Value MUST be in the form of an absolute URI. +prefix | `string` | The prefix to be used for the [name](#xmlName). +attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. +wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### XML Object Examples + +The examples of the XML object definitions are included inside a property definition of a [Schema Object](#schemaObject) with a sample of the XML representation of it. + +###### No XML Element + +Basic string property: + +```json +{ + "animals": { + "type": "string" + } +} +``` + +```yaml +animals: + type: string +``` + +```xml +... +``` + +Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default): + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string +``` + +```xml +... +... +... +``` + +###### XML Name Replacement + +```json +{ + "animals": { + "type": "string", + "xml": { + "name": "animal" + } + } +} +``` + +```yaml +animals: + type: string + xml: + name: animal +``` + +```xml +... +``` + + +###### XML Attribute, Prefix and Namespace + +In this example, a full model definition is shown. + +```json +{ + "Person": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "xml": { + "attribute": true + } + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://example.com/schema/sample", + "prefix": "sample" + } + } + } + } +} +``` + +```yaml +Person: + type: object + properties: + id: + type: integer + format: int32 + xml: + attribute: true + name: + type: string + xml: + namespace: http://example.com/schema/sample + prefix: sample +``` + +```xml + + example + +``` + +###### XML Arrays + +Changing the element names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal +``` + +```xml +value +value +``` + +The external `name` property has no effect on the XML: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens +``` + +```xml +value +value +``` + +Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +To overcome the naming problem in the example above, the following definition can be used: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +Affecting both internal and external names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +If we change the external element but not the internal ones: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +#### Security Scheme Object + +Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06). + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. +description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +name | `string` | `apiKey` | **REQUIRED**. The name of the header, query or cookie parameter to be used. +in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. +scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). +bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. +openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Security Scheme Object Example + +###### Basic Authentication Sample + +```json +{ + "type": "http", + "scheme": "basic" +} +``` + +```yaml +type: http +scheme: basic +``` + +###### API Key Sample + +```json +{ + "type": "apiKey", + "name": "api_key", + "in": "header" +} +``` + +```yaml +type: apiKey +name: api_key +in: header +``` + +###### JWT Bearer Sample + +```json +{ + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT", +} +``` + +```yaml +type: http +scheme: bearer +bearerFormat: JWT +``` + +###### Implicit OAuth2 Sample + +```json +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```yaml +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### OAuth Flows Object + +Allows configuration of the supported OAuth Flows. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow +password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### OAuth Flow Object + +Configuration details for a supported OAuth Flow + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### OAuth Flow Object Examples + +```JSON +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```YAML +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + authorizationCode: + authorizationUrl: https://example.com/api/oauth/dialog + tokenUrl: https://example.com/api/oauth/token + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Security Requirement Object + +Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). + +Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. + +When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. + +##### Security Requirement Object Examples + +###### Non-OAuth2 Security Requirement + +```json +{ + "api_key": [] +} +``` + +```yaml +api_key: [] +``` + +###### OAuth2 Security Requirement + +```json +{ + "petstore_auth": [ + "write:pets", + "read:pets" + ] +} +``` + +```yaml +petstore_auth: +- write:pets +- read:pets +``` + +### Specification Extensions + +While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. + +The extensions properties are implemented as patterned fields that are always prefixed by `"x-"`. + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. Can have any valid JSON format value. + +The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced). + +### Security Filtering + +Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation. + +The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization. + +Two examples of this: + +1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. + +## Appendix A: Revision History + +Version | Date | Notes +--- | --- | --- +3.0.1 | TBA | TBA +3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 +3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification +3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification +3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification From 32eada766caaaab9b8211e2b02ede01057d22df1 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 21 Aug 2017 11:55:52 -0700 Subject: [PATCH 0547/1801] updated development guidelines --- DEVELOPMENT.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d5f6fff76b..e4a2bd29fb 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,6 +1,6 @@ ## Development Guidelines -This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Contributor Board will initially follow these processes when merging changes from external contributors or from the TCB itself. This guideline document will be adjusted as practicality dictates. +This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Developer Community will initially follow these processes when merging changes from external contributors or from the TDC itself. This guideline document will be adjusted as practicality dictates. ## OAI Specification Driving factors @@ -21,14 +21,19 @@ The specification _will change_ from the original 2.0 version. We should typica - Use GitHub for all spec designs, use cases, and so on. - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.0.md for example). - - The `master` branch shall remain the current, released OpenAPI Specification (i.e., 2.0). We will work in an OpenAPI.next branch, which shall be described and linked to on the **default** README.md on master. + - At any given time, there would be _at most_ 4 work branches. The branches would exist if work has started on them. Assuming a current version of 3.0.0: + - `master` - Current stable version. No PRs would be accepted directly to modify the specification. PRs against supporting files can be accepted. + - `v3.0.1` - The next PATCH version of the specification. This would include non-breaking changes such as typo fixes, document fixes, wording clarifications. + - `v3.1.0` - The naxt MINOR version. + - `v4.0.0` - The next MAJOR version. + - The `master` branch shall remain the current, released OpenAPI Specification. We will describe and link the work branch(es) on the **default** README.md on master. - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal. - - New features should be done in feature branches which, upon approval, are merged into the OpenAPI.next branch. + - New features should be done in feature branches/forks which, upon approval, are merged into the proper work branch. - Use labels for the workflow of specification changes. Examples of labels are `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, and `needs approval`. These labels must be assigned by project committers. - An issue will be opened for each feature change. Embedded in the issue, or ideally linked in a file via pull-request (PR), a document about use cases should be supplied with the change. - A PR will be used to describe the _proposed_ solution, and linked to the original issue. - Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel. - - When the OpenApi.next spec is complete and approved for release, the branch will be merged to master. + - When the a work branch is ready and approved, the branch will be merged to master. ## Approving Changes From dc6ddf320800d31e5207305edce3747d32dbf196 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 21 Aug 2017 11:59:16 -0700 Subject: [PATCH 0548/1801] Link to the next version --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7eaf9ba26d..f2f1f82cd4 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ Here you will find the information you need about the OpenAPI Specification, sim The current version of the OpenAPI specification is [OpenAPI Specification 3.0](versions/3.0.0.md). +### Future Versions + +[3.0.1](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.1) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. + ### Previous Versions This repository also contains the [OpenAPI Specification 2.0](versions/2.0.md), which is identical to the Swagger 2.0 specification before it was renamed to “OpenAPI Specification”, From 67ce0be9541ec94fa7eb232a6fbf9958d8018249 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 21 Aug 2017 15:14:15 -0400 Subject: [PATCH 0549/1801] Fixed typo --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e4a2bd29fb..698eccfb69 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -24,7 +24,7 @@ The specification _will change_ from the original 2.0 version. We should typica - At any given time, there would be _at most_ 4 work branches. The branches would exist if work has started on them. Assuming a current version of 3.0.0: - `master` - Current stable version. No PRs would be accepted directly to modify the specification. PRs against supporting files can be accepted. - `v3.0.1` - The next PATCH version of the specification. This would include non-breaking changes such as typo fixes, document fixes, wording clarifications. - - `v3.1.0` - The naxt MINOR version. + - `v3.1.0` - The next MINOR version. - `v4.0.0` - The next MAJOR version. - The `master` branch shall remain the current, released OpenAPI Specification. We will describe and link the work branch(es) on the **default** README.md on master. - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal. From e36f3f97a0a8e1b1997c203454a8140e707496ef Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Mon, 21 Aug 2017 21:18:19 +0200 Subject: [PATCH 0550/1801] Fixed 2 times typo --- versions/3.0.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 906c1f96c1..7318b8024c 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -2367,7 +2367,7 @@ While composition offers model extensibility, it does not imply a hierarchy betw To support polymorphism, the OpenAPI Specification adds the `discriminator` field. When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model. As such, the `discriminator` field MUST be a required field. -There are are two ways to define the value of a discriminator for an inheriting instance. +There are two ways to define the value of a discriminator for an inheriting instance. - Use the schema name. - Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. From 630ba04ca102c9ef805aa4aea697a387a92a60b0 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 21 Aug 2017 12:43:38 -0700 Subject: [PATCH 0551/1801] Remove Examples Object --- versions/3.0.1.md | 62 ----------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 906c1f96c1..526cea9dd9 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -2183,68 +2183,6 @@ name: pet description: Pets operations ``` -#### Examples Object - -In an `example`, a JSON Reference MAY be used, with the -explicit restriction that examples having a JSON format with object named -`$ref` are not allowed. Therefore, that `example`, structurally, can be -either a string primitive or an object, similar to `additionalProperties`. - -In all cases, the payload is expected to be compatible with the type schema -for the associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are incompatible. - -```yaml -# in a model -schemas: - properties: - name: - type: string - example: - $ref: http://foo.bar#/examples/name-example - -# in a request body, note the plural `examples` - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Address' - examples: - foo: - value: {"foo": "bar"} - bar: - value: {"bar": "baz"} - 'application/xml': - examples: - xml: - externalValue: 'http://foo.bar/examples/address-example.xml' - 'text/plain': - examples: - text: - externalValue: 'http://foo.bar/examples/address-example.txt' - -# in a parameter - parameters: - - name: 'zipCode' - in: 'query' - schema: - type: 'string' - format: 'zip-code' - example: - $ref: 'http://foo.bar#/examples/zip-example' - -# in a response, note the singular `example`: - responses: - '200': - description: your car appointment has been booked - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessResponse' - example: - $ref: http://foo.bar#/examples/address-example.json -``` #### Reference Object From 114b4b75446dfbc1707d9958d2b9a8a2ae2904f5 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 21 Aug 2017 13:03:42 -0700 Subject: [PATCH 0552/1801] object -> field --- versions/3.0.1.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 906c1f96c1..fd2173d52c 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -1004,8 +1004,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. -example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. @@ -1343,8 +1343,8 @@ Each Media Type Object provides schema and examples for the media type identifie Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. -example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. This object MAY be extended with [Specification Extensions](#specificationExtensions). From 70cedc9ead883ebb8d639c4eb7759065313722b6 Mon Sep 17 00:00:00 2001 From: Brendan Abbott Date: Fri, 14 Jul 2017 17:57:10 +1000 Subject: [PATCH 0553/1801] Add lincoln and serverless-openapi-documentation projects to the IMPLEMENTATIONS.md --- IMPLEMENTATIONS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index fcd8296140..96a2a2d6c1 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -32,6 +32,7 @@ These tools are not necessarily endorsed by the OAI. |----------------|--------------|----------|---------------------| | openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | | swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | +| lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | #### Server Implementations @@ -43,3 +44,4 @@ These tools are not necessarily endorsed by the OAI. |----------------|--------------|----------|---------------------| | baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | | Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | +| serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | From f75f8486a1aae1a7ceef92fbc63692cb2556c0cd Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Tue, 22 Aug 2017 19:28:49 +0300 Subject: [PATCH 0554/1801] Change response code quoting style from " to ' for consistency --- examples/v3.0/api-with-examples.yaml | 8 ++++---- examples/v3.0/uber.yaml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml index ae491420e5..dd42b0e959 100644 --- a/examples/v3.0/api-with-examples.yaml +++ b/examples/v3.0/api-with-examples.yaml @@ -8,7 +8,7 @@ paths: operationId: listVersionsv2 summary: List API versions responses: - "200": + '200': description: |- 200 response content: @@ -41,7 +41,7 @@ paths: } ] } - "300": + '300': description: |- 300 response content: @@ -80,7 +80,7 @@ paths: operationId: getVersionDetailsv2 summary: Show API version details responses: - "200": + '200': description: |- 200 response content: @@ -125,7 +125,7 @@ paths: ] } } - "203": + '203': description: |- 203 response content: diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml index 735b8c8ed0..8b94db300f 100644 --- a/examples/v3.0/uber.yaml +++ b/examples/v3.0/uber.yaml @@ -32,7 +32,7 @@ paths: tags: - Products responses: - "200": + '200': description: An array of products content: application/json: @@ -80,7 +80,7 @@ paths: tags: - Estimates responses: - "200": + '200': description: An array of price estimates by product content: application/json: @@ -127,7 +127,7 @@ paths: tags: - Estimates responses: - "200": + '200': description: An array of products content: application/json: @@ -148,7 +148,7 @@ paths: tags: - User responses: - "200": + '200': description: Profile information for a user content: application/json: @@ -180,7 +180,7 @@ paths: tags: - User responses: - "200": + '200': description: History information for the given user content: application/json: From 949c89c1a89a1ef1f10f995bce931e71f0cfe8e0 Mon Sep 17 00:00:00 2001 From: Helen Kosova Date: Wed, 23 Aug 2017 10:36:32 +0300 Subject: [PATCH 0555/1801] Fix indents in the links example --- versions/3.0.1.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 906c1f96c1..f600999513 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -2018,13 +2018,13 @@ paths: uuid: # the unique user id type: string format: uuid - links: - address: - # the target link operationId - operationId: getUserAddress - parameters: - # get the `id` field from the request path parameter named `id` - userId: $request.path.id + links: + address: + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: $request.path.id # the path item of the linked operation /users/{userid}/address: parameters: @@ -2034,12 +2034,12 @@ paths: description: the user identifier, as userId schema: type: string - # linked operation - get: - operationId: getUserAddress - responses: - '200': - description: the user's address + # linked operation + get: + operationId: getUserAddress + responses: + '200': + description: the user's address ``` When a runtime expression fails to evaluate, no parameter value is passed to the target operation. From 88cd94419e117b154b67b834fa8e471bb98bd346 Mon Sep 17 00:00:00 2001 From: Christophe Vidal Date: Sun, 27 Aug 2017 23:06:51 +0700 Subject: [PATCH 0556/1801] Fixed JSON Schema description for ResponsesDefinitions --- 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 f12a8c0e47..a92e18f2a5 100644 --- a/schemas/v2.0/schema.json +++ b/schemas/v2.0/schema.json @@ -203,7 +203,7 @@ "additionalProperties": { "$ref": "#/definitions/response" }, - "description": "One or more JSON representations for parameters" + "description": "One or more JSON representations for responses" }, "externalDocs": { "type": "object", From 775f9b368b8e6d1154e772f2a19b2942bd27613d Mon Sep 17 00:00:00 2001 From: Eric Wittmann Date: Tue, 19 Sep 2017 15:23:02 -0400 Subject: [PATCH 0557/1801] Added Apicurio Studio to the list of IMPLS --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 96a2a2d6c1..6e1b903a71 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -21,6 +21,7 @@ These tools are not necessarily endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| +| Apicurio Studio | [GitHub/Apicurio/apicurio-studio](https://github.com/Apicurio/apicurio-studio) | Java/Typescript | Web-Based **visual designer** for OpenAPI 2.0 and 3.0.0. | | KaiZen OpenAPI Editor | [GitHub/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | | RepreZen API Studio | [RepreZen.com/OpenAPI](https://www.reprezen.com/OpenAPI) | Java | Commercial desktop IDE for API design, documentation & development | | OpenApi-gui | [GitHub/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenApi / Swagger definitions | From 103054f89d3334b42f6eeeb409e937746b004ff3 Mon Sep 17 00:00:00 2001 From: Aleksei Akimov Date: Sat, 23 Sep 2017 21:57:30 +0200 Subject: [PATCH 0558/1801] Update README Proposing a few small changes to improve readability. --- README.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1f694a5db4..c89cb10aca 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,15 @@ **This is the WIP branch for the next patch version of the spec - 3.0.1. Patch level corrections should be submitted against this branch, specifically against [3.0.1.md](https://github.com/OAI/OpenAPI-Specification/blob/v3.0.1/versions/3.0.1.md).** -The OpenAPI Specification is a community driven, open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. +The OpenAPI Specification is a community-driven open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. -The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. +The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for [REST APIs](https://en.wikipedia.org/wiki/Representational_state_transfer), which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. -Use cases for machine-readable API definition documents include, but are not limited to, interactive documentation; code generation for documentation, clients, and servers; and automation of test cases. OpenAPI documents describe an API's services and are represented in either YAML or JSON formats. These documents may either be produced and served statically or be generated dynamically from an application. +Use cases for machine-readable API definition documents include, but are not limited to: interactive documentation; code generation for documentation, clients, and servers; and automation of test cases. OpenAPI documents describe an API's services and are represented in either YAML or JSON formats. These documents may either be produced and served statically or be generated dynamically from an application. -The OpenAPI Specification does not require rewriting existing APIs. It does not require binding any software to a service—the service being described may not even be owned by the creator of its description. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI—this specification is not intended to cover every possible style of REST APIs. The OpenAPI Specification does not mandate a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. +The OpenAPI Specification does not require rewriting existing APIs. It does not require binding any software to a service — the service being described may not even be owned by the creator of its description. It does, however, require the capabilities of the service be described in the structure of the OpenAPI Specification. Not all services can be described by OpenAPI — this specification is not intended to cover every possible style of REST APIs. The OpenAPI Specification does not mandate a specific development process such as design-first or code-first. It does facilitate either technique by establishing clear interactions with a REST API. -This GitHub project is the starting point for OpenAPI. -Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, and some general information regarding the project. +This GitHub project is the starting point for OpenAPI. Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, and some general information regarding the project. ## Current Version - 3.0 @@ -23,8 +22,7 @@ The current version of the OpenAPI specification is [OpenAPI Specification 3.0]( ### Previous Versions -This repository also contains the [OpenAPI Specification 2.0](versions/2.0.md), which is identical to the Swagger 2.0 specification before it was renamed to “OpenAPI Specification”, -as well as the Swagger 1.2 and Swagger 2.0 specifications. +This repository also contains the [OpenAPI Specification 2.0](versions/2.0.md), which is identical to the Swagger 2.0 specification before it was renamed to "OpenAPI Specification", as well as the Swagger 1.2 and Swagger 2.0 specifications. Each folder in this repository, such as [examples](examples) and [schemas](schemas), should contain folders pertaining to the current and previous versions of the specification. @@ -35,7 +33,7 @@ If you just want to see it work, check out the [list of current examples](exampl ## Tools and Libraries Looking to see how you can create your own OpenAPI definition, present it, or otherwise use it? Check out the growing -[list of 3.0 Implementations](IMPLEMENTATIONS.md). +[list of 3.0 implementations](IMPLEMENTATIONS.md). ## Participation @@ -43,8 +41,7 @@ The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. -The Open API Initiative encourages participation from individuals and companies alike. -If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: +The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: * Review the [current specification](versions/3.0.0.md). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](DEVELOPMENT.md) process so you understand how the spec is evolving. @@ -55,8 +52,6 @@ Not all feedback can be accommodated and there may be solid arguments for or aga ## License - See: [License (Apache-2.0)](https://github.com/OAI/OpenAPI-Specification/blob/master/LICENSE) - ![Analytics](https://ga-beacon.appspot.com/UA-831873-42/readme.md?pixel) From 9b320b193c97407c018b668d11b0f1a3eb392787 Mon Sep 17 00:00:00 2001 From: Ted Epstein Date: Fri, 29 Sep 2017 17:02:21 -0400 Subject: [PATCH 0559/1801] Issue #1344 - Add TDC Calendar link to README #1344 - As discussed on today's TDC call. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2f1f82cd4..38f116a0d7 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,9 @@ Looking to see how you can create your own OpenAPI definition, present it, or ot The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). -Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. +Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community (TDC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. + +The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open the community. You can view the [TDC calendar online](https://calendar.google.com/calendar/embed?src=swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com), and import it to your calendar using the [iCal link](https://calendar.google.com/calendar/ical/swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com/public/basic.ics). The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From b066099fa10a5d03ff50153290d4a614746cd646 Mon Sep 17 00:00:00 2001 From: zhandao Date: Sun, 1 Oct 2017 23:17:32 +0800 Subject: [PATCH 0560/1801] add zero-rails_openapi to implementations --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 96a2a2d6c1..82fb80c54c 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -45,3 +45,4 @@ These tools are not necessarily endorsed by the OAI. | baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | | Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | | serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | +| zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | From fe0975d4922f92d971460f411e274b83b4e9a139 Mon Sep 17 00:00:00 2001 From: maverickelementalch Date: Fri, 13 Oct 2017 12:30:45 +0200 Subject: [PATCH 0561/1801] Update version in description to OpenAPI 3.0 --- examples/v3.0/petstore-expanded.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml index 6c6195199c..e8c0fe5ffd 100644 --- a/examples/v3.0/petstore-expanded.yaml +++ b/examples/v3.0/petstore-expanded.yaml @@ -2,7 +2,7 @@ openapi: "3.0.0" info: version: 1.0.0 title: Swagger Petstore - description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification termsOfService: http://swagger.io/terms/ contact: name: Swagger API Team From fe795e257453908f463211c83b38a944daf1aa89 Mon Sep 17 00:00:00 2001 From: Andy Lowry Date: Mon, 16 Oct 2017 10:59:14 -0400 Subject: [PATCH 0562/1801] [#1375] Add required props to callback example --- examples/v3.0/callback-example.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/v3.0/callback-example.yaml b/examples/v3.0/callback-example.yaml index 56ab18e27d..1622bd06b1 100644 --- a/examples/v3.0/callback-example.yaml +++ b/examples/v3.0/callback-example.yaml @@ -1,4 +1,7 @@ -# ... +openapi: 3.0.0 +info: + title: Callback Example + version: 1.0.0 paths: /streams: post: From 35210824bda34bb8f5e3b2814a2c0cfbb6a7814b Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Tue, 17 Oct 2017 08:52:20 -0700 Subject: [PATCH 0563/1801] Describe governance of TSC per #1358 --- GOVERNANCE.MD | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 GOVERNANCE.MD diff --git a/GOVERNANCE.MD b/GOVERNANCE.MD new file mode 100644 index 0000000000..982104b394 --- /dev/null +++ b/GOVERNANCE.MD @@ -0,0 +1,31 @@ +# Governance + +The OpenAPI Specification is a project of the Open API Initiative (OAI), under the auspices of the Linux Foundation. For governance of the OAI, review the [OAI's charter](https://www.openapis.org/participate/how-to-contribute/governance). + +# Processes and procedures of the Technical Steering Committee (TSC) + +The TSC is a self-organizing sub-group of the OAI. Herein are its principles and guidelines. + +## 1. The establishment of roles and the responsibilities for each role + +Roles: + +* [Liaison](https://www.merriam-webster.com/dictionary/liaison) — Elected by TSC members in a plurality vote (oral count). Liaison represents the TSC to the BGB at board meetings (though this itself does not confer voting rights) and is the public facing mouthpiece of the TSC. + +* [Maintainer](https://www.merriam-webster.com/dictionary/maintainer) — all and only members of the TSC are maintainers, and are responsible from approving proposed changes to the specification. If membership drops below 3, work is suspended until the BGB can re-establish the minimum. To maintain agility, the TSC should be capped at a maximum 9 members, though that number can be reconsidered by the TSC in the future. Past members will be noted as emeritus status once they are no longer members. + +* [Rick](https://www.youtube.com/watch?v=dQw4w9WgXcQ) — Responsible for not giving up or letting down. Requires plurality vote of TSC members. + +## 2. Adding members to the TSC + +At an open TDC meeting, the impending call-for-nominations period is communicated and subsequently tweeted, no more than once per quarter. Nominations for members happen at closed TSC meetings via a motion by a voting TSC member. A nominee must not receive negative votes from 25% or more of the TSC voting membership. in a confidential vote held electronically within a week of the nomination. Approved nominees are expected to comport themselves during the provisional period of four weeks as full members of the TSC, though nominees do not have voting rights until their membership is confirmed. TSC subsequently votes on those nominees in the subsequent TSC meeting. At most there are four voting periods per year, with a minimum of 1 per year. + +## 3. Removal of membership from the TSC + +In dire situations, it may be necessary to remove a TSC member, such as behavior that violates the code of conduct (whether non-participation merits removal is a decision left to the TSC voting members). 75% vote (confidential, electronic) of the other TSC. members is required to remove a member. Otherwise, TSC members are removed when they renounce their position. + +## 4. Criteria for decisions + +The group will strive to achieve all decisions via unopposed consensus. When not possible, unresolved conflicts will be raised to the TOB. + +The TSC will maintain a publicly available document specifying the process in the contributor guidelines for how proposed changes are merged into the specification. The TSC will document and publicize the schedule of merge parties and release parties for the benefit of the technical developer community. From 30e6c93381ff62245df0b04fd20ff36ce0bca442 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 19 Oct 2017 15:06:53 -0700 Subject: [PATCH 0564/1801] Adding SwaggerHub --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 96a2a2d6c1..7d27a037d1 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -24,6 +24,7 @@ These tools are not necessarily endorsed by the OAI. | KaiZen OpenAPI Editor | [GitHub/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | | RepreZen API Studio | [RepreZen.com/OpenAPI](https://www.reprezen.com/OpenAPI) | Java | Commercial desktop IDE for API design, documentation & development | | OpenApi-gui | [GitHub/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenApi / Swagger definitions | +| SwaggerHub | [swaggerhub.com](https://swaggerhub.com) | | API Design and Documentation Platform, Built For Teams | swagger-editor | [GitHub/swagger-api](https://github.com/swagger-api/swagger-editor) | JavaScript | Web-Based editor for creating, editing, validating and testing OpenAPI\Swagger definitions | #### User Interfaces From 618a93587d4ef5a7387fa758b2463d6bd1e96560 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 20 Oct 2017 09:53:22 -0700 Subject: [PATCH 0565/1801] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38f116a0d7..999d855ea7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community (TDC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. -The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open the community. You can view the [TDC calendar online](https://calendar.google.com/calendar/embed?src=swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com), and import it to your calendar using the [iCal link](https://calendar.google.com/calendar/ical/swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com/public/basic.ics). +The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TDC calendar online](https://calendar.google.com/calendar/embed?src=swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com), and import it to your calendar using the [iCal link](https://calendar.google.com/calendar/ical/swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com/public/basic.ics). The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From 96c875cfa11d5a6833bb2063867d6d4f43e54d10 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 20 Oct 2017 09:53:31 -0700 Subject: [PATCH 0566/1801] Update README.md From a569bbfce64ca10f92150c8939520fdfa397f953 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 20 Oct 2017 10:12:11 -0700 Subject: [PATCH 0567/1801] Rename GOVERNANCE.MD to GOVERNANCE.md --- GOVERNANCE.MD => GOVERNANCE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename GOVERNANCE.MD => GOVERNANCE.md (100%) diff --git a/GOVERNANCE.MD b/GOVERNANCE.md similarity index 100% rename from GOVERNANCE.MD rename to GOVERNANCE.md From e3e0cc1ae1de1e0a838c83ff56ce65daec44a117 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 20 Oct 2017 10:27:09 -0700 Subject: [PATCH 0568/1801] typos corrected and nuances addressed --- GOVERNANCE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 982104b394..0814f63327 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -10,19 +10,19 @@ The TSC is a self-organizing sub-group of the OAI. Herein are its principles and Roles: -* [Liaison](https://www.merriam-webster.com/dictionary/liaison) — Elected by TSC members in a plurality vote (oral count). Liaison represents the TSC to the BGB at board meetings (though this itself does not confer voting rights) and is the public facing mouthpiece of the TSC. +* [Liaison](https://www.merriam-webster.com/dictionary/liaison) — Elected by TSC members in a plurality vote (oral count). Liaison represents the TSC to the OAI's Business Governing Board (BGB) at board meetings (though this itself does not confer voting rights) and is the public facing mouthpiece of the TSC. -* [Maintainer](https://www.merriam-webster.com/dictionary/maintainer) — all and only members of the TSC are maintainers, and are responsible from approving proposed changes to the specification. If membership drops below 3, work is suspended until the BGB can re-establish the minimum. To maintain agility, the TSC should be capped at a maximum 9 members, though that number can be reconsidered by the TSC in the future. Past members will be noted as emeritus status once they are no longer members. +* [Maintainer](https://www.merriam-webster.com/dictionary/maintainer) — all and only members of the TSC are maintainers, and are responsible for approving proposed changes to the specification. If membership drops below 3, work is suspended until the BGB can re-establish the minimum. To maintain agility, the TSC should be capped at a maximum 9 members, though that number can be reconsidered by the TSC in the future. Past members will be noted as emeritus status once they are no longer members. * [Rick](https://www.youtube.com/watch?v=dQw4w9WgXcQ) — Responsible for not giving up or letting down. Requires plurality vote of TSC members. ## 2. Adding members to the TSC -At an open TDC meeting, the impending call-for-nominations period is communicated and subsequently tweeted, no more than once per quarter. Nominations for members happen at closed TSC meetings via a motion by a voting TSC member. A nominee must not receive negative votes from 25% or more of the TSC voting membership. in a confidential vote held electronically within a week of the nomination. Approved nominees are expected to comport themselves during the provisional period of four weeks as full members of the TSC, though nominees do not have voting rights until their membership is confirmed. TSC subsequently votes on those nominees in the subsequent TSC meeting. At most there are four voting periods per year, with a minimum of 1 per year. +At an open TSC meeting, the impending call-for-nominations period is communicated and subsequently tweeted, no more than once per quarter. Nominations for members happen at closed TSC meetings via a motion by a voting TSC member. A nominee must not receive negative votes from 25% or more of the TSC voting membership via a confidential vote held electronically within a week of the nomination. Approved nominees are expected to comport themselves during the provisional period of four weeks as full members of the TSC, though nominees do not have voting rights until their membership is confirmed. TSC subsequently votes on those nominees in the subsequent TSC meeting. At most there are four voting periods per year, with a minimum of 1 per year. ## 3. Removal of membership from the TSC -In dire situations, it may be necessary to remove a TSC member, such as behavior that violates the code of conduct (whether non-participation merits removal is a decision left to the TSC voting members). 75% vote (confidential, electronic) of the other TSC. members is required to remove a member. Otherwise, TSC members are removed when they renounce their position. +In dire situations, it may be necessary to remove a TSC member, such as behavior that violates the code of conduct (whether non-participation merits removal is a decision left to the TSC voting members). 75% vote (confidential, electronic) of the other TSC. members is required to remove a member. Otherwise, TSC members are removed when they renounce their position by informing the Liaison of their effective resignation date. ## 4. Criteria for decisions From db87315c2074ef69196dc0018335422dbfeb8a73 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 20 Oct 2017 10:28:26 -0700 Subject: [PATCH 0569/1801] expand TOB --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 0814f63327..12d53af288 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -26,6 +26,6 @@ In dire situations, it may be necessary to remove a TSC member, such as behavior ## 4. Criteria for decisions -The group will strive to achieve all decisions via unopposed consensus. When not possible, unresolved conflicts will be raised to the TOB. +The group will strive to achieve all decisions via unopposed consensus. When not possible, unresolved conflicts will be raised to the OAI's Technical Oversight Board (TOB). The TSC will maintain a publicly available document specifying the process in the contributor guidelines for how proposed changes are merged into the specification. The TSC will document and publicize the schedule of merge parties and release parties for the benefit of the technical developer community. From dfd02eb940ae22f4a3a284e7f19872c82a8e446f Mon Sep 17 00:00:00 2001 From: Bert Roos Date: Fri, 20 Oct 2017 22:14:02 +0200 Subject: [PATCH 0570/1801] Correct comment on the link object The example referencing the response body had the same comment as the one referencing the request path. --- versions/3.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index 30a041ad84..93f55b323a 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -2051,7 +2051,7 @@ links: address: operationId: getUserAddressByUUID parameters: - # get the `id` field from the request path parameter named `id` + # get the `uuid` field from the `uuid` field in the response body userUuid: $response.body#/uuid ``` From d45549e004a54a72d11a9ec9aa676bd2d0748d30 Mon Sep 17 00:00:00 2001 From: umezaki Date: Sat, 21 Oct 2017 10:51:16 +0900 Subject: [PATCH 0571/1801] Replace representations to content --- versions/3.0.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index d941663513..c737f6e8ec 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -1737,7 +1737,7 @@ Response with a string type: ```yaml description: A simple string response -representations: +content: text/plain: schema: type: string From aa805bb33f2851df12330d245a00289fde710b51 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 26 Oct 2017 10:57:37 -0700 Subject: [PATCH 0572/1801] Switch to new calendar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 999d855ea7..15ae3f1716 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community (TDC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. -The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TDC calendar online](https://calendar.google.com/calendar/embed?src=swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com), and import it to your calendar using the [iCal link](https://calendar.google.com/calendar/ical/swagger.io_r92oetfnt9vbpqa6e5bca75v38%40group.calendar.google.com/public/basic.ics). +The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TDC calendar online](https://oai-technicalsteeringcommittee.groups.io/g/main/calendar), and import it to your calendar using the [iCal link](https://OAI-TechnicalSteeringCommittee.groups.io/g/main/ics/860119/668774333/feed.ics). The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From 14fc65d741b498d1c97715f8748a431c6347192c Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Mon, 30 Oct 2017 16:32:34 +0100 Subject: [PATCH 0573/1801] Updated IMPLEMENTATIONS.md with Vert.x projects --- IMPLEMENTATIONS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index cb0cb25af2..8f08d629f9 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -38,7 +38,9 @@ These tools are not necessarily endorsed by the OAI. #### Server Implementations - +| Title | Project Link | Language |Description | +|----------------|--------------|----------|---------------------| +| Vert.x Web API Contract | [Github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation #### Code Generators @@ -48,3 +50,4 @@ These tools are not necessarily endorsed by the OAI. | Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | | serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | | zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | +| slush-vertx | [Github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) From 71c900bc88822450f2b326842e449759950a85b5 Mon Sep 17 00:00:00 2001 From: Arthur De Magalhaes Date: Fri, 3 Nov 2017 11:40:23 -0400 Subject: [PATCH 0574/1801] Update IMPLEMENTATIONS.md Adding the support from WebSphere Liberty. --- IMPLEMENTATIONS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index cb0cb25af2..9e17c2c02e 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -35,6 +35,7 @@ These tools are not necessarily endorsed by the OAI. | openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | | swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | | lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | +| WebSphere Liberty | [Download jar] (https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | #### Server Implementations @@ -48,3 +49,4 @@ These tools are not necessarily endorsed by the OAI. | Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | | serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | | zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | +| WebSphere Liberty | [Download jar] (https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | From 6195da3edbe4ea8b091cb7895248eb5af9793726 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Mon, 6 Nov 2017 18:56:34 +0900 Subject: [PATCH 0575/1801] fix typo --- 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 790948cb93..4003794e83 100644 --- a/examples/v2.0/yaml/petstore.yaml +++ b/examples/v2.0/yaml/petstore.yaml @@ -28,7 +28,7 @@ paths: format: int32 responses: "200": - description: An paged array of pets + description: A paged array of pets headers: x-next: type: string From c882dd447c6d46a905508a095feda89ffbcfec92 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Thu, 9 Nov 2017 17:19:46 -0800 Subject: [PATCH 0576/1801] Update references to the TSC per #1384 --- DEVELOPMENT.md | 4 ++-- GOVERNANCE.md | 2 +- README.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 698eccfb69..b975f55b98 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,6 +1,6 @@ ## Development Guidelines -This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Developer Community will initially follow these processes when merging changes from external contributors or from the TDC itself. This guideline document will be adjusted as practicality dictates. +This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Steering Committee (TSC) will initially follow these processes when merging changes from external contributors or from the TSC itself. This guideline document will be adjusted as practicality dictates. ## OAI Specification Driving factors @@ -43,7 +43,7 @@ For each change in the specification we should _always_ consider the following: - Tooling. Strive to support code generation, software interfaces, and spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered during the change approval process. - Visualization. Can the specification change be graphically visualized somehow in a UI or other interface? -Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @fehguy". After voting criteria is met, any committer can merge the PR. (**TODO**: we will want to formalize what voting criteria actually is). +Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @webron". After voting criteria is met, any committer can merge the PR. (**TODO**: we will want to formalize what voting criteria actually is). No change should be approved until there is documentation for it, supplied in an accompanying PR. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 12d53af288..b4dccefa45 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -28,4 +28,4 @@ In dire situations, it may be necessary to remove a TSC member, such as behavior The group will strive to achieve all decisions via unopposed consensus. When not possible, unresolved conflicts will be raised to the OAI's Technical Oversight Board (TOB). -The TSC will maintain a publicly available document specifying the process in the contributor guidelines for how proposed changes are merged into the specification. The TSC will document and publicize the schedule of merge parties and release parties for the benefit of the technical developer community. +The TSC will maintain a publicly available document specifying the process in the contributor guidelines for how proposed changes are merged into the specification. The TSC will document and publicize the schedule of merge parties and release parties for the benefit of the developer community. diff --git a/README.md b/README.md index 15ae3f1716..a99c5b7826 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ Looking to see how you can create your own OpenAPI definition, present it, or ot The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). -Development of the next version of the OpenAPI Specification is guided by the [Technical Developer Community (TDC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. +Development of the next version of the OpenAPI Specification is guided by the [Technical Steering Committee (TSC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. -The TDC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TDC calendar online](https://oai-technicalsteeringcommittee.groups.io/g/main/calendar), and import it to your calendar using the [iCal link](https://OAI-TechnicalSteeringCommittee.groups.io/g/main/ics/860119/668774333/feed.ics). +The TSC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TSC calendar online](https://oai-technicalsteeringcommittee.groups.io/g/main/calendar), and import it to your calendar using the [iCal link](https://OAI-TechnicalSteeringCommittee.groups.io/g/main/ics/860119/668774333/feed.ics). The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From c740e950d9cc55f43c83db805d96d307232576f1 Mon Sep 17 00:00:00 2001 From: Darrel Date: Fri, 10 Nov 2017 13:04:28 -0500 Subject: [PATCH 0577/1801] Create MAINTAINERS.md --- MAINTAINERS.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 MAINTAINERS.md diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..05849e61f5 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,9 @@ +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Ron Ratovsky [@webron](https://github.com/webron) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) From a0c2af285781e716227613179934487627f49960 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Fri, 17 Nov 2017 13:21:40 -0800 Subject: [PATCH 0578/1801] fixing punctuation typo and clarifying note --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index b4dccefa45..ddd57d0468 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -22,7 +22,7 @@ At an open TSC meeting, the impending call-for-nominations period is communicate ## 3. Removal of membership from the TSC -In dire situations, it may be necessary to remove a TSC member, such as behavior that violates the code of conduct (whether non-participation merits removal is a decision left to the TSC voting members). 75% vote (confidential, electronic) of the other TSC. members is required to remove a member. Otherwise, TSC members are removed when they renounce their position by informing the Liaison of their effective resignation date. +In dire situations, it may be necessary to remove a TSC member, such as behavior that violates the code of conduct (NB: whether non-participation merits removal is a decision left to the TSC voting members). 75% vote (confidential, electronic) of the other TSC members is required to remove a member. Otherwise, TSC members are removed when they renounce their position by informing the Liaison of their effective resignation date. ## 4. Criteria for decisions From 4b741cdf36d73f1926e5aac7d5857da24a0227d9 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 20 Nov 2017 18:50:35 -0800 Subject: [PATCH 0579/1801] Updating per TSC discussions Over the last few weeks, the TSC has been revising this document. This commit reflects the latest thinking about how to revise the guidelines. --- DEVELOPMENT.md | 105 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index b975f55b98..20bf4fcc0c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,56 +1,95 @@ ## Development Guidelines -This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The Open API Technical Steering Committee (TSC) will initially follow these processes when merging changes from external contributors or from the TSC itself. This guideline document will be adjusted as practicality dictates. +This document intends to establish guidelines which build a transparent, open mechanism for deciding how to evolve the OpenAPI Specification. The OpenAPI Technical Steering Committee (TSC) will initially follow these processes when merging changes from external contributors or from the TSC itself. This guideline document will be adjusted as practicality dictates. ## OAI Specification Driving factors -The OpenAPI Specification should be use-case driven. We can specify support for hypothetical use cases as we see fit, but specifications should be backed by realistic scenarios. +The OpenAPI Specification should be use-case driven. We can specify support for hypothetical use cases as we see fit, but specifications should be backed by realistic scenarios. ## Specification Change Criteria -The specification _will change_ from the original 2.0 version. We should typically make changes when any of the following criteria are met: +The specification *will evolve over time*. Changes may be made when any of the following criteria are met: - - Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear. - - Consistency. A portion of the specification is not consistent with the rest, or with the industry standard terminology. - - Necessary functionality. We are missing functionality because of a certain design of the specification. - - Forward-looking designs. As usage of APIs evolves to new protocols, formats, and patterns, we should always consider what the next important functionality should be. - - Impact. A change will provide impact on a large number of use cases. We should not be forced to accommodate every use case. We should strive to make the _common_ and _important_ use cases both well supported and common in the definition of the OAI Spec. We cannot be edge-case driven. +* Clarity. The current "way" something is done doesn't make sense, is complicated, or not clear. +* Consistency. A portion of the specification is not consistent with the rest, or with the industry standard terminology. + +* Necessary functionality. We are missing functionality because of a certain design of the specification. + +* Forward-looking designs. As usage of APIs evolves to new protocols, formats, and patterns, we should always consider what the next important functionality should be. + +* Impact. A change will provide impact on a large number of use cases. We should not be forced to accommodate every use case. We should strive to make the *common* and *important* use cases both well supported and common in the definition of the OAI Spec. We cannot be edge-case driven. + +## Specification Change Process + +For each change in the specification we should *always* consider the following: + +* Migration. Is this a construct that has a path from the existing 2.0 specification? If so, how complicated is it to migrate to the proposed change? + +* Tooling. Strive to support code generation, software interfaces, spec generation techniques, as well as other utilities. Some features may be impossible to support in different frameworks/languages. These should be documented and considered during the change approval process. + +* Visualization. Can the specification change be graphically visualized somehow in a UI or other interface? + +Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @webron" however at least one formal GitHub-based flow approval must be given. After voting criteria is met, any committer can merge the PR. No change should be approved until there is documentation for it, supplied in an accompanying PR. ## Tracking Process - - Use GitHub for all spec designs, use cases, and so on. - - As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.0.md for example). - - At any given time, there would be _at most_ 4 work branches. The branches would exist if work has started on them. Assuming a current version of 3.0.0: - - `master` - Current stable version. No PRs would be accepted directly to modify the specification. PRs against supporting files can be accepted. - - `v3.0.1` - The next PATCH version of the specification. This would include non-breaking changes such as typo fixes, document fixes, wording clarifications. - - `v3.1.0` - The next MINOR version. - - `v4.0.0` - The next MAJOR version. - - The `master` branch shall remain the current, released OpenAPI Specification. We will describe and link the work branch(es) on the **default** README.md on master. - - Examples of how something is described _currently_ vs. the proposed solution should accompany any change proposal. - - New features should be done in feature branches/forks which, upon approval, are merged into the proper work branch. - - Use labels for the workflow of specification changes. Examples of labels are `proposed`, `needs migration review`, `needs tooling review`, `needs documentation`, `rejected`, and `needs approval`. These labels must be assigned by project committers. - - An issue will be opened for each feature change. Embedded in the issue, or ideally linked in a file via pull-request (PR), a document about use cases should be supplied with the change. - - A PR will be used to describe the _proposed_ solution, and linked to the original issue. - - Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel. - - When the a work branch is ready and approved, the branch will be merged to master. +* GitHub is the medium of record for all spec designs, use cases, and so on. + +* As with 2.0, the **human readable** document is the source of truth. If using a JSON Schema again to document the spec, it is secondary to the human documentation. The documentation should live in a *.md file, in parallel to the 2.0 document (versions/3.0.0.md for example). + +* At any given time, there would be *at most* 4 work branches. The branches would exist if work has started on them. Assuming a current version of 3.0.0: + + * master - Current stable version. No PRs would be accepted directly to modify the specification. PRs against supporting files can be accepted. + + * v3.0.1-dev - The next PATCH version of the specification. This would include non-breaking changes such as typo fixes, document fixes, wording clarifications. + + * v3.1.0 - The next MINOR version. + + * v4.0.0 - The next MAJOR version. -## Approving Changes +* The master branch shall remain the current, released OpenAPI Specification. We will describe and link the work branch(es) on the **default** README.md on master. -For each change in the specification we should _always_ consider the following: +* Examples of how something is described *currently* vs. the proposed solution should accompany any change proposal. - - Migration. Is this a construct that has a path from the existing 2.0 specification? If so, how complicated is it to migrate to the proposed change? - - Tooling. Strive to support code generation, software interfaces, and spec generation techniques. Some features may be impossible to support in different frameworks/languages. These should be documented and considered during the change approval process. - - Visualization. Can the specification change be graphically visualized somehow in a UI or other interface? +* New features should be done in feature branches/forks which, upon approval, are merged into the proper work branch. -Spec changes should be approved by a majority of the committers. Approval can be given by commenting on the issue itself, for example, "Approved by @webron". After voting criteria is met, any committer can merge the PR. (**TODO**: we will want to formalize what voting criteria actually is). +* Use labels for the workflow of specification changes. Examples of labels are proposed, housekeeping, migration-review, tooling-, needs documentation, review (candidate for upcoming TSC mtg), rejected, and needs approval. These labels must be assigned by project committers. Style is lowercase with dashes in place of spaces. -No change should be approved until there is documentation for it, supplied in an accompanying PR. +* An issue will be opened for each feature change. Embedded in the issue, or ideally linked in a file via pull-request (PR), a document about use cases should be supplied with the change. + +* A PR will be used to describe the *proposed* solution and linked to the original issue. + +* Not all committers will contribute to every single proposed change. There may be many open proposals at once, and multiple efforts may happen in parallel. + +* When the work branch is ready and approved, the branch will be merged to master. + +## Release Process + +A release requires a vote on the release notes by TSC members within the voting period. Major or minor release voting periods will be announced by the Liaison in the Slack channel and noted on the calendar at least 6 days in advance. During this time, TSC members who have not yet voted must note their approval on the GitHub pull request for the release notes. Patch releases happen at the first TSC meeting of a calendar month. The Liaison is responsible for coordinating the actual merge to Master with marketing support, if any. + +* Patch-level releases require majority approval by TSC members. (Max voting period 3 days) + +* Minor: requires approval by 66% of TSC members. (Max voting period 7 days) + +* Major: requires approval by 66% of TSC members. (Max voting period 14 days) ## Transparency -We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, and so on. These must be anonymized, discussed in a private repository, or conducted offline. +The process should be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, and so on. These must be anonymized, discussed in a private repository, or conducted offline. General discussions should happen on the GitHub issues for this project. + +## Participation + +While governance of the specification is the role of the TSC, the evolution of the specification happens through the participation of members of the developer community at large. Any person willing to contribute to the effort is welcome, and contributions may include filing or participating in issues, creating pull requests, or helping others with such activities. + +## Technical Developer Community Roles + +While all TDC roles are informal, there are many ways to get involved with the OpenAPI community, such as: + +* Contributor: Includes but is not limited to any [contributor to the specification](https://github.com/OAI/OpenAPI-Specification/graphs/contributors) via an accepted pull request or who participates in issues or TSC calls. + +* Implementer: any person involved in the creation or maintenance of tooling that leverages the current OpenAPI Specification - - Asynchronous discussions should live in the GitHub issues for this project. - - Realtime discussions should be in a public chat such as IRC or Slack. +* Ambassador: represents the OpenAPI Specification to the developer community. This could be through talks at conferences or meetups, blog posts, or answering questions in places like Twitter, Stack Overflow, or the GitHub repo. +* Supporter: uses the specification and appreciates its value. From d0f89eca2e81358639e4404c63a444772c4e3888 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 1 Dec 2017 08:53:59 +0000 Subject: [PATCH 0580/1801] Prefer https links where available --- versions/3.0.1.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index c737f6e8ec..bc9db91dbe 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -4,7 +4,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. -This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). +This document is licensed under [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). ## Introduction @@ -75,7 +75,7 @@ Path templating refers to the usage of curly braces ({}) to mark a section of a ##### Media Types Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [RFC6838](http://tools.ietf.org/html/rfc6838). +The media type definitions SHOULD be in compliance with [RFC6838](https://tools.ietf.org/html/rfc6838). Some examples of possible media type definitions: ``` @@ -92,13 +92,13 @@ Some examples of possible media type definitions: ``` ##### HTTP Status Codes The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [RFC7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +The available status codes are defined by [RFC7231](https://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). ## Specification ### Versions -The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. +The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. @@ -161,8 +161,8 @@ string | `string` | | | byte | `string` | `byte` | base64 encoded characters binary | `string` | `binary` | any sequence of octets boolean | `boolean` | | | -date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +date | `string` | `date` | As defined by `full-date` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) password | `string` | `password` | A hint to UIs to obscure input. ### Rich Text Formatting @@ -188,7 +188,7 @@ This is the root document object of the [OpenAPI document](#oasDocument). Field Name | Type | Description ---|:---:|--- -openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. @@ -232,7 +232,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens }, "license": { "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0.1" } @@ -248,7 +248,7 @@ contact: email: support@example.com license: name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html + url: https://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.1 ``` @@ -300,13 +300,13 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ```json { "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } ``` ```yaml name: Apache 2.0 -url: http://www.apache.org/licenses/LICENSE-2.0.html +url: https://www.apache.org/licenses/LICENSE-2.0.html ``` #### Server Object From 29ea26df7dfd8def1605521f5f32c692a642de79 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 21 Nov 2017 12:27:48 +0000 Subject: [PATCH 0581/1801] Examples; replace Uber with USPTO --- examples/v3.0/uber.yaml | 297 --------------------------------------- examples/v3.0/uspto.yaml | 210 +++++++++++++++++++++++++++ 2 files changed, 210 insertions(+), 297 deletions(-) delete mode 100644 examples/v3.0/uber.yaml create mode 100644 examples/v3.0/uspto.yaml diff --git a/examples/v3.0/uber.yaml b/examples/v3.0/uber.yaml deleted file mode 100644 index 8b94db300f..0000000000 --- a/examples/v3.0/uber.yaml +++ /dev/null @@ -1,297 +0,0 @@ -# this is an example of the Uber API -# as a demonstration of an API spec in YAML -openapi: "3.0.0" -info: - title: Uber API - description: Move your app forward with the Uber API - version: "1.0.0" -servers: - - url: https://api.uber.com/v1 -paths: - /products: - get: - summary: Product Types - description: The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. - parameters: - - name: latitude - in: query - description: Latitude component of location. - required: true - schema: - type: number - format: double - - name: longitude - in: query - description: Longitude component of location. - required: true - schema: - type: number - format: double - security: - - apikey: [] - tags: - - Products - responses: - '200': - description: An array of products - content: - application/json: - schema: - $ref: "#/components/schemas/ProductList" - default: - description: Unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /estimates/price: - get: - summary: Price Estimates - description: The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. - parameters: - - name: start_latitude - in: query - description: Latitude component of start location. - required: true - schema: - type: number - format: double - - name: start_longitude - in: query - description: Longitude component of start location. - required: true - schema: - type: number - format: double - - name: end_latitude - in: query - description: Latitude component of end location. - required: true - schema: - type: number - format: double - - name: end_longitude - in: query - description: Longitude component of end location. - required: true - schema: - type: number - format: double - tags: - - Estimates - responses: - '200': - description: An array of price estimates by product - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/PriceEstimate" - default: - description: Unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /estimates/time: - get: - summary: Time Estimates - description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. - parameters: - - name: start_latitude - in: query - description: Latitude component of start location. - required: true - schema: - type: number - format: double - - name: start_longitude - in: query - description: Longitude component of start location. - required: true - schema: - type: number - format: double - - name: customer_uuid - in: query - schema: - type: string - format: uuid - description: Unique customer identifier to be used for experience customization. - - name: product_id - in: query - schema: - type: string - description: Unique identifier representing a specific product for a given latitude & longitude. - tags: - - Estimates - responses: - '200': - description: An array of products - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Product" - default: - description: Unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /me: - get: - summary: User Profile - description: The User Profile endpoint returns information about the Uber user that has authorized with the application. - tags: - - User - responses: - '200': - description: Profile information for a user - content: - application/json: - schema: - $ref: "#/components/schemas/Profile" - default: - description: Unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /history: - get: - summary: User Activity - description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. - parameters: - - name: offset - in: query - schema: - type: integer - format: int32 - description: Offset the list of returned results by this amount. Default is zero. - - name: limit - in: query - schema: - type: integer - format: int32 - description: Number of items to retrieve. Default is 5, maximum is 100. - tags: - - User - responses: - '200': - description: History information for the given user - content: - application/json: - schema: - $ref: "#/components/schemas/Activities" - default: - description: Unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - securitySchemes: - apikey: - type: apiKey - name: server_token - in: query - schemas: - Product: - properties: - product_id: - type: string - description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. - description: - type: string - description: Description of product. - display_name: - type: string - description: Display name of product. - capacity: - type: integer - description: Capacity of product. For example, 4 people. - image: - type: string - description: Image URL representing the product. - ProductList: - properties: - products: - description: Contains the list of products - type: array - items: - $ref: "#/components/schemas/Product" - PriceEstimate: - properties: - product_id: - type: string - description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles - currency_code: - type: string - description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." - display_name: - type: string - description: Display name of product. - estimate: - type: string - description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. - low_estimate: - type: number - description: Lower bound of the estimated price. - high_estimate: - type: number - description: Upper bound of the estimated price. - surge_multiplier: - type: number - description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. - Profile: - properties: - first_name: - type: string - description: First name of the Uber user. - last_name: - type: string - description: Last name of the Uber user. - email: - type: string - description: Email address of the Uber user - picture: - type: string - description: Image URL of the Uber user. - promo_code: - type: string - description: Promo code of the Uber user. - Activity: - properties: - uuid: - type: string - description: Unique identifier for the activity - Activities: - properties: - offset: - type: integer - format: int32 - description: Position in pagination. - limit: - type: integer - format: int32 - description: Number of items to retrieve (100 max). - count: - type: integer - format: int32 - description: Total number of items available. - history: - type: array - items: - $ref: "#/components/schemas/Activity" - Error: - properties: - code: - type: string - message: - type: string - fields: - type: string - diff --git a/examples/v3.0/uspto.yaml b/examples/v3.0/uspto.yaml new file mode 100644 index 0000000000..774ca526b6 --- /dev/null +++ b/examples/v3.0/uspto.yaml @@ -0,0 +1,210 @@ +openapi: 3.0.0 +servers: + - url: '{scheme}://developer.uspto.gov/ds-api' + variables: + scheme: + description: 'The Data Set API is accessible via https and http' + enum: + - 'https' + - 'http' + default: 'https' +info: + description: >- + The Data Set API (DSAPI) allows the public users to discover and search + USPTO exported data sets. This is a generic API that allows USPTO users to + make any CSV based data files searchable through API. With the help of GET + call, it returns the list of data fields that are searchable. With the help + of POST call, data can be fetched based on the filters on the field names. + Please note that POST call is used to search the actual data. The reason for + the POST call is that it allows users to specify any complex search criteria + without worry about the GET size limitations as well as encoding of the + input parameters. + version: 1.0.0 + title: USPTO Data Set API + contact: + name: Open Data Portal + url: 'https://developer.uspto.gov' + email: developer@uspto.gov +tags: + - name: metadata + description: Find out about the data sets + - name: search + description: Search a data set +paths: + /: + get: + tags: + - metadata + operationId: list-data-sets + summary: List available data sets + responses: + '200': + description: Returns a list of data sets + content: + application/json: + schema: + $ref: '#/components/schemas/dataSetList' + example: + { + "total": 2, + "apis": [ + { + "apiKey": "oa_citations", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json" + }, + { + "apiKey": "cancer_moonshot", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json" + } + ] + } + /{dataset}/{version}/fields: + get: + tags: + - metadata + summary: >- + Provides the general information about the API and the list of fields + that can be used to query the dataset. + description: >- + This GET API returns the list of all the searchable field names that are + in the oa_citations. Please see the 'fields' attribute which returns an + array of field names. Each field or a combination of fields can be + searched using the syntax options shown below. + operationId: list-searchable-fields + parameters: + - name: dataset + in: path + description: 'Name of the dataset. In this case, the default value is oa_citations' + required: true + schema: + type: string + default: oa_citations + - name: version + in: path + description: Version of the dataset. + required: true + schema: + type: string + default: v1 + responses: + '200': + description: >- + The dataset api for the given version is found and it is accessible + to consume. + content: + application/json: + schema: + type: string + '404': + description: >- + The combination of dataset name and version is not found in the + system or it is not published yet to be consumed by public. + content: + application/json: + schema: + type: string + /{dataset}/{version}/records: + post: + tags: + - search + summary: >- + Provides search capability for the data set with the given search + criteria. + description: >- + This API is based on Solr/Lucense Search. The data is indexed using + SOLR. This GET API returns the list of all the searchable field names + that are in the Solr Index. Please see the 'fields' attribute which + returns an array of field names. Each field or a combination of fields + can be searched using the Solr/Lucene Syntax. Please refer + https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for + the query syntax. List of field names that are searchable can be + determined using above GET api. + operationId: perform-search + parameters: + - name: version + in: path + description: Version of the dataset. + required: true + schema: + type: string + default: v1 + - name: dataset + in: path + description: 'Name of the dataset. In this case, the default value is oa_citations' + required: true + schema: + type: string + default: oa_citations + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + type: object + additionalProperties: + type: object + '404': + description: No matching record found for the given criteria. + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + criteria: + description: >- + Uses Lucene Query Syntax in the format of + propertyName:value, propertyName:[num1 TO num2] and date + range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the + response please see the 'docs' element which has the list of + record objects. Each record structure would consist of all + the fields and their corresponding values. + type: string + default: '*:*' + start: + description: Starting record number. Default value is 0. + type: integer + default: 0 + rows: + description: >- + Specify number of rows to be returned. If you run the search + with default values, in the response you will see 'numFound' + attribute which will tell the number of records available in + the dataset. + type: integer + default: 100 + required: + - criteria +components: + schemas: + dataSetList: + type: object + properties: + total: + type: integer + apis: + type: array + items: + type: object + properties: + apiKey: + type: string + description: To be used as a dataset parameter value + apiVersionNumber: + type: string + description: To be used as a version parameter value + apiUrl: + type: string + format: uriref + description: "The URL describing the dataset's fields" + apiDocumentationUrl: + type: string + format: uriref + description: A URL to the API console for each API From 799a21f53783b473a508b8f38b0283a1b887f678 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 4 Dec 2017 12:35:36 -0800 Subject: [PATCH 0582/1801] Clarifying the process of expanding TSC membership --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index ddd57d0468..d5973f9392 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -18,7 +18,7 @@ Roles: ## 2. Adding members to the TSC -At an open TSC meeting, the impending call-for-nominations period is communicated and subsequently tweeted, no more than once per quarter. Nominations for members happen at closed TSC meetings via a motion by a voting TSC member. A nominee must not receive negative votes from 25% or more of the TSC voting membership via a confidential vote held electronically within a week of the nomination. Approved nominees are expected to comport themselves during the provisional period of four weeks as full members of the TSC, though nominees do not have voting rights until their membership is confirmed. TSC subsequently votes on those nominees in the subsequent TSC meeting. At most there are four voting periods per year, with a minimum of 1 per year. +When the TSC membership is not at its maximum, a impending call-for-nominations period is agreed upon and announced in a timely manner through @OpenApiSpec on Twitter. A candidate may be nominated by through a motion by a voting TSC member in a closed TSC meeting. A nominee must not receive opposition votes of more than 25% of the TSC voting membership via a confidential vote held electronically within a week following the call-for-nominations. Approved nominees become provisional members and are expected to comport themselves as full members of the TSC during the provisional period of 4-6 weeks (to be determined at start of each nominating period), though nominees have no voting rights. The provisional period is concluded by a second, confidential vote similar to the nomination period's vote. At most there are four voting periods per year (no more than one every three months), with a minimum of one per year. ## 3. Removal of membership from the TSC From 1db1993f85898e63c52287dd759e2996a9e1a8b5 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Mon, 4 Dec 2017 13:30:11 -0800 Subject: [PATCH 0583/1801] Two prepositions > one thanks Mike! --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index d5973f9392..d535eec25b 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -18,7 +18,7 @@ Roles: ## 2. Adding members to the TSC -When the TSC membership is not at its maximum, a impending call-for-nominations period is agreed upon and announced in a timely manner through @OpenApiSpec on Twitter. A candidate may be nominated by through a motion by a voting TSC member in a closed TSC meeting. A nominee must not receive opposition votes of more than 25% of the TSC voting membership via a confidential vote held electronically within a week following the call-for-nominations. Approved nominees become provisional members and are expected to comport themselves as full members of the TSC during the provisional period of 4-6 weeks (to be determined at start of each nominating period), though nominees have no voting rights. The provisional period is concluded by a second, confidential vote similar to the nomination period's vote. At most there are four voting periods per year (no more than one every three months), with a minimum of one per year. +When the TSC membership is not at its maximum, a impending call-for-nominations period is agreed upon and announced in a timely manner through @OpenApiSpec on Twitter. A candidate may be nominated through a motion by a voting TSC member in a closed TSC meeting. A nominee must not receive opposition votes of more than 25% of the TSC voting membership via a confidential vote held electronically within a week following the call-for-nominations. Approved nominees become provisional members and are expected to comport themselves as full members of the TSC during the provisional period of 4-6 weeks (to be determined at start of each nominating period), though nominees have no voting rights. The provisional period is concluded by a second, confidential vote similar to the nomination period's vote. At most there are four voting periods per year (no more than one every three months), with a minimum of one per year. ## 3. Removal of membership from the TSC From 23ea128aaf2cc4fbf7439d26f2f7d152db7b5d5e Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 5 Dec 2017 11:27:20 -0800 Subject: [PATCH 0584/1801] object -> field --- versions/3.0.1.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index fd2173d52c..40cce581ed 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -1004,8 +1004,8 @@ Field Name | Type | Description explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. -example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. @@ -1343,8 +1343,8 @@ Each Media Type Object provides schema and examples for the media type identifie Field Name | Type | Description ---|:---:|--- schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. -example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. -examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. This object MAY be extended with [Specification Extensions](#specificationExtensions). From 69a6e85886444139f51fc3fc2d04cbaeab2ec9f3 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 5 Dec 2017 14:43:01 -0800 Subject: [PATCH 0585/1801] Revert "Correct comment on the link object" --- versions/3.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.0.md b/versions/3.0.0.md index 93f55b323a..30a041ad84 100644 --- a/versions/3.0.0.md +++ b/versions/3.0.0.md @@ -2051,7 +2051,7 @@ links: address: operationId: getUserAddressByUUID parameters: - # get the `uuid` field from the `uuid` field in the response body + # get the `id` field from the request path parameter named `id` userUuid: $response.body#/uuid ``` From 70653dd09b02be5d61c4274e8f4fea7f4dea878c Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 5 Dec 2017 14:50:43 -0800 Subject: [PATCH 0586/1801] Re-apply #1386 on the right file Credit goes to @Bert-R --- versions/3.0.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 50787240dc..a6e7bb58a9 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -2051,7 +2051,7 @@ links: address: operationId: getUserAddressByUUID parameters: - # get the `id` field from the request path parameter named `id` + # get the `uuid` field from the `uuid` field in the response body userUuid: $response.body#/uuid ``` From eee4cf31e7a040ef95c10ec64cca967ed3dda805 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Tue, 5 Dec 2017 17:23:29 -0800 Subject: [PATCH 0587/1801] Addressing comments via thread and Slack, as well as some opportune language tightening. --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index d535eec25b..e9eda78d71 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -18,7 +18,7 @@ Roles: ## 2. Adding members to the TSC -When the TSC membership is not at its maximum, a impending call-for-nominations period is agreed upon and announced in a timely manner through @OpenApiSpec on Twitter. A candidate may be nominated through a motion by a voting TSC member in a closed TSC meeting. A nominee must not receive opposition votes of more than 25% of the TSC voting membership via a confidential vote held electronically within a week following the call-for-nominations. Approved nominees become provisional members and are expected to comport themselves as full members of the TSC during the provisional period of 4-6 weeks (to be determined at start of each nominating period), though nominees have no voting rights. The provisional period is concluded by a second, confidential vote similar to the nomination period's vote. At most there are four voting periods per year (no more than one every three months), with a minimum of one per year. +A call-for-nominations period may be agreed upon by the TSC voting members and announced in a timely manner through [@OpenApiSpec](https://twitter.com/OpenApiSpec) on Twitter, assuming the TSC membership is not already at its maximum. A candidate may be nominated through a motion by a voting TSC member in a closed TSC meeting. A nominee must not receive opposition votes of more than 25% of the TSC voting membership via a confidential vote held electronically within a week following the nomination meeting. Approved nominees become provisional members and are expected to comport themselves as full members of the TSC during the provisional period of 4-6 weeks (to be determined at start of each nominating period), though nominees have no voting rights. The provisional period is concluded by a second, confidential vote similar to the nomination period's vote. At most there are four voting periods per year (no more than one every three months), with a minimum of one per year. ## 3. Removal of membership from the TSC From 831c516cf5f83abc04218d871f43355c89aafb2c Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Wed, 6 Dec 2017 13:12:02 -0800 Subject: [PATCH 0588/1801] Fixed a missed case of TDC renaming to TSC --- DEVELOPMENT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 20bf4fcc0c..9891f4f527 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -82,9 +82,9 @@ The process should be as transparent as possible. Sometimes there will be discus While governance of the specification is the role of the TSC, the evolution of the specification happens through the participation of members of the developer community at large. Any person willing to contribute to the effort is welcome, and contributions may include filing or participating in issues, creating pull requests, or helping others with such activities. -## Technical Developer Community Roles +## Technical Steering Committee Roles -While all TDC roles are informal, there are many ways to get involved with the OpenAPI community, such as: +While all TSC roles are informal, there are many ways to get involved with the OpenAPI community, such as: * Contributor: Includes but is not limited to any [contributor to the specification](https://github.com/OAI/OpenAPI-Specification/graphs/contributors) via an accepted pull request or who participates in issues or TSC calls. From 39bbd8d37593c17a87821e9ebaa98853dadb795f Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Wed, 6 Dec 2017 13:14:29 -0800 Subject: [PATCH 0589/1801] even better, just refer to developer community not TDC --- DEVELOPMENT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 9891f4f527..8feeca3379 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -82,9 +82,9 @@ The process should be as transparent as possible. Sometimes there will be discus While governance of the specification is the role of the TSC, the evolution of the specification happens through the participation of members of the developer community at large. Any person willing to contribute to the effort is welcome, and contributions may include filing or participating in issues, creating pull requests, or helping others with such activities. -## Technical Steering Committee Roles +## Community Roles -While all TSC roles are informal, there are many ways to get involved with the OpenAPI community, such as: +While these developer community roles are informal, there are many ways to get involved with the OpenAPI community, such as: * Contributor: Includes but is not limited to any [contributor to the specification](https://github.com/OAI/OpenAPI-Specification/graphs/contributors) via an accepted pull request or who participates in issues or TSC calls. From 8b7a3260e74365a9de342e242ed6c83920d67973 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 6 Dec 2017 18:09:36 -0800 Subject: [PATCH 0590/1801] release prep --- README.md | 8 +++----- versions/3.0.1.md | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c6de567c1f..583bbb970a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) -**This is the WIP branch for the next patch version of the spec - 3.0.1. Patch level corrections should be submitted against this branch, specifically against [3.0.1.md](https://github.com/OAI/OpenAPI-Specification/blob/v3.0.1/versions/3.0.1.md).** - The OpenAPI Specification is a community-driven open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for [REST APIs](https://en.wikipedia.org/wiki/Representational_state_transfer), which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. @@ -16,9 +14,9 @@ The OpenAPI Specification does not require rewriting existing APIs. It does not This GitHub project is the starting point for OpenAPI. Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, and some general information regarding the project. -## Current Version - 3.0 +## Current Version - 3.0.1 -The current version of the OpenAPI specification is [OpenAPI Specification 3.0](versions/3.0.0.md). +The current version of the OpenAPI specification is [OpenAPI Specification 3.0.1](versions/3.0.1.md). ### Future Versions @@ -49,7 +47,7 @@ The TSC holds weekly web conferences to review open pull requests and discuss op The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: -* Review the [current specification](versions/3.0.0.md). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [current specification](versions/3.0.1.md). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](DEVELOPMENT.md) process so you understand how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern. If possible, propose a solution. diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 50787240dc..21938c9c91 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -3368,7 +3368,7 @@ Two examples of this: Version | Date | Notes --- | --- | --- -3.0.1 | TBA | TBA +3.0.1 | 2017-12-06 | Patch release of the OpenAPI Specification 3.0.1 3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification 3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification From 3fc30353316d1862ce47ffbe32bb0aa4873594a2 Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Sat, 9 Dec 2017 20:04:03 +0000 Subject: [PATCH 0591/1801] Add Ruby openapi3_parser --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index d8cac3082e..477bc106ea 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -15,6 +15,7 @@ These tools are not necessarily endorsed by the OAI. | swagger2openapi | [GitHub/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | | Tavis.OpenApi | [GitHub/tavis-sofware/Tavis.OpenApi](https://github.com/tavis-software/Tavis.OpenApi/) | dotnet | C# based parser with definition validation and migration support from V2 | | odata-openapi | [GitHub/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | +| openapi3_parser | [GitHub/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | #### Editors From 43b17a7011a9c765e5901ecb9cd4461bdb6323fb Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Sun, 10 Dec 2017 22:01:16 +0100 Subject: [PATCH 0592/1801] add Fusio implementation --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index d8cac3082e..7e0111677d 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -42,6 +42,7 @@ These tools are not necessarily endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| | Vert.x Web API Contract | [Github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation +| Fusio | [Github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 #### Code Generators From 56e2437a776852988c4e48539a8c3848b98076ac Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 15 Dec 2017 08:25:16 -0800 Subject: [PATCH 0593/1801] Next patch version prep --- README.md | 5 +- versions/3.0.2.md | 3381 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 3385 insertions(+), 1 deletion(-) create mode 100644 versions/3.0.2.md diff --git a/README.md b/README.md index 583bbb970a..56ea424143 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) +**This is the WIP branch for the next patch version of the spec - 3.0.2. Patch level corrections should be submitted against this branch, specifically against [3.0.2.md](https://github.com/OAI/OpenAPI-Specification/blob/v3.0.2-dev/versions/3.0.2.md).** + + The OpenAPI Specification is a community-driven open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for [REST APIs](https://en.wikipedia.org/wiki/Representational_state_transfer), which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. @@ -20,7 +23,7 @@ The current version of the OpenAPI specification is [OpenAPI Specification 3.0.1 ### Future Versions -[3.0.1](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.1) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. +[3.0.2](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.2-dev) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. ### Previous Versions diff --git a/versions/3.0.2.md b/versions/3.0.2.md new file mode 100644 index 0000000000..954b2c74d0 --- /dev/null +++ b/versions/3.0.2.md @@ -0,0 +1,3381 @@ +# OpenAPI Specification + +#### Version 3.0.2 + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. + +This document is licensed under [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). + +## Introduction + +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. + +An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases. + +## Table of Contents + + +- [Definitions](#definitions) + - [OpenAPI Document](#oasDocument) + - [Path Templating](#pathTemplating) + - [Media Types](#mediaTypes) + - [HTTP Status Codes](#httpCodes) +- [Specification](#specification) + - [Versions](#versions) + - [Format](#format) + - [Document Structure](#documentStructure) + - [Data Types](#dataTypes) + - [Rich Text Formatting](#richText) + - [Relative References In URLs](#relativeReferences) + - [Schema](#schema) + - [OpenAPI Object](#oasObject) + - [Info Object](#infoObject) + - [Contact Object](#contactObject) + - [License Object](#licenseObject) + - [Server Object](#serverObject) + - [Server Variable Object](#serverVariableObject) + - [Components Object](#componentsObject) + - [Paths Object](#pathsObject) + - [Path Item Object](#pathItemObject) + - [Operation Object](#operationObject) + - [External Documentation Object](#externalDocumentationObject) + - [Parameter Object](#parameterObject) + - [Request Body Object](#requestBodyObject) + - [Media Type Object](#mediaTypeObject) + - [Encoding Object](#encodingObject) + - [Responses Object](#responsesObject) + - [Response Object](#responseObject) + - [Callback Object](#callbackObject) + - [Example Object](#exampleObject) + - [Link Object](#linkObject) + - [Header Object](#headerObject) + - [Tag Object](#tagObject) + - [Reference Object](#referenceObject) + - [Schema Object](#schemaObject) + - [Discriminator Object](#discriminatorObject) + - [XML Object](#xmlObject) + - [Security Scheme Object](#securitySchemeObject) + - [OAuth Flows Object](#oauthFlowsObject) + - [OAuth Flow Object](#oauthFlowObject) + - [Security Requirement Object](#securityRequirementObject) + - [Specification Extensions](#specificationExtensions) + - [Security Filtering](#securityFiltering) +- [Appendix A: Revision History](#revisionHistory) + + + + +## Definitions + +##### OpenAPI Document +A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. + +##### Path Templating +Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. + +##### Media Types +Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [RFC6838](https://tools.ietf.org/html/rfc6838). + +Some examples of possible media type definitions: +``` + text/plain; charset=utf-8 + application/json + application/vnd.github+json + application/vnd.github.v3+json + application/vnd.github.v3.raw+json + application/vnd.github.v3.text+json + application/vnd.github.v3.html+json + application/vnd.github.v3.full+json + application/vnd.github.v3.diff + application/vnd.github.v3.patch +``` +##### HTTP Status Codes +The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [RFC7231](https://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). + +## Specification + +### Versions + +The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. + +The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. + +Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. + +An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerObject) and value `"2.0"`.) + +### Format + +An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. + +For example, if a field has an array value, the JSON array representation will be used: + +```json +{ + "field": [ 1, 2, 3 ] +} +``` +All field names in the specification are **case sensitive**. + +The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. + +Patterned fields MUST have unique names within the containing object. + +In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is RECOMMENDED along with some additional constraints: + +- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). + +**Note:** While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. + +### Document Structure + +An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, `$ref` fields MUST be used in the specification to reference those parts as follows from the [JSON Schema](http://json-schema.org) definitions. + +It is RECOMMENDED that the root OpenAPI document be named: `openapi.json` or `openapi.yaml`. + +### Data Types + +Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). +Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. +`null` is not supported as a type (see [`nullable`](#schemaNullable) for an alternative solution). +Models are defined using the [Schema Object](#schemaObject), which is an extended subset of JSON Schema Specification Wright Draft 00. + +Primitives have an optional modifier property: `format`. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the `format` property is an open `string`-valued property, and can have any value. +Formats such as `"email"`, `"uuid"`, and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a `format` property follow the type definition in the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` is not specified. + +The formats defined by the OAS are: + +Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments +----------- | ------ | -------- | -------- +integer | `integer` | `int32` | signed 32 bits +long | `integer` | `int64` | signed 64 bits +float | `number` | `float` | | +double | `number` | `double` | | +string | `string` | | | +byte | `string` | `byte` | base64 encoded characters +binary | `string` | `binary` | any sequence of octets +boolean | `boolean` | | | +date | `string` | `date` | As defined by `full-date` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +password | `string` | `password` | A hint to UIs to obscure input. + +### Rich Text Formatting +Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. + +### Relative References in URLs + +Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). +Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. + +Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). + +### Schema + +In the following description, if a field is not explicitly **REQUIRED** or described with a MUST or SHALL, it can be considered OPTIONAL. + +#### OpenAPI Object + +This is the root document object of the [OpenAPI document](#oasDocument). + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. +info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. +servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. +components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. +tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Info Object + +The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +title | `string` | **REQUIRED**. The title of the application. +description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. +contact | [Contact Object](#contactObject) | The contact information for the exposed API. +license | [License Object](#licenseObject) | The license information for the exposed API. +version | `string` | **REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Info Object Example: + +```json +{ + "title": "Sample Pet Store App", + "description": "This is a sample server for a pet store.", + "termsOfService": "http://example.com/terms/", + "contact": { + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0.1" +} +``` + +```yaml +title: Sample Pet Store App +description: This is a sample server for a pet store. +termsOfService: http://example.com/terms/ +contact: + name: API Support + url: http://www.example.com/support + email: support@example.com +license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +version: 1.0.1 +``` + +#### Contact Object + +Contact information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | The identifying name of the contact person/organization. +url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. +email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Contact Object Example: + +```json +{ + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" +} +``` + +```yaml +name: API Support +url: http://www.example.com/support +email: support@example.com +``` + +#### License Object + +License information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The license name used for the API. +url | `string` | A URL to the license used for the API. MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### License Object Example: + +```json +{ + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" +} +``` + +```yaml +name: Apache 2.0 +url: https://www.apache.org/licenses/LICENSE-2.0.html +``` + +#### Server Object + +An object representing a Server. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Server Object Example + +A single server would be described as: + +```json +{ + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" +} +``` + +```yaml +url: https://development.gigantic-server.com/v1 +description: Development server +``` + +The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers): + +```json +{ + "servers": [ + { + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" + }, + { + "url": "https://staging.gigantic-server.com/v1", + "description": "Staging server" + }, + { + "url": "https://api.gigantic-server.com/v1", + "description": "Production server" + } + ] +} +``` + +```yaml +servers: +- url: https://development.gigantic-server.com/v1 + description: Development server +- url: https://staging.gigantic-server.com/v1 + description: Staging server +- url: https://api.gigantic-server.com/v1 + description: Production server +``` + +The following shows how variables can be used for a server configuration: + +```json +{ + "servers": [ + { + "url": "https://{username}.gigantic-server.com:{port}/{basePath}", + "description": "The production API server", + "variables": { + "username": { + "default": "demo", + "description": "this value is assigned by the service provider, in this example `gigantic-server.com`" + }, + "port": { + "enum": [ + "8443", + "443" + ], + "default": "8443" + }, + "basePath": { + "default": "v2" + } + } + } + ] +} +``` + +```yaml +servers: +- url: https://{username}.gigantic-server.com:{port}/{basePath} + description: The production API server + variables: + username: + # note! no enum here means it is an open value + default: demo + description: this value is assigned by the service provider, in this example `gigantic-server.com` + port: + enum: + - '8443' + - '443' + default: '8443' + basePath: + # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` + default: v2 +``` + + +#### Server Variable Object + +An object representing a Server Variable for server URL template substitution. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. +default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Components Object + +Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + + +##### Fixed Fields + +Field Name | Type | Description +---|:---|--- + schemas | Map[`string`, [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Response Object](#responseObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Response Objects](#responseObject). + parameters | Map[`string`, [Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Parameter Objects](#parameterObject). + examples | Map[`string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). + headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Header Objects](#headerObject). + securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). + links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Callback Objects](#callbackObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. + +Field Name Examples: + +``` +User +User_1 +User_Name +user-name +my.org.User +``` + +##### Components Object Example + +```json +"components": { + "schemas": { + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + } + }, + "parameters": { + "skipParam": { + "name": "skip", + "in": "query", + "description": "number of items to skip", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + }, + "limitParam": { + "name": "limit", + "in": "query", + "description": "max records to return", + "required": true, + "schema" : { + "type": "integer", + "format": "int32" + } + } + }, + "responses": { + "NotFound": { + "description": "Entity not found." + }, + "IllegalInput": { + "description": "Illegal input for operation." + }, + "GeneralError": { + "description": "General Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralError" + } + } + } + } + }, + "securitySchemes": { + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "http://example.org/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + } + } +} +``` + +```yaml +components: + schemas: + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limit + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 + responses: + NotFound: + description: Entity not found. + IllegalInput: + description: Illegal input for operation. + GeneralError: + description: General Error + content: + application/json: + schema: + $ref: '#/components/schemas/GeneralError' + securitySchemes: + api_key: + type: apiKey + name: api_key + in: header + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Paths Object + +Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Templating Matching + +Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used: + +``` + /pets/{petId} + /pets/mine +``` + +The following paths are considered identical and invalid: + +``` + /pets/{petId} + /pets/{name} +``` + +The following may lead to ambiguous resolution: + +``` + /{entity}/me + /books/{id} +``` + +##### Paths Object Example + +```json +{ + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to", + "responses": { + "200": { + "description": "A list of pets.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pet" + } + } + } + } + } + } + } + } +} +``` + +```yaml +/pets: + get: + description: Returns all pets from the system that the user has access to + responses: + '200': + description: A list of pets. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/pet' +``` + +#### Path Item Object + +Describes the operations available on a single path. +A Path Item MAY be empty, due to [ACL constraints](#securityFiltering). +The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +$ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +summary| `string` | An optional, string summary, intended to apply to all operations in this path. +description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +get | [Operation Object](#operationObject) | A definition of a GET operation on this path. +put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. +post | [Operation Object](#operationObject) | A definition of a POST operation on this path. +delete | [Operation Object](#operationObject) | A definition of a DELETE operation on this path. +options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. +head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. +patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service all operations in this path. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Item Object Example + +```json +{ + "get": { + "description": "Returns pets based on ID", + "summary": "Find pets by ID", + "operationId": "getPetsById", + "responses": { + "200": { + "description": "pet response", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "default": { + "description": "error payload", + "content": { + "text/html": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to use", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "simple" + } + ] +} +``` + +```yaml +get: + description: Returns pets based on ID + summary: Find pets by ID + operationId: getPetsById + responses: + '200': + description: pet response + content: + '*/*' : + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: error payload + content: + 'text/html': + schema: + $ref: '#/components/schemas/ErrorModel' +parameters: +- name: id + in: path + description: ID of pet to use + required: true + schema: + type: array + style: simple + items: + type: string +``` + +#### Operation Object + +Describes a single API operation on a path. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +summary | `string` | A short summary of what the operation does. +description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). +requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Operation Object Example + +```json +{ + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "operationId": "updatePetWithForm", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be updated", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "description": "Updated name of the pet", + "type": "string" + }, + "status": { + "description": "Updated status of the pet", + "type": "string" + } + }, + "required": ["status"] + } + } + } + }, + "responses": { + "200": { + "description": "Pet updated.", + "content": { + "application/json": {}, + "application/xml": {} + } + }, + "405": { + "description": "Invalid input", + "content": { + "application/json": {}, + "application/xml": {} + } + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] +} +``` + +```yaml +tags: +- pet +summary: Updates a pet in the store with form data +operationId: updatePetWithForm +parameters: +- name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string +requestBody: + content: + 'application/x-www-form-urlencoded': + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status +responses: + '200': + description: Pet updated. + content: + 'application/json': {} + 'application/xml': {} + '405': + description: Invalid input + content: + 'application/json': {} + 'application/xml': {} +security: +- petstore_auth: + - write:pets + - read:pets +``` + + +#### External Documentation Object + +Allows referencing an external resource for extended documentation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### External Documentation Object Example + +```json +{ + "description": "Find more info here", + "url": "https://example.com" +} +``` + +```yaml +description: Find more info here +url: https://example.com +``` + +#### Parameter Object + +Describes a single operation parameter. + +A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). + +##### Parameter Locations +There are four possible parameter locations specified by the `in` field: +* path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. +* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +* cookie - Used to pass a specific cookie value to the API. + + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
+in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". +description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. + deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. + +The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. + +Field Name | Type | Description +---|:---:|--- +style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. + +For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. +A parameter MUST contain either a `schema` property, or a `content` property, but not both. +When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. + + +Field Name | Type | Description +---|:---:|--- +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. + +##### Style Values + +In order to support common ways of serializing simple parameters, a set of `style` values are defined. + +`style` | [`type`](#dataTypes) | `in` | Comments +----------- | ------ | -------- | -------- +matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) +label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0. +simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0. +spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. +pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. +deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. + + +##### Style Examples + +Assume a parameter named `color` has one of the following values: + +``` + string -> "blue" + array -> ["blue","black","brown"] + object -> { "R": 100, "G": 200, "B": 150 } +``` +The following table shows examples of rendering differences for each value. + +[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` +----------- | ------ | -------- | -------- | --------|------- +matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 +matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 +label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 +label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 +form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 +form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 +simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 +simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150 +spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 +pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 +deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Parameter Object Examples + +A header parameter with an array of 64 bit integer numbers: + +```json +{ + "name": "token", + "in": "header", + "description": "token to be passed as a header", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "style": "simple" +} +``` + +```yaml +name: token +in: header +description: token to be passed as a header +required: true +schema: + type: array + items: + type: integer + format: int64 +style: simple +``` + +A path parameter of a string value: +```json +{ + "name": "username", + "in": "path", + "description": "username to fetch", + "required": true, + "schema": { + "type": "string" + } +} +``` + +```yaml +name: username +in: path +description: username to fetch +required: true +schema: + type: string +``` + +An optional query parameter of a string value, allowing multiple values by repeating the query parameter: +```json +{ + "name": "id", + "in": "query", + "description": "ID of the object to fetch", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "form", + "explode": true +} +``` + +```yaml +name: id +in: query +description: ID of the object to fetch +required: false +schema: + type: array + items: + type: string +style: form +explode: true +``` + +A free-form query parameter, allowing undefined parameters of a specific type: +```json +{ + "in": "query", + "name": "freeForm", + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer" + }, + }, + "style": "form" +} +``` + +```yaml +in: query +name: freeForm +schema: + type: object + additionalProperties: + type: integer +style: form +``` + +A complex parameter using `content` to define serialization: + +```json +{ + "in": "query", + "name": "coordinates", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "lat", + "long" + ], + "properties": { + "lat": { + "type": "number" + }, + "long": { + "type": "number" + } + } + } + } + } +} +``` + +```yaml +in: query +name: coordinates +content: + application/json: + schema: + type: object + required: + - lat + - long + properties: + lat: + type: number + long: + type: number +``` + +#### Request Body Object + +Describes a single request body. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Request Body Examples + +A request body with a referenced model definition. +```json +{ + "description": "user to add to the system", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User Example", + "externalValue": "http://foo.bar/examples/user-example.json" + } + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User example in XML", + "externalValue": "http://foo.bar/examples/user-example.xml" + } + } + }, + "text/plain": { + "examples": { + "user" : { + "summary": "User example in Plain text", + "externalValue": "http://foo.bar/examples/user-example.txt" + } + } + }, + "*/*": { + "examples": { + "user" : { + "summary": "User example in other format", + "externalValue": "http://foo.bar/examples/user-example.whatever" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +content: + 'application/json': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example + externalValue: 'http://foo.bar/examples/user-example.json' + 'application/xml': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example in XML + externalValue: 'http://foo.bar/examples/user-example.xml' + 'text/plain': + examples: + user: + summary: User example in text plain format + externalValue: 'http://foo.bar/examples/user-example.txt' + '*/*': + examples: + user: + summary: User example in other format + externalValue: 'http://foo.bar/examples/user-example.whatever' +``` + +A body parameter that is an array of string values: +```json +{ + "description": "user to add to the system", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +required: true +content: + text/plain: + schema: + type: array + items: + type: string +``` + + +#### Media Type Object +Each Media Type Object provides schema and examples for the media type identified by its key. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Media Type Examples + +```js +{ + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + }, + "examples": { + "cat" : { + "summary": "An example of a cat", + "value": + { + "name": "Fluffy", + "petType": "Cat", + "color": "White", + "gender": "male", + "breed": "Persian" + } + }, + "dog": { + "summary": "An example of a dog with a cat's name", + "value" : { + "name": "Puma", + "petType": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + }, + "frog": { + "$ref": "#/components/examples/frog-example" + } + } + } + } +} +``` + +```yaml +application/json: + schema: + $ref: "#/components/schemas/Pet" + examples: + cat: + summary: An example of a cat + value: + name: Fluffy + petType: Cat + color: White + gender: male + breed: Persian + dog: + summary: An example of a dog with a cat's name + value: + name: Puma + petType: Dog + color: Black + gender: Female + breed: Mixed + frog: + $ref: "#/components/examples/frog-example" +``` + +##### Considerations for File Uploads + +In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: + +```yaml +# content transferred with base64 encoding +schema: + type: string + format: base64 +``` + +```yaml +# content transferred in binary (octet-stream): +schema: + type: string + format: binary +``` + +These examples apply to either input payloads of file uploads or response payloads. + +A `requestBody` for submitting a file in a `POST` operation may look like the following example: + +```yaml +requestBody: + content: + application/octet-stream: + # any media type is accepted, functionally equivalent to `*/*` + schema: + # a binary file of any type + type: string + format: binary +``` + +In addition, specific media types MAY be specified: + +```yaml +# multiple, specific media types may be specified: +requestBody: + content: + # a binary file of type png or jpeg + 'image/jpeg': + schema: + type: string + format: binary + 'image/png': + schema: + type: string + format: binary +``` + +To upload multiple files, a `multipart` media type MUST be used: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + properties: + # The property name 'file' will be used for all files. + file: + type: array + items: + type: string + format: binary + +``` + +##### Support for x-www-form-urlencoded Request Bodies + +To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following +definition may be used: + +```yaml +requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # complex types are stringified to support RFC 1866 + type: object + properties: {} +``` + +In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. + +When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. + +##### Special Considerations for `multipart` Content + +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads. + +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart`: + +* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` +* If the property is complex, or an array of complex values, the default Content-Type is `application/json` +* If the property is a `type: string` with `format: binary` or `format: base64` (aka a file object), the default Content-Type is `application/octet-stream` + + +Examples: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # default Content-Type for objects is `application/json` + type: object + properties: {} + profileImage: + # default Content-Type for string/binary is `application/octet-stream` + type: string + format: binary + children: + # default Content-Type for arrays is based on the `inner` type (text/plain here) + type: array + items: + type: string + addresses: + # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example) + type: array + items: + type: '#/components/schemas/Address' +``` + +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart` and `application/x-www-form-urlencoded` request bodies. + +#### Encoding Object + +A single encoding definition applied to a single schema property. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Encoding Object Example + +```yaml +requestBody: + content: + multipart/mixed: + schema: + type: object + properties: + id: + # default is text/plain + type: string + format: uuid + address: + # default is application/json + type: object + properties: {} + historyMetadata: + # need to declare XML format! + description: metadata in XML format + type: object + properties: {} + profileImage: + # default is application/octet-stream, need to declare an image type only! + type: string + format: binary + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer +``` + +#### Responses Object + +A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response. + +The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors. + +The `default` MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification. + +The `Responses Object` MUST contain at least one response code, and it +SHOULD be the response for a successful operation call. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A [Reference Object](#referenceObject) can link to a response that the [OpenAPI Object's components/responses](#componentsResponses) section defines. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Responses Object Example + +A 200 response for a successful operation and a default response for others (implying an error): + +```json +{ + "200": { + "description": "a pet to be returned", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } +} +``` + +```yaml +'200': + description: a pet to be returned + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' +``` + +#### Response Object +Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Response Object Examples + +Response of an array of a complex type: + +```json +{ + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VeryComplexType" + } + } + } + } +} +``` + +```yaml +description: A complex object array response +content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/VeryComplexType' +``` + +Response with a string type: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + +} +``` + +```yaml +description: A simple string response +content: + text/plain: + schema: + type: string +``` + +Plain text response with headers: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + }, + "headers": { + "X-Rate-Limit-Limit": { + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Remaining": { + "description": "The number of remaining requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Reset": { + "description": "The number of seconds left in the current period", + "schema": { + "type": "integer" + } + } + } +} +``` + +```yaml +description: A simple string response +content: + text/plain: + schema: + type: string + example: 'whoa!' +headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer + X-Rate-Limit-Remaining: + description: The number of remaining requests in the current period + schema: + type: integer + X-Rate-Limit-Reset: + description: The number of seconds left in the current period + schema: + type: integer +``` + +Response with no return value: + +```json +{ + "description": "object created" +} +``` + +```yaml +description: object created +``` + +#### Callback Object + +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Key Expression + +The key that identifies the [Path Item Object](#pathItemObject) is a [runtime expression](#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be `$request.body#/url`. +However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference. + +For example, given the following HTTP request: + +```http +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 +Host: example.org +Content-Type: application/json +Content-Length: 187 + +{ + "failedUrl" : "http://clientdomain.com/failed", + "successUrls" : [ + "http://clientdomain.com/fast", + "http://clientdomain.com/medium", + "http://clientdomain.com/slow" + ] +} + +201 Created +Location: http://example.org/subscription/1 +``` + +The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. + +Expression | Value +---|:--- +$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +$method | POST +$request.path.eventType | myevent +$request.query.queryUrl | http://clientdomain.com/stillrunning +$request.header.content-Type | application/json +$request.body#/failedUrl | http://clientdomain.com/stillrunning +$request.body#/successUrls/2 | http://clientdomain.com/medium +$response.header.Location | http://example.org/subscription/1 + + +##### Callback Object Example + +The following example shows a callback to the URL specified by the `id` and `email` property in the request body. + +```yaml +myWebhook: + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': + post: + requestBody: + description: Callback payload + content: + 'application/json': + schema: + $ref: '#/components/schemas/SomePayload' + responses: + '200': + description: webhook successfully processed and no retries will be performed +``` + + +#### Example Object + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +summary | `string` | Short description for the example. +description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible. + +##### Example Object Example + +```yaml +# in a model +schemas: + properties: + name: + type: string + examples: + name: + $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example + +# in a request body: + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + summary: A foo example + value: {"foo": "bar"} + bar: + summary: A bar example + value: {"bar": "baz"} + 'application/xml': + examples: + xmlExample: + summary: This is an example in XML + externalValue: 'http://example.org/examples/address-example.xml' + 'text/plain': + examples: + textExample: + summary: This is a text example + externalValue: 'http://foo.bar/examples/address-example.txt' + + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + examples: + zip-example: + $ref: '#/components/examples/zip-example' + +# in a response + responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + examples: + confirmation-success: + $ref: '#/components/examples/confirmation-success' +``` + + +#### Link Object + +The `Link object` represents a possible design-time link for a response. +The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. + +Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. + +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OpenAPI definition. +operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). +requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. +description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +server | [Server Object](#serverObject) | A server object to be used by the target operation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +A linked operation MUST be identified using either an `operationRef` or `operationId`. +In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the `operationRef` syntax is preferred +for specifications with external references. + +##### Examples + +Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation. + +```yaml +paths: + /users/{id}: + parameters: + - name: id + in: path + required: true + description: the user identifier, as userId + schema: + type: string + get: + responses: + '200': + description: the user being returned + content: + application/json: + schema: + type: object + properties: + uuid: # the unique user id + type: string + format: uuid + links: + address: + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: $request.path.id + # the path item of the linked operation + /users/{userid}/address: + parameters: + - name: userid + in: path + required: true + description: the user identifier, as userId + schema: + type: string + # linked operation + get: + operationId: getUserAddress + responses: + '200': + description: the user's address +``` + +When a runtime expression fails to evaluate, no parameter value is passed to the target operation. + +Values from the response body can be used to drive a linked operation. + +```yaml +links: + address: + operationId: getUserAddressByUUID + parameters: + # get the `uuid` field from the `uuid` field in the response body + userUuid: $response.body#/uuid +``` + +Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship. + + +##### OperationRef Examples + +As references to `operationId` MAY NOT be possible (the `operationId` is an optional +value), references MAY also be made through a relative `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: '#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +or an absolute `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when +using JSON references. + + +##### Runtime Expressions + +Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#callbackObject). + +The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source ) + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body" ["#" fragment] + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + +The table below provides examples of runtime expressions and examples of their use in a value: + +##### Examples + +Source Location | example expression | notes +---|:---|:---| +HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. +Requested media type | `$request.header.accept` | +Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. +Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. +Request URL | `$url` | +Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. +Response header | `$response.header.Server` | Single header values only are available + +Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. + +#### Header Object + +The Header Object follows the structure of the [Parameter Object](#parameterObject) with the following changes: + +1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. +1. `in` MUST NOT be specified, it is implicitly in `header`. +1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). + +##### Header Object Example + +A simple header of type `integer`: + +```json +{ + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } +} +``` + +```yaml +description: The number of allowed requests in the current period +schema: + type: integer +``` + +#### Tag Object + +Adds metadata to a single tag that is used by the [Operation Object](#operationObject). +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the tag. +description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Tag Object Example + +```json +{ + "name": "pet", + "description": "Pets operations" +} +``` + +```yaml +name: pet +description: Pets operations +``` + + +#### Reference Object + +A simple object to allow referencing other components in the specification, internally and externally. + +The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. + +For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +$ref | `string` | **REQUIRED**. The reference string. + +This object cannot be extended with additional properties and any properties added SHALL be ignored. + +##### Reference Object Example + +```json +{ + "$ref": "#/components/schemas/Pet" +} +``` + +```yaml +$ref: '#/components/schemas/Pet' +``` + +##### Relative Schema Document Example +```json +{ + "$ref": "Pet.json" +} +``` + +```yaml +$ref: Pet.yaml +``` + +##### Relative Documents With Embedded Schema Example +```json +{ + "$ref": "definitions.json#/Pet" +} +``` + +```yaml +$ref: definitions.yaml#/Pet +``` + +#### Schema Object + +The Schema Object allows the definition of input and output data types. +These types can be objects, but also primitives and arrays. +This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). + +For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). +Unless stated otherwise, the property definitions follow the JSON Schema. + +##### Properties + +The following properties are taken directly from the JSON Schema definition and follow the same specifications: + +- title +- multipleOf +- maximum +- exclusiveMaximum +- minimum +- exclusiveMinimum +- maxLength +- minLength +- pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5) dialect) +- maxItems +- minItems +- uniqueItems +- maxProperties +- minProperties +- required +- enum + +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. +- type - Value MUST be a string. Multiple types via an array are not supported. +- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. +- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. + +Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline. + +Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. + +Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation: + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. +discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. +readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. +example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. + deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +###### Composition and Inheritance (Polymorphism) + +The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. +`allOf` takes an array of object definitions that are validated *independently* but together compose a single object. + +While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the `discriminator` field. +When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model. +As such, the `discriminator` field MUST be a required field. +There are two ways to define the value of a discriminator for an inheriting instance. +- Use the schema name. +- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. +As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. + +###### XML Modeling + +The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. +The [XML Object](#xmlObject) contains additional information about the available options. + +##### Schema Object Examples + +###### Primitive Sample + +```json +{ + "type": "string", + "format": "email" +} +``` + +```yaml +type: string +format: email +``` + +###### Simple Model + +```json +{ + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "age": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + } +} +``` + +```yaml +type: object +required: +- name +properties: + name: + type: string + address: + $ref: '#/components/schemas/Address' + age: + type: integer + format: int32 + minimum: 0 +``` + +###### Model with Map/Dictionary Properties + +For a simple string to string mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "type": "string" + } +} +``` + +```yaml +type: object +additionalProperties: + type: string +``` + +For a string to model mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ComplexModel" + } +} +``` + +```yaml +type: object +additionalProperties: + $ref: '#/components/schemas/ComplexModel' +``` + +###### Model with Example + +```json +{ + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "example": { + "name": "Puma", + "id": 1 + } +} +``` + +```yaml +type: object +properties: + id: + type: integer + format: int64 + name: + type: string +required: +- name +example: + name: Puma + id: 1 +``` + +###### Models with Composition + +```json +{ + "components": { + "schemas": { + "ErrorModel": { + "type": "object", + "required": [ + "message", + "code" + ], + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer", + "minimum": 100, + "maximum": 600 + } + } + }, + "ExtendedErrorModel": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorModel" + }, + { + "type": "object", + "required": [ + "rootCause" + ], + "properties": { + "rootCause": { + "type": "string" + } + } + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + ErrorModel: + type: object + required: + - message + - code + properties: + message: + type: string + code: + type: integer + minimum: 100 + maximum: 600 + ExtendedErrorModel: + allOf: + - $ref: '#/components/schemas/ErrorModel' + - type: object + required: + - rootCause + properties: + rootCause: + type: string +``` + +###### Models with Polymorphism Support + +```json +{ + "components": { + "schemas": { + "Pet": { + "type": "object", + "discriminator": { + "propertyName": "petType" + }, + "properties": { + "name": { + "type": "string" + }, + "petType": { + "type": "string" + } + }, + "required": [ + "name", + "petType" + ] + }, + "Cat": { + "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "huntingSkill": { + "type": "string", + "description": "The measured skill for hunting", + "default": "lazy", + "enum": [ + "clueless", + "lazy", + "adventurous", + "aggressive" + ] + } + }, + "required": [ + "huntingSkill" + ] + } + ] + }, + "Dog": { + "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "packSize": { + "type": "integer", + "format": "int32", + "description": "the size of the pack the dog is from", + "default": 0, + "minimum": 0 + } + }, + "required": [ + "packSize" + ] + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: ## "Cat" will be used as the discriminator value + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: ## "Dog" will be used as the discriminator value + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize +``` + +#### Discriminator Object + +When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. + +When using the discriminator, _inline_ schemas will not be considered. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. + mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. + +The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. + +In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' +``` + +which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: + + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: pet_type +``` + +The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: + +``` +{ + "id": 12345, + "pet_type": "Cat" +} +``` + +Will indicate that the `Cat` schema be used in conjunction with this payload. + +In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' +``` + +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison. + +When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. + +In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema. + +For example: + +``` +components: + schemas: + Pet: + type: object + required: + - pet_type + properties: + pet_type: + type: string + discriminator: + propertyName: pet_type + mapping: + cachorro: Dog + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Cat` + properties: + name: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Dog` + properties: + bark: + type: string + Lizard: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Lizard` + properties: + lovesRocks: + type: boolean +``` + +a payload like this: + +``` +{ + "pet_type": "Cat", + "name": "misty" +} +``` + +will indicate that the `Cat` schema be used. Likewise this schema: + +``` +{ + "pet_type": "cachorro", + "bark": "soft" +} +``` + +will map to `Dog` because of the definition in the `mappings` element. + + +#### XML Object + +A metadata object that allows for more fine-tuned XML model definitions. + +When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. +See examples for expected behavior. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. +namespace | `string` | The URI of the namespace definition. Value MUST be in the form of an absolute URI. +prefix | `string` | The prefix to be used for the [name](#xmlName). +attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. +wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### XML Object Examples + +The examples of the XML object definitions are included inside a property definition of a [Schema Object](#schemaObject) with a sample of the XML representation of it. + +###### No XML Element + +Basic string property: + +```json +{ + "animals": { + "type": "string" + } +} +``` + +```yaml +animals: + type: string +``` + +```xml +... +``` + +Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default): + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string +``` + +```xml +... +... +... +``` + +###### XML Name Replacement + +```json +{ + "animals": { + "type": "string", + "xml": { + "name": "animal" + } + } +} +``` + +```yaml +animals: + type: string + xml: + name: animal +``` + +```xml +... +``` + + +###### XML Attribute, Prefix and Namespace + +In this example, a full model definition is shown. + +```json +{ + "Person": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "xml": { + "attribute": true + } + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://example.com/schema/sample", + "prefix": "sample" + } + } + } + } +} +``` + +```yaml +Person: + type: object + properties: + id: + type: integer + format: int32 + xml: + attribute: true + name: + type: string + xml: + namespace: http://example.com/schema/sample + prefix: sample +``` + +```xml + + example + +``` + +###### XML Arrays + +Changing the element names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal +``` + +```xml +value +value +``` + +The external `name` property has no effect on the XML: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens +``` + +```xml +value +value +``` + +Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +To overcome the naming problem in the example above, the following definition can be used: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +Affecting both internal and external names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +If we change the external element but not the internal ones: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +#### Security Scheme Object + +Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06). + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. +description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +name | `string` | `apiKey` | **REQUIRED**. The name of the header, query or cookie parameter to be used. +in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. +scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). +bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. +openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Security Scheme Object Example + +###### Basic Authentication Sample + +```json +{ + "type": "http", + "scheme": "basic" +} +``` + +```yaml +type: http +scheme: basic +``` + +###### API Key Sample + +```json +{ + "type": "apiKey", + "name": "api_key", + "in": "header" +} +``` + +```yaml +type: apiKey +name: api_key +in: header +``` + +###### JWT Bearer Sample + +```json +{ + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT", +} +``` + +```yaml +type: http +scheme: bearer +bearerFormat: JWT +``` + +###### Implicit OAuth2 Sample + +```json +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```yaml +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### OAuth Flows Object + +Allows configuration of the supported OAuth Flows. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow +password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### OAuth Flow Object + +Configuration details for a supported OAuth Flow + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### OAuth Flow Object Examples + +```JSON +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```YAML +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + authorizationCode: + authorizationUrl: https://example.com/api/oauth/dialog + tokenUrl: https://example.com/api/oauth/token + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Security Requirement Object + +Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). + +Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. + +When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. + +##### Security Requirement Object Examples + +###### Non-OAuth2 Security Requirement + +```json +{ + "api_key": [] +} +``` + +```yaml +api_key: [] +``` + +###### OAuth2 Security Requirement + +```json +{ + "petstore_auth": [ + "write:pets", + "read:pets" + ] +} +``` + +```yaml +petstore_auth: +- write:pets +- read:pets +``` + +### Specification Extensions + +While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. + +The extensions properties are implemented as patterned fields that are always prefixed by `"x-"`. + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. Can have any valid JSON format value. + +The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced). + +### Security Filtering + +Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation. + +The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization. + +Two examples of this: + +1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. + +## Appendix A: Revision History + +Version | Date | Notes +--- | --- | --- +3.0.2 | TBD | Patch release of the OpenAPI Specification 3.0.2 +3.0.1 | 2017-12-06 | Patch release of the OpenAPI Specification 3.0.1 +3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 +3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification +3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification +3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification From baee430be542f670f9100208fe5b968833d63d7a Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 15 Dec 2017 08:26:12 -0800 Subject: [PATCH 0594/1801] Update future version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 583bbb970a..50346f0f69 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The current version of the OpenAPI specification is [OpenAPI Specification 3.0.1 ### Future Versions -[3.0.1](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.1) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. +[3.0.2](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.2-dev) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. ### Previous Versions From 8378ffb6711c5801b31beea4c1171e7c9bfbc4e5 Mon Sep 17 00:00:00 2001 From: PerthCharern <26418622+PerthCharern@users.noreply.github.com> Date: Fri, 15 Dec 2017 13:51:37 -0800 Subject: [PATCH 0595/1801] Update Open API object to OpenAPI Object in 3.0.2 --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 954b2c74d0..2789edaca3 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -3301,7 +3301,7 @@ The name used for each property MUST correspond to a security scheme declared in Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. -When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. +When a list of Security Requirement Objects is defined on the [OpenAPI Object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. ##### Patterned Fields From 212d6763ac672ee866ab850a3a81440c1d839e73 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 17 Dec 2017 16:48:40 +0000 Subject: [PATCH 0596/1801] 3.0.2 - Security Scheme Object description missing cookie --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 954b2c74d0..d7a2a22459 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -3132,7 +3132,7 @@ animals: #### Security Scheme Object Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06). +Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06). ##### Fixed Fields Field Name | Type | Applies To | Description From a754d1c3e4682af93b30a351189832aa274dddfc Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 20 Dec 2017 19:10:41 +0000 Subject: [PATCH 0597/1801] Fix WebSphere 'Download jar' links --- IMPLEMENTATIONS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 477bc106ea..e64ad180a4 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -36,7 +36,7 @@ These tools are not necessarily endorsed by the OAI. | openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | | swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | | lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | -| WebSphere Liberty | [Download jar] (https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | +| WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | #### Server Implementations @@ -53,5 +53,5 @@ These tools are not necessarily endorsed by the OAI. | serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | | zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | | slush-vertx | [Github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) -| WebSphere Liberty | [Download jar] (https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | +| WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | From 7e6b0e3db7bf71579b4db88acb396c105dac7015 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 20 Dec 2017 19:16:30 +0000 Subject: [PATCH 0598/1801] Implementations - add Widdershins --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 477bc106ea..090dc0c88b 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -37,6 +37,7 @@ These tools are not necessarily endorsed by the OAI. | swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | | lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | | WebSphere Liberty | [Download jar] (https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | +| Widdershins | [GitHub/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x | #### Server Implementations From 0a66966b338c5c133e5e63713220709f4d481c24 Mon Sep 17 00:00:00 2001 From: Jonathan Stoikovitch Date: Fri, 5 Jan 2018 11:42:09 -0800 Subject: [PATCH 0599/1801] Fixed some invalid examples It is understood that most examples showcased in the OAS spec are snippets, not entire OAS documents. However some of those snippets would not be valid even if included in entire OAS documents. This PR is an attempt to fix some of those examples. **List of changes**: - added a `GeneralError` schema inside the `Components Object Example` - split the `Example Object Example` into multiple examples --- versions/3.0.2.md | 121 ++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 46 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 0c46179866..dd42a82ee8 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -472,6 +472,18 @@ my.org.User ```json "components": { "schemas": { + "GeneralError": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + }, "Category": { "type": "object", "properties": { @@ -562,6 +574,14 @@ my.org.User ```yaml components: schemas: + GeneralError: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string Category: type: object properties: @@ -1903,10 +1923,11 @@ In all cases, the example value is expected to be compatible with the type schem of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible. -##### Example Object Example +##### Example Object Examples + +In a model: ```yaml -# in a model schemas: properties: name: @@ -1914,54 +1935,62 @@ schemas: examples: name: $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example +``` -# in a request body: - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Address' - examples: - foo: - summary: A foo example - value: {"foo": "bar"} - bar: - summary: A bar example - value: {"bar": "baz"} - 'application/xml': - examples: - xmlExample: - summary: This is an example in XML - externalValue: 'http://example.org/examples/address-example.xml' - 'text/plain': - examples: - textExample: - summary: This is a text example - externalValue: 'http://foo.bar/examples/address-example.txt' - +In a request body: -# in a parameter - parameters: - - name: 'zipCode' - in: 'query' +```yaml +requestBody: + content: + 'application/json': schema: - type: 'string' - format: 'zip-code' - examples: - zip-example: - $ref: '#/components/examples/zip-example' + $ref: '#/components/schemas/Address' + examples: + foo: + summary: A foo example + value: {"foo": "bar"} + bar: + summary: A bar example + value: {"bar": "baz"} + 'application/xml': + examples: + xmlExample: + summary: This is an example in XML + externalValue: 'http://example.org/examples/address-example.xml' + 'text/plain': + examples: + textExample: + summary: This is a text example + externalValue: 'http://foo.bar/examples/address-example.txt' +``` -# in a response - responses: - '200': - description: your car appointment has been booked - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessResponse' - examples: - confirmation-success: - $ref: '#/components/examples/confirmation-success' +In a parameter: + +```yaml +parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + examples: + zip-example: + $ref: '#/components/examples/zip-example' +``` + +In a response: + +```yaml +responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + examples: + confirmation-success: + $ref: '#/components/examples/confirmation-success' ``` From 60b17a6017f70c7afc51d8dcff43c5a8b1b66081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Al=C3=A8s?= Date: Mon, 22 Jan 2018 17:52:01 +0100 Subject: [PATCH 0600/1801] Update IMPLEMENTATIONS.md add user interface implementation --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index a57de94387..2e102c4c22 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -38,7 +38,7 @@ These tools are not necessarily endorsed by the OAI. | lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | | Widdershins | [GitHub/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x | - +| angular-swagger-ui | [GitHub/angular-swagger-ui](https://github.com/Orange-OpenSource/angular-swagger-ui) | AngularJS | An angularJS implementation of Swagger UI | #### Server Implementations | Title | Project Link | Language |Description | From e923c9cdae4b8ed23a7bca4d6079e0b38659b119 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 29 Jan 2018 11:44:51 -0500 Subject: [PATCH 0601/1801] Added the Microsoft OpenApi.Net library --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 2e102c4c22..73d2a0e6e3 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -13,7 +13,7 @@ These tools are not necessarily endorsed by the OAI. | KaiZen OpenAPI Parser | [GitHub/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | | openapi3-ts | [GitHub/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | | swagger2openapi | [GitHub/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | -| Tavis.OpenApi | [GitHub/tavis-sofware/Tavis.OpenApi](https://github.com/tavis-software/Tavis.OpenApi/) | dotnet | C# based parser with definition validation and migration support from V2 | +| Microsoft.OpenApi.net | [GitHub/microsoft/OpenApi.net](https://github.com/microsoft/openapi.net/) | dotnet | C# based parser with definition validation and migration support from V2 | | odata-openapi | [GitHub/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | | openapi3_parser | [GitHub/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | From 31406404fc256f9881b7679cd94591e09350d07f Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 2 Feb 2018 10:47:02 -0700 Subject: [PATCH 0602/1801] Update MAINTAINERS.md --- MAINTAINERS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 05849e61f5..34421f2c62 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -2,7 +2,9 @@ * Darrel Miller [@darrelmiller](https://github.com/darrelmiller) * Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) * Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) * Ron Ratovsky [@webron](https://github.com/webron) +* Uri Sarid [@usarid](https://github.com/usarid) ## Emeritus * Jason Harmon [@jharmn](https://github.com/jharmn) From 38de2ed926325776199d652e634dcf8f8d8df010 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 5 Feb 2018 08:33:49 +0000 Subject: [PATCH 0603/1801] Fix nvm install on travis --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37727967b9..822a22279c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,11 @@ matrix: - env: VALIDATORS=tv4 install: - rm -rf ~/.nvm + - mkdir -p ~/.nvm - curl -L https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh - source ~/.nvm/nvm.sh - - nvm install 6.1 - - nvm use 6.1 + - nvm install 8 + - nvm use 8 script: - npm install - node node_modules/mdv/mdv versions/3.*.md From f25a1d44cff9669703257173e562376cc5bd0ec6 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 8 Feb 2018 16:51:22 +0000 Subject: [PATCH 0604/1801] examples; fix licenses etc --- examples/v2.0/json/petstore-expanded.json | 10 +++++----- .../json/petstore-separate/spec/swagger.json | 16 ++++++++-------- .../v2.0/json/petstore-with-external-docs.json | 6 +++--- examples/v2.0/yaml/petstore-expanded.yaml | 8 ++++---- .../yaml/petstore-separate/spec/swagger.yaml | 14 +++++++------- .../v2.0/yaml/petstore-with-external-docs.yaml | 4 ++-- examples/v3.0/petstore-expanded.yaml | 8 ++++---- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/v2.0/json/petstore-expanded.json b/examples/v2.0/json/petstore-expanded.json index 0c59f9a48e..d5d8de8126 100644 --- a/examples/v2.0/json/petstore-expanded.json +++ b/examples/v2.0/json/petstore-expanded.json @@ -7,12 +7,12 @@ "termsOfService": "http://swagger.io/terms/", "contact": { "name": "Swagger API Team", - "email": "foo@example.com", - "url": "http://madskristensen.net" + "email": "apiteam@swagger.io", + "url": "http://swagger.io" }, "license": { - "name": "MIT", - "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT" + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } }, "host": "petstore.swagger.io", @@ -207,4 +207,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/v2.0/json/petstore-separate/spec/swagger.json b/examples/v2.0/json/petstore-separate/spec/swagger.json index 542b76fc2a..7276990020 100644 --- a/examples/v2.0/json/petstore-separate/spec/swagger.json +++ b/examples/v2.0/json/petstore-separate/spec/swagger.json @@ -4,18 +4,18 @@ "version": "1.0.0", "title": "Swagger Petstore", "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", - "termsOfService": "http://helloreverb.com/terms/", + "termsOfService": "http://swagger.io/terms/", "contact": { - "name": "Wordnik API Team", - "email": "foo@example.com", - "url": "http://madskristensen.net" + "name": "Swagger API Team", + "email": "apiteam@swagger.io", + "url": "http://swagger.io" }, "license": { - "name": "MIT", - "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT" + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } }, - "host": "petstore.swagger.wordnik.com", + "host": "petstore.swagger.io", "basePath": "/api", "schemes": [ "http" @@ -143,4 +143,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/v2.0/json/petstore-with-external-docs.json b/examples/v2.0/json/petstore-with-external-docs.json index 4c5154c233..e9d3f7765d 100644 --- a/examples/v2.0/json/petstore-with-external-docs.json +++ b/examples/v2.0/json/petstore-with-external-docs.json @@ -11,8 +11,8 @@ "url": "http://swagger.io" }, "license": { - "name": "MIT", - "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT" + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } }, "externalDocs": { @@ -230,4 +230,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/v2.0/yaml/petstore-expanded.yaml b/examples/v2.0/yaml/petstore-expanded.yaml index 588759d91a..e415dae654 100644 --- a/examples/v2.0/yaml/petstore-expanded.yaml +++ b/examples/v2.0/yaml/petstore-expanded.yaml @@ -6,11 +6,11 @@ info: termsOfService: http://swagger.io/terms/ contact: name: Swagger API Team - email: foo@example.com - url: http://madskristensen.net + email: apiteam@swagger.io + url: http://swagger.io license: - name: MIT - url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html host: petstore.swagger.io basePath: /api schemes: diff --git a/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml b/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml index 850527ebf6..b937b5022a 100644 --- a/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml +++ b/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml @@ -3,15 +3,15 @@ info: version: 1.0.0 title: Swagger Petstore description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - termsOfService: http://helloreverb.com/terms/ + termsOfService: http://swagger.io/terms/ contact: - name: Wordnik API Team - email: foo@example.com - url: http://madskristensen.net + name: Swagger API Team + email: apiteam@swagger.io + url: http://swagger.io license: - name: MIT - url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -host: petstore.swagger.wordnik.com + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +host: petstore.swagger.io basePath: /api schemes: - http diff --git a/examples/v2.0/yaml/petstore-with-external-docs.yaml b/examples/v2.0/yaml/petstore-with-external-docs.yaml index 3db47ff362..792864fca0 100644 --- a/examples/v2.0/yaml/petstore-with-external-docs.yaml +++ b/examples/v2.0/yaml/petstore-with-external-docs.yaml @@ -10,8 +10,8 @@ email: "apiteam@swagger.io" url: "http://swagger.io" license: - name: "MIT" - url: "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT" + name: "Apache 2.0" + url: "https://www.apache.org/licenses/LICENSE-2.0.html" externalDocs: description: "find more info here" url: "https://swagger.io/about" diff --git a/examples/v3.0/petstore-expanded.yaml b/examples/v3.0/petstore-expanded.yaml index e8c0fe5ffd..d7533318c6 100644 --- a/examples/v3.0/petstore-expanded.yaml +++ b/examples/v3.0/petstore-expanded.yaml @@ -6,11 +6,11 @@ info: termsOfService: http://swagger.io/terms/ contact: name: Swagger API Team - email: foo@example.com - url: http://madskristensen.net + email: apiteam@swagger.io + url: http://swagger.io license: - name: MIT - url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - url: http://petstore.swagger.io/api paths: From 67adcc74dbcd8e8797b23b1d71d1cacc2588e537 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 5 Feb 2018 08:33:49 +0000 Subject: [PATCH 0605/1801] Fix nvm install on travis --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37727967b9..822a22279c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,11 @@ matrix: - env: VALIDATORS=tv4 install: - rm -rf ~/.nvm + - mkdir -p ~/.nvm - curl -L https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh - source ~/.nvm/nvm.sh - - nvm install 6.1 - - nvm use 6.1 + - nvm install 8 + - nvm use 8 script: - npm install - node node_modules/mdv/mdv versions/3.*.md From 2c20fa0308d83f4783cf8a8111feb79b98d71d62 Mon Sep 17 00:00:00 2001 From: Richard Klose Date: Sat, 10 Feb 2018 18:03:18 +0100 Subject: [PATCH 0606/1801] Add swagger-node-codegen --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index ab1b69c37e..f2a8bdaf11 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -56,4 +56,5 @@ These tools are not necessarily endorsed by the OAI. | zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | | slush-vertx | [Github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | +| swagger-node-codegen | [Github/fmvilas/swagger-node-codegen](https://github.com/fmvilas/swagger-node-codegen) | Node.js | Generates a Node.js/express server, but also has a template engine for creating any templates needed. | From ba22cc20254db4699ca176716a021417083fe9d8 Mon Sep 17 00:00:00 2001 From: weimengxi Date: Sun, 11 Feb 2018 19:27:02 +0800 Subject: [PATCH 0607/1801] fixing Issue#1449: revise 405 Response Object description from 'Input Invalid' to 'Method Not Allowed' --- versions/3.0.2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index dd42a82ee8..7762606474 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -903,7 +903,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } }, "405": { - "description": "Invalid input", + "description": "Method Not Allowed", "content": { "application/json": {}, "application/xml": {} @@ -953,7 +953,7 @@ responses: 'application/json': {} 'application/xml': {} '405': - description: Invalid input + description: Method Not Allowed content: 'application/json': {} 'application/xml': {} From c8fc3bd9e2909abb80f4e0c1d8b871345b8a1bf0 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 14 Feb 2018 22:44:33 -0500 Subject: [PATCH 0608/1801] Updated wording to clarify intent --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 7762606474..b5bb5c861c 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1646,7 +1646,7 @@ Field Name | Type | Description ##### Patterned Fields Field Pattern | Type | Description ---|:---:|--- -[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. This object MAY be extended with [Specification Extensions](#specificationExtensions). From a961eaef6456840e0ba62671d70bf0c7f4e18d03 Mon Sep 17 00:00:00 2001 From: Ed Ropple Date: Thu, 1 Mar 2018 00:42:11 -0500 Subject: [PATCH 0609/1801] Update IMPLEMENTATIONS.md Modern isn't quite finished but it's rapidly approaching "usable by people who are not me" territory and I figured it was time to start talking about it a little bit. --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index f2a8bdaf11..dc01815f96 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -45,6 +45,7 @@ These tools are not necessarily endorsed by the OAI. |----------------|--------------|----------|---------------------| | Vert.x Web API Contract | [Github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation | Fusio | [Github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 +| Modern | [Github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation #### Code Generators From 6943cc17e7cd49806719ef87da06d357b2a1d201 Mon Sep 17 00:00:00 2001 From: Jeff ErnstFriedman Date: Wed, 7 Mar 2018 14:33:43 -0800 Subject: [PATCH 0610/1801] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 50346f0f69..c432ba4236 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) -The OpenAPI Specification is a community-driven open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. +The OpenAPI Specification is a community-driven open specification within the [OpenAPI Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for [REST APIs](https://en.wikipedia.org/wiki/Representational_state_transfer), which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. @@ -43,7 +43,7 @@ The current process for development of the OpenAPI Specification is described in [Development Guidelines](DEVELOPMENT.md). Development of the next version of the OpenAPI Specification is guided by the [Technical Steering Committee (TSC)](https://www.openapis.org/participate/how-to-contribute/governance#TDC). This group of committers bring their API expertise, incorporate feedback from the community, and expand the group of committers as appropriate. All development activity on the future specification will be performed as features and merged into this branch. Upon release of the future specification, this branch will be merged to master. -The TSC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TSC calendar online](https://oai-technicalsteeringcommittee.groups.io/g/main/calendar), and import it to your calendar using the [iCal link](https://OAI-TechnicalSteeringCommittee.groups.io/g/main/ics/860119/668774333/feed.ics). +The TSC holds weekly web conferences to review open pull requests and discuss open issues related to the evolving OpenAPI Specification. Participation in weekly calls and scheduled working sessions is open to the community. You can view the [TSC calendar online](https://openapi.groups.io/g/tsc/calendar), and import it to your calendar using the [iCal link](https://openapi.groups.io/g/tsc/ics/1105671/1995679554/feed.ics). The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: From 07fde54a60c9763260a622b5f0dfeccf5a465491 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 9 Mar 2018 17:55:23 +0000 Subject: [PATCH 0611/1801] Implementations; fix link to modern framework --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index dc01815f96..5b808da01d 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -45,7 +45,7 @@ These tools are not necessarily endorsed by the OAI. |----------------|--------------|----------|---------------------| | Vert.x Web API Contract | [Github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation | Fusio | [Github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 -| Modern | [Github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation +| Modern | [Github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation #### Code Generators From 7081594d2a7c13662d9a9c55107103b21f002ed0 Mon Sep 17 00:00:00 2001 From: Adam Butler Date: Thu, 15 Mar 2018 11:16:42 +0000 Subject: [PATCH 0612/1801] Add oas_parser --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 5b808da01d..64a0179cb0 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -16,6 +16,7 @@ These tools are not necessarily endorsed by the OAI. | Microsoft.OpenApi.net | [GitHub/microsoft/OpenApi.net](https://github.com/microsoft/openapi.net/) | dotnet | C# based parser with definition validation and migration support from V2 | | odata-openapi | [GitHub/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | | openapi3_parser | [GitHub/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | +| oas_parser | [GitHub/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | #### Editors From f2ee7a38d73a72bb0054cf198bd2ed2781235307 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 3 Apr 2018 12:00:44 -0400 Subject: [PATCH 0613/1801] The "Common Name" field was confusing people So many people were considering dateTime, etc to be an OpenAPI type that tool vendors were implementing functionality to normalize this. https://github.com/mikunn/openapi-schema-to-json-schema/issues/4 I too in the past have thought I was meant to use dateTime in the format, not date-time. Let's just get rid of this column, it serves no real purpose as far as I can tell. --- versions/3.0.2.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index b5bb5c861c..44a386c941 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -151,19 +151,22 @@ Types that are not accompanied by a `format` property follow the type definition The formats defined by the OAS are: -Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments ------------ | ------ | -------- | -------- -integer | `integer` | `int32` | signed 32 bits -long | `integer` | `int64` | signed 64 bits -float | `number` | `float` | | -double | `number` | `double` | | -string | `string` | | | -byte | `string` | `byte` | base64 encoded characters -binary | `string` | `binary` | any sequence of octets -boolean | `boolean` | | | -date | `string` | `date` | As defined by `full-date` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -password | `string` | `password` | A hint to UIs to obscure input. +[`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments +------ | -------- | -------- +`integer` | `int32` | signed 32 bits +`integer` | `int64` | signed 64 bits (a.k.a long) +`number` | `float` | | +`number` | `double` | | +`string` | | | +`string` | `byte` | base64 encoded characters +`string` | `binary` | any sequence of octets +`boolean` | | | +`string` | `date` | As defined by `full-date` - +[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +`string` | `date-time` | As defined by `date-time` - +[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +`string` | `password` | A hint to UIs to obscure input. + ### Rich Text Formatting Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. From f8b3f3d818b0520d8b0f125643c5c5e878249e49 Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Wed, 4 Apr 2018 12:16:59 -0700 Subject: [PATCH 0614/1801] Adding marshmallow-code/apispec also cleaning up some inconsistent capitalization and spacing --- IMPLEMENTATIONS.md | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 64a0179cb0..e572355a99 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -8,55 +8,55 @@ These tools are not necessarily endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| swagger-parser | [GitHub/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to Open API Specification converter | -| swagger-models | [GitHub/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | Open API 3.0 Java Pojos | -| KaiZen OpenAPI Parser | [GitHub/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | -| openapi3-ts | [GitHub/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | -| swagger2openapi | [GitHub/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | -| Microsoft.OpenApi.net | [GitHub/microsoft/OpenApi.net](https://github.com/microsoft/openapi.net/) | dotnet | C# based parser with definition validation and migration support from V2 | -| odata-openapi | [GitHub/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | -| openapi3_parser | [GitHub/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | -| oas_parser | [GitHub/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | +| swagger-parser | [github/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to OpenAPI Specification converter | +| swagger-models | [github/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | OpenAPI 3.0 Java Pojos | +| KaiZen OpenAPI Parser | [github/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | +| openapi3-ts | [github/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | +| swagger2openapi | [github/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | +| Microsoft.OpenApi.net | [github/microsoft/OpenApi.net](https://github.com/microsoft/openapi.net/) | dotnet | C# based parser with definition validation and migration support from V2 | +| odata-openapi | [github/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | +| openapi3_parser | [github/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | +| oas_parser | [github/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | #### Editors | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| Apicurio Studio | [GitHub/Apicurio/apicurio-studio](https://github.com/Apicurio/apicurio-studio) | Java/Typescript | Web-Based **visual designer** for OpenAPI 2.0 and 3.0.0. | -| KaiZen OpenAPI Editor | [GitHub/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | +| Apicurio Studio | [github/Apicurio/apicurio-studio](https://github.com/Apicurio/apicurio-studio) | Java/Typescript | Web-Based **visual designer** for OpenAPI 2.0 and 3.0.0. | +| KaiZen OpenAPI Editor | [github/RepreZen/KaiZen-OpenAPI-Editor](https://github.com/RepreZen/KaiZen-OpenAPI-Editor) | Java | Eclipse Editor for OpenAPI 2.0 and 3.0 | | RepreZen API Studio | [RepreZen.com/OpenAPI](https://www.reprezen.com/OpenAPI) | Java | Commercial desktop IDE for API design, documentation & development | -| OpenApi-gui | [GitHub/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenApi / Swagger definitions | +| OpenAPI-gui | [github/Mermade/openapi-gui](https://github.com/Mermade/openapi-gui) | Node.js | GUI / visual editor for creating and editing OpenAPI definitions | | SwaggerHub | [swaggerhub.com](https://swaggerhub.com) | | API Design and Documentation Platform, Built For Teams -| swagger-editor | [GitHub/swagger-api](https://github.com/swagger-api/swagger-editor) | JavaScript | Web-Based editor for creating, editing, validating and testing OpenAPI\Swagger definitions | +| swagger-editor | [github/swagger-api](https://github.com/swagger-api/swagger-editor) | JavaScript | Web-Based editor for creating, editing, validating and testing OpenAPI\Swagger definitions | #### User Interfaces | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| openapi-viewer | [GitHub/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | -| swagger-ui | [GitHub/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | -| lincoln | [GitHub/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for Open API v3 | +| openapi-viewer | [github/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. | +| swagger-ui | [github/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions | +| lincoln | [github/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for OpenAPI v3 | | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL | -| Widdershins | [GitHub/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x | -| angular-swagger-ui | [GitHub/angular-swagger-ui](https://github.com/Orange-OpenSource/angular-swagger-ui) | AngularJS | An angularJS implementation of Swagger UI | +| Widdershins | [github/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x | +| angular-swagger-ui | [github/angular-swagger-ui](https://github.com/Orange-OpenSource/angular-swagger-ui) | AngularJS | An angularJS implementation of Swagger UI | #### Server Implementations | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| Vert.x Web API Contract | [Github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation -| Fusio | [Github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 -| Modern | [Github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation +| Vert.x Web API Contract | [github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation +| Fusio | [github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 +| Modern | [github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation #### Code Generators | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| baucis-openapi3 | [Github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | -| Google Gnostic | [GitHub/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | -| serverless-openapi-documentation | [GitHub/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | -| zero-rails_openapi | [GitHub/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | -| slush-vertx | [Github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) +| baucis-openapi3 | [github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | +| Google Gnostic | [github/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | +| serverless-openapi-documentation | [github/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | +| apispec | [github/marshmallow-code/apispec/](https://github.com/marshmallow-code/apispec) | Python | A framework-agnostic pluggable API specification generator for Python. | +| zero-rails_openapi | [github/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | +| slush-vertx | [github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | -| swagger-node-codegen | [Github/fmvilas/swagger-node-codegen](https://github.com/fmvilas/swagger-node-codegen) | Node.js | Generates a Node.js/express server, but also has a template engine for creating any templates needed. | - +| swagger-node-codegen | [github/fmvilas/swagger-node-codegen](https://github.com/fmvilas/swagger-node-codegen) | Node.js | Generates a Node.js/express server, but also has a template engine for creating any templates needed. | From fe0d2eca21d96d80fef38faea8638db409a91eee Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Thu, 5 Apr 2018 14:44:17 -0700 Subject: [PATCH 0615/1801] Per feedback from Mike --- IMPLEMENTATIONS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index e572355a99..e7411465f3 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -2,7 +2,7 @@ Below is a list of known tooling that implements the 3.0.0 specification. While support for the 3.0.0 specification matures, refer to the details of projects listed below for any notes about stability and roadmap. The process to improve the 3.x specification includes feedback from end-users and tooling creators. We strongly encourage draft tooling be made available for early users of OAS drafts. -These tools are not necessarily endorsed by the OAI. +These tools are not endorsed by the OAI. #### Low-Level tooling @@ -55,7 +55,6 @@ These tools are not necessarily endorsed by the OAI. | baucis-openapi3 | [github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | | Google Gnostic | [github/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | | serverless-openapi-documentation | [github/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | -| apispec | [github/marshmallow-code/apispec/](https://github.com/marshmallow-code/apispec) | Python | A framework-agnostic pluggable API specification generator for Python. | | zero-rails_openapi | [github/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | | slush-vertx | [github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | From 3e7d0a8c1735c535d68d44cb608d1d56d387a691 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 8 Apr 2018 21:25:29 -0400 Subject: [PATCH 0616/1801] Added wording to clarify case sensitivity --- versions/3.0.1.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 0a8a834358..f865ba58f3 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -118,6 +118,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. +This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. @@ -823,7 +824,7 @@ Field Name | Type | Description summary | `string` | A short summary of what the operation does. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. -operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. From 6f3be3357485aeda0e0224d02d6cdf2b4348498e Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 8 Apr 2018 22:27:38 -0400 Subject: [PATCH 0617/1801] Draft features explanation --- DEVELOPMENT.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index b975f55b98..191eb97af2 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -47,6 +47,24 @@ Spec changes should be approved by a majority of the committers. Approval can b No change should be approved until there is documentation for it, supplied in an accompanying PR. +## Draft Features + +Where suitable, features will be introduced as draft but OAI approved extensions. +By introducing new features this way we enable new features to be designed, documented and then implemented by tools that are interested in the feature, without putting the burden of implementation on all tooling. +If the feature is successfully implemented and there is demonstrable value added by the feature, it will become a candidate for inclusion in a future release of the specification, at which point all tools will be expected to support the feature. + +Draft feature extensions are identified by the `x-oas-draft-` prefix and can only be used where existing extensions are permitted. +This ensures no exising tooling will affected by the introduction of the draft feature. +If the feature is deemed appropriate for inclusion in the OAS, the `x-oas-draft-` prefix will be removed. +Tooling that supports draft features should plan for the future removal of the prefix and accomodate the transition period where descriptions exist with and without the prefix. + +Draft features will be documented as Github issues and labeled with the `draft-feature` label. +If during the development of a draft feature, it is determined that the feature needs to change in a way that may break existing draft implementations, the extension name itself may be versioned with a version suffix. e.g. `-v2` + +Not all future new features will be introduced in this way. +Some new features impact the specification in ways that cannot be encapsulated in an extension. +However, where a new feature can be introduced in this way, it should be. + ## Transparency We should always be as transparent as possible. Sometimes there will be discussions that use customer names, sensitive use cases, and so on. These must be anonymized, discussed in a private repository, or conducted offline. From 0b20798286f57948014c96712fbcce79c8fff60f Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 9 Apr 2018 19:25:40 +0300 Subject: [PATCH 0618/1801] styling fix --- versions/3.0.2.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 44a386c941..9b750af769 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -161,10 +161,8 @@ The formats defined by the OAS are: `string` | `byte` | base64 encoded characters `string` | `binary` | any sequence of octets `boolean` | | | -`string` | `date` | As defined by `full-date` - -[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) -`string` | `date-time` | As defined by `date-time` - -[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +`string` | `date` | As defined by `full-date` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +`string` | `date-time` | As defined by `date-time` - [RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) `string` | `password` | A hint to UIs to obscure input. From 4c79d31f3e9392131306d8b925325d2f9d809354 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 9 Apr 2018 19:39:58 +0300 Subject: [PATCH 0619/1801] Add a period, because... --- versions/3.0.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index f865ba58f3..58aa7803a8 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -118,7 +118,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. -This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** +This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive**. The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. From 0777dd66592444a9054b261bbeaa9ba84cc763d5 Mon Sep 17 00:00:00 2001 From: torychow <522617505@qq.com> Date: Wed, 11 Apr 2018 14:31:22 +0800 Subject: [PATCH 0620/1801] Update IMPLEMENTATIONS.md Correct the github link of swagger-api --- IMPLEMENTATIONS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index e7411465f3..12856b8e54 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -8,8 +8,8 @@ These tools are not endorsed by the OAI. | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| -| swagger-parser | [github/swagger-api](https://github.com/swagger-api/swagger-parser/tree/feature/3.0.0-rc0) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to OpenAPI Specification converter | -| swagger-models | [github/swagger-api](https://github.com/swagger-api/swagger-core/tree/feature/3.0.0-rc0/modules/swagger-models) | Java | OpenAPI 3.0 Java Pojos | +| swagger-parser | [github/swagger-api](https://github.com/swagger-api/swagger-parser) | Java | Swagger 1.0, 1.1, 1.2, 2.0 to OpenAPI Specification converter | +| swagger-models | [github/swagger-api](https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-models) | Java | OpenAPI 3.0 Java Pojos | | KaiZen OpenAPI Parser | [github/RepreZen/KaiZen-OpenAPI-Parser](https://github.com/RepreZen/KaiZen-OpenAPI-Parser) | Java | High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x | | openapi3-ts | [github/metadevpro/openapi3-ts](https://github.com/metadevpro/openapi3-ts) | TypeScript | TS Model & utils for OpenAPI 3.0.x contracts | | swagger2openapi | [github/mermade/swagger2openapi](https://github.com/mermade/swagger2openapi) | Node.js | An OpenAPI / Swagger 2.0 to OpenAPI 3.0.x converter and validator | From b9ab1c11c2a295ad7104488b10acdb3bb26828fe Mon Sep 17 00:00:00 2001 From: Andrea Kao Date: Thu, 12 Apr 2018 11:30:35 -0700 Subject: [PATCH 0621/1801] edit OpenAPI Specification license info GitHub uses a library called Licensee to identify a project's license type. It shows this information in the status bar and via the API if it can unambiguously identify the license. This commit creates a LICENSE file that stores the full text of the Apache license, referencing The Linux Foundation as the copyright holder. It also updates package.json with the correct SPDX license ID and updates the README "License" header to "Licensing". Collectively, these changes allow Licensee to successfully identify the license type of the OpenAPI Specification project as Apache. Signed-off-by: Andrea Kao --- LICENSE | 208 ++++++++++++++++++++++++++++++++++++++++++++++++--- README.md | 2 +- package.json | 2 +- 3 files changed, 201 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index 8d9ebfcb19..23b34fdff2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,11 +1,201 @@ -Copyright 2017 The Linux Foundation + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright The Linux Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index c432ba4236..954599fc83 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The Open API Initiative encourages participation from individuals and companies Not all feedback can be accommodated and there may be solid arguments for or against a change being appropriate for the specification. -## License +## Licensing See: [License (Apache-2.0)](https://github.com/OAI/OpenAPI-Specification/blob/master/LICENSE) diff --git a/package.json b/package.json index a5b8cd1873..0d7f347b27 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "email": "fehguy@gmail.com", "url": "http://swagger.io" }, - "license": "Apache", + "license": "Apache-2.0", "readmeFilename": "README.md", "dependencies": { "tv4": "~1.1.x", From 00be9d5133bf47c43cb1b26604b364f1ef3a9e3d Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Apr 2018 10:09:58 -0400 Subject: [PATCH 0622/1801] Updates based on reviews --- DEVELOPMENT.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 191eb97af2..6038bdcc9c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -54,12 +54,16 @@ By introducing new features this way we enable new features to be designed, docu If the feature is successfully implemented and there is demonstrable value added by the feature, it will become a candidate for inclusion in a future release of the specification, at which point all tools will be expected to support the feature. Draft feature extensions are identified by the `x-oas-draft-` prefix and can only be used where existing extensions are permitted. -This ensures no exising tooling will affected by the introduction of the draft feature. +This ensures no existing tooling will affected by the introduction of the draft feature. If the feature is deemed appropriate for inclusion in the OAS, the `x-oas-draft-` prefix will be removed. -Tooling that supports draft features should plan for the future removal of the prefix and accomodate the transition period where descriptions exist with and without the prefix. +Tooling that supports draft features should plan for the future removal of the prefix. +When tooling adds support for a later version of OAS that includes the final implementation of the feature, it MUST not support the use of the draft prefix for that feature. +Draft features will only be promoted into minor or major releases of the specification and therefore will be transparent to OpenAPI description writers and tooling providers who choose not to use the feature while in its draft state. -Draft features will be documented as Github issues and labeled with the `draft-feature` label. +Draft features will be documented as GitHub issues and labeled with the `draft-feature` label. If during the development of a draft feature, it is determined that the feature needs to change in a way that may break existing draft implementations, the extension name itself may be versioned with a version suffix. e.g. `-v2` +When a draft feature becomes part of a future update to the specification any version suffix will be removed. +Draft features that are deemed not appropriate for inclusion MUST be marked with the `abandoned` label. Not all future new features will be introduced in this way. Some new features impact the specification in ways that cannot be encapsulated in an extension. From d2652cc55137147a2ec0206f24d718e0378d5eb7 Mon Sep 17 00:00:00 2001 From: Ted Epstein Date: Tue, 17 Apr 2018 14:29:26 -0400 Subject: [PATCH 0623/1801] State explicitly: `additionalProperties : true` is the default Address #715 - State (explicitly) whether Open API schema object definitions are open or closed for extension. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 9b750af769..31df8b87cb 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2301,7 +2301,7 @@ The following properties are taken from the JSON Schema definition but their def - not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true` or empty schema, allowing additional properties with any legal value. - description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. From 018e2f9cf049497477f8b61f2588d91a8d9b729c Mon Sep 17 00:00:00 2001 From: Ted Epstein Date: Thu, 19 Apr 2018 07:12:09 -0400 Subject: [PATCH 0624/1801] Small tweak: "an empty schema" Address #715 - State (explicitly) whether Open API schema object definitions are open or closed for extension. Add 'an' for readability. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 31df8b87cb..62bfc256bf 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2301,7 +2301,7 @@ The following properties are taken from the JSON Schema definition but their def - not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true` or empty schema, allowing additional properties with any legal value. +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true` or an empty schema, allowing additional properties with any legal value. - description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. From a7b1d7adafc8f0534893048dd97eff8061588234 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 23 Apr 2018 13:07:11 -0400 Subject: [PATCH 0625/1801] Update 3.0.2.md Updated suggested text to simplify --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 62bfc256bf..edf9b72780 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2301,7 +2301,7 @@ The following properties are taken from the JSON Schema definition but their def - not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. - properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). -- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true` or an empty schema, allowing additional properties with any legal value. +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true`. - description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. From 0312d8fefb9c1379b526b84c31d19ed6cc1bef94 Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Mon, 23 Apr 2018 13:23:43 -0400 Subject: [PATCH 0626/1801] Fix callback key expression example. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index edf9b72780..58792cae57 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1883,7 +1883,7 @@ $method | POST $request.path.eventType | myevent $request.query.queryUrl | http://clientdomain.com/stillrunning $request.header.content-Type | application/json -$request.body#/failedUrl | http://clientdomain.com/stillrunning +$request.body#/failedUrl | http://clientdomain.com/failed $request.body#/successUrls/2 | http://clientdomain.com/medium $response.header.Location | http://example.org/subscription/1 From 0d71a8466636ec8cab0387b90ad4004524a76c47 Mon Sep 17 00:00:00 2001 From: ackey Date: Tue, 24 Apr 2018 09:49:58 +0900 Subject: [PATCH 0627/1801] Add missing description of default value --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index edf9b72780..fccaeb7dcf 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1013,7 +1013,7 @@ Field Name | Type | Description in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. - deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. + deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`. allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. The rules for serialization of the parameter are specified in one of two ways. From c3855f1a49a3c2bcc21b8db12ac09c3f09e5e042 Mon Sep 17 00:00:00 2001 From: Kevin Gilbert Date: Fri, 27 Apr 2018 15:14:23 -0500 Subject: [PATCH 0628/1801] Add koa2-oas3 to implementations --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index e7411465f3..6187e8a46e 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -47,6 +47,7 @@ These tools are not endorsed by the OAI. | Vert.x Web API Contract | [github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation | Fusio | [github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 | Modern | [github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation +| Koa2-OAS3 | [github/OverSpeedIO/koa2-oas3](https://github.com/OverSpeedIO/koa2-oas3) | Node.js | OpenAPI 3 request validation middleware for Koa2 based apps. #### Code Generators From b69013ee3125b4a1e2bc9d8b8fd96b92811df2c1 Mon Sep 17 00:00:00 2001 From: Kevin Gilbert Date: Fri, 27 Apr 2018 15:23:41 -0500 Subject: [PATCH 0629/1801] add oas3-remote-refs to tools --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 6187e8a46e..a2a844462e 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -17,6 +17,7 @@ These tools are not endorsed by the OAI. | odata-openapi | [github/oasis-tcs/odata-openapi](https://github.com/oasis-tcs/odata-openapi) | XSLT | OData 4.0 to OpenAPI 3.0.0 converter | | openapi3_parser | [github/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | | oas_parser | [github/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | +| oas3-remote-refs | [github//OverSpeedIO/oas3-remote-refs](https://github.com/OverSpeedIO/oas3-remote-refs) | Node.js | Tool to pull remote refernences and merge them into the definitions of the provided OpenAPI3 speicfication. #### Editors From c3161bce4eec02575d06a202d947032a1155c19e Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 30 Apr 2018 11:47:21 -0400 Subject: [PATCH 0630/1801] Added words for the process of marking a draft-feature ready to be implmented --- DEVELOPMENT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 6038bdcc9c..d53d25d3f6 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -64,6 +64,7 @@ Draft features will be documented as GitHub issues and labeled with the `draft-f If during the development of a draft feature, it is determined that the feature needs to change in a way that may break existing draft implementations, the extension name itself may be versioned with a version suffix. e.g. `-v2` When a draft feature becomes part of a future update to the specification any version suffix will be removed. Draft features that are deemed not appropriate for inclusion MUST be marked with the `abandoned` label. +Draft-features that are considered suitably specified for implementation will be marked with the `draft-ready` label. Not all future new features will be introduced in this way. Some new features impact the specification in ways that cannot be encapsulated in an extension. From e42a2a54c882fb4d877d8a65680a00c4e230e8f8 Mon Sep 17 00:00:00 2001 From: Ethan Date: Fri, 4 May 2018 14:37:55 -0700 Subject: [PATCH 0631/1801] the server variable default is supplied in the OpenAPI document, not by the consumer --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index edf9b72780..f368feba3f 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -429,7 +429,7 @@ An object representing a Server Variable for server URL template substitution. Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. -default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided in the document. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. This object MAY be extended with [Specification Extensions](#specificationExtensions). From e102bcdce1cbbd7c91629ba164972e275b283eea Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 8 May 2018 16:55:25 -0600 Subject: [PATCH 0632/1801] Update 3.0.2.md --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index f368feba3f..53a13689c2 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -429,7 +429,7 @@ An object representing a Server Variable for server URL template substitution. Field Name | Type | Description ---|:---:|--- enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. -default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided in the document. +default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values, because in those cases parameter values are optional. description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. This object MAY be extended with [Specification Extensions](#specificationExtensions). From e533a5667f56bd1c163edbfa2de1d734f5ce6854 Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Sat, 12 May 2018 13:11:59 -0400 Subject: [PATCH 0633/1801] Explicitly state that Media Type Object schema field applies to responses as well as requests. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 8a057ed55f..aa489ed276 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1363,7 +1363,7 @@ Each Media Type Object provides schema and examples for the media type identifie ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body (or response body, if this is part of a response). example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. From 8f01d773d92e334b8214110d961784f828ed0305 Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Sat, 12 May 2018 16:59:44 -0400 Subject: [PATCH 0634/1801] Update wording with suggestion from @tedepstein. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index aa489ed276..7ffb3e8388 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1363,7 +1363,7 @@ Each Media Type Object provides schema and examples for the media type identifie ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body (or response body, if this is part of a response). +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the content of the request, response, or parameter. example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. From 80fd1186608a4fa549ca797e74eb44c2b386df75 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Tue, 15 May 2018 17:44:50 +0900 Subject: [PATCH 0635/1801] Fix typo in example --- examples/v3.0/petstore.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/petstore.yaml b/examples/v3.0/petstore.yaml index 5fdfba907d..09941de971 100644 --- a/examples/v3.0/petstore.yaml +++ b/examples/v3.0/petstore.yaml @@ -23,7 +23,7 @@ paths: format: int32 responses: '200': - description: An paged array of pets + description: A paged array of pets headers: x-next: description: A link to the next page of responses From 0926d73508fe8bf40ee9f097a3fb9ec819e5ec18 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 18 May 2018 10:09:25 +0100 Subject: [PATCH 0636/1801] typo; missing 'the' in security requirement text --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 8a057ed55f..c061ec9960 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -3331,7 +3331,7 @@ The name used for each property MUST correspond to a security scheme declared in Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. -When a list of Security Requirement Objects is defined on the [OpenAPI Object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. +When a list of Security Requirement Objects is defined on the [OpenAPI Object](#oasObject) or [Operation Object](#operationObject), only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. ##### Patterned Fields From 26ead2926ce96234ef86ea8f60621744d6555559 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 20 May 2018 15:46:27 -0400 Subject: [PATCH 0637/1801] Updated new draft-feature statuses --- DEVELOPMENT.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d53d25d3f6..bcccee5cb9 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -60,11 +60,11 @@ Tooling that supports draft features should plan for the future removal of the p When tooling adds support for a later version of OAS that includes the final implementation of the feature, it MUST not support the use of the draft prefix for that feature. Draft features will only be promoted into minor or major releases of the specification and therefore will be transparent to OpenAPI description writers and tooling providers who choose not to use the feature while in its draft state. -Draft features will be documented as GitHub issues and labeled with the `draft-feature` label. +Draft features will be documented as GitHub issues and labeled with the `draft-feature` label and will be initially labelled as `draft:proposal`. When the proposal is considered sufficiently stable for pilot implementation, it will be labeled `draft:pilot`. If during the development of a draft feature, it is determined that the feature needs to change in a way that may break existing draft implementations, the extension name itself may be versioned with a version suffix. e.g. `-v2` When a draft feature becomes part of a future update to the specification any version suffix will be removed. -Draft features that are deemed not appropriate for inclusion MUST be marked with the `abandoned` label. -Draft-features that are considered suitably specified for implementation will be marked with the `draft-ready` label. +Draft features that are deemed not appropriate for inclusion MUST be marked with the `draft:abandoned` label. +Draft-features that are considered suitably specified and have had successful pilot implementations will be marked with the `draft:graduated` label. Not all future new features will be introduced in this way. Some new features impact the specification in ways that cannot be encapsulated in an extension. From 522e8f171d95e785506e2cf832c5fdfc51f76107 Mon Sep 17 00:00:00 2001 From: nasa9084 Date: Tue, 22 May 2018 10:23:43 +0900 Subject: [PATCH 0638/1801] add go-openapi implementation --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index a2a844462e..35b6816448 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -18,6 +18,7 @@ These tools are not endorsed by the OAI. | openapi3_parser | [github/kevindew/openapi3_parser](https://github.com/kevindew/openapi3_parser) | Ruby | A Ruby implementation of parser and validator for the OpenAPI 3 Specification | | oas_parser | [github/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | | oas3-remote-refs | [github//OverSpeedIO/oas3-remote-refs](https://github.com/OverSpeedIO/oas3-remote-refs) | Node.js | Tool to pull remote refernences and merge them into the definitions of the provided OpenAPI3 speicfication. +| go-openapi | [github/nasa9084/go-openapi](https://github.com/nasa9084/go-openapi) | Go | Golang struct model for OpenAPI 3.x. | #### Editors From cbdd051b35701c25f77a05b5189e5c1f72321e6a Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Tue, 22 May 2018 14:10:20 -0400 Subject: [PATCH 0639/1801] Update IMPLEMENTATIONS.md --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index a2a844462e..5553dd4779 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -49,6 +49,7 @@ These tools are not endorsed by the OAI. | Fusio | [github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3 | Modern | [github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation | Koa2-OAS3 | [github/OverSpeedIO/koa2-oas3](https://github.com/OverSpeedIO/koa2-oas3) | Node.js | OpenAPI 3 request validation middleware for Koa2 based apps. +| Exegesis | [github/exegesis-js/exegesis](https://github.com/exegesis-js/exegesis) | Node.js | OpenAPI 3 server-side framework for express and other frameworks. #### Code Generators From c945053a9237a81f3ffc8f26965c12d11a6d4e43 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 12 Jun 2018 08:58:16 +0100 Subject: [PATCH 0640/1801] discriminator is now an object, not an attribute --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index f047821986..9fbaaed2dc 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2685,7 +2685,7 @@ Field Name | Type | Description propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. -The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. +The discriminator object is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: From 50c6361ab51443858c00d96271154c5f5db40ec5 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 12 Jun 2018 09:05:48 +0100 Subject: [PATCH 0641/1801] Remove colons from example headings --- versions/3.0.2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index f047821986..98dd92569c 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -219,7 +219,7 @@ Field Name | Type | Description This object MAY be extended with [Specification Extensions](#specificationExtensions). -##### Info Object Example: +##### Info Object Example ```json { @@ -267,7 +267,7 @@ Field Name | Type | Description This object MAY be extended with [Specification Extensions](#specificationExtensions). -##### Contact Object Example: +##### Contact Object Example ```json { @@ -296,7 +296,7 @@ Field Name | Type | Description This object MAY be extended with [Specification Extensions](#specificationExtensions). -##### License Object Example: +##### License Object Example ```json { From c4841c711247235b9b0288c481bf9141daeaf834 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 12 Jun 2018 09:14:13 +0100 Subject: [PATCH 0642/1801] Do not rely on auto-detection of fenced code block languages --- versions/3.0.2.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index f047821986..1be6d3c890 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1372,7 +1372,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Media Type Examples -```js +```json { "application/json": { "schema": { @@ -2689,7 +2689,7 @@ The discriminator attribute is legal only when using one of the composite keywor In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: -``` +```yaml MyResponseType: oneOf: - $ref: '#/components/schemas/Cat' @@ -2700,7 +2700,7 @@ MyResponseType: which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: -``` +```yaml MyResponseType: oneOf: - $ref: '#/components/schemas/Cat' @@ -2712,7 +2712,7 @@ MyResponseType: The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: -``` +```json { "id": 12345, "pet_type": "Cat" @@ -2723,7 +2723,7 @@ Will indicate that the `Cat` schema be used in conjunction with this payload. In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: -``` +```yaml MyResponseType: oneOf: - $ref: '#/components/schemas/Cat' @@ -2745,7 +2745,7 @@ In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed e For example: -``` +```yaml components: schemas: Pet: @@ -2787,7 +2787,7 @@ components: a payload like this: -``` +```json { "pet_type": "Cat", "name": "misty" @@ -2796,7 +2796,7 @@ a payload like this: will indicate that the `Cat` schema be used. Likewise this schema: -``` +```json { "pet_type": "cachorro", "bark": "soft" @@ -3306,7 +3306,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` -```YAML +```yaml type: oauth2 flows: implicit: From a63bf2245795c2003269be0dde3e30b81bd6c9d3 Mon Sep 17 00:00:00 2001 From: ravennasoftware Date: Wed, 13 Jun 2018 13:53:01 -0700 Subject: [PATCH 0643/1801] Adding C# comment reader --> OAI doc tooling. --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 0ceca8a850..13666e200b 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -63,3 +63,4 @@ These tools are not endorsed by the OAI. | slush-vertx | [github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) | WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications | | swagger-node-codegen | [github/fmvilas/swagger-node-codegen](https://github.com/fmvilas/swagger-node-codegen) | Node.js | Generates a Node.js/express server, but also has a template engine for creating any templates needed. | +.NET-C#-Annotations | [github/Microsoft/OpenAPI-NET-CSharpAnnotations](https://github.com/Microsoft/OpenAPI.NET.CSharpAnnotations) | dotnet | Convert your native C# comments/annotation XML from your API code into a OpenAPI document object. | From 9cfc32b0faa099a1504eb834052e98dffa96753a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Felipe=20Zanatto?= Date: Fri, 22 Jun 2018 08:35:40 -0300 Subject: [PATCH 0644/1801] Translate examples Translated two examples from portuguese to english --- versions/3.0.2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index f047821986..3415a70307 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2758,7 +2758,7 @@ components: discriminator: propertyName: pet_type mapping: - cachorro: Dog + dog: Dog Cat: allOf: - $ref: '#/components/schemas/Pet' @@ -2798,7 +2798,7 @@ will indicate that the `Cat` schema be used. Likewise this schema: ``` { - "pet_type": "cachorro", + "pet_type": "dog", "bark": "soft" } ``` From 967eb9c95ee003855679856117676bea5c4854f8 Mon Sep 17 00:00:00 2001 From: wzshiming Date: Mon, 2 Jul 2018 14:24:07 +0800 Subject: [PATCH 0645/1801] add golang openapi implementation --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 0ceca8a850..ea3c7e4c66 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -19,7 +19,7 @@ These tools are not endorsed by the OAI. | oas_parser | [github/Nexmo/oas_parser](https://github.com/Nexmo/oas_parser) | Ruby | An open source OpenAPI Spec 3 Definition Parser writen in Ruby | | oas3-remote-refs | [github//OverSpeedIO/oas3-remote-refs](https://github.com/OverSpeedIO/oas3-remote-refs) | Node.js | Tool to pull remote refernences and merge them into the definitions of the provided OpenAPI3 speicfication. | go-openapi | [github/nasa9084/go-openapi](https://github.com/nasa9084/go-openapi) | Go | Golang struct model for OpenAPI 3.x. | - +| openapi | [github/wzshiming/openapi](https://github.com/wzshiming/openapi) | Go | OpenAPI 3 Specification for golang | #### Editors From a8ad223f860b5e2342988c6c728926794e55bb06 Mon Sep 17 00:00:00 2001 From: wzshiming Date: Tue, 10 Jul 2018 15:32:23 +0800 Subject: [PATCH 0646/1801] add gen tool to implementation --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index ea3c7e4c66..29ef9b6d92 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -58,6 +58,7 @@ These tools are not endorsed by the OAI. |----------------|--------------|----------|---------------------| | baucis-openapi3 | [github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. | | Google Gnostic | [github/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. | +| Gen | [github/wzshiming/gen](https://github.com/wzshiming/gen) | Go | Generate OpenAPI 3, client, and route based on golang source code. | | serverless-openapi-documentation | [github/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | Typescript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration | | zero-rails_openapi | [github/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application | | slush-vertx | [github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web) From f9e3de08c43c94b8d47d1cb87dc53335b9460ab6 Mon Sep 17 00:00:00 2001 From: Ted Epstein Date: Thu, 12 Jul 2018 11:21:32 -0500 Subject: [PATCH 0647/1801] Make allowEmptyValue NOT RECOMMENDED Simple change to indicate that it is likely to be removed in a later revision. --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index ef26940d9b..506f680569 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -1014,7 +1014,7 @@ Field Name | Type | Description description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`. - allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision. The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. From 15d1c024f0897f76f8b6da5e54860973caa00505 Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Thu, 26 Jul 2018 12:16:40 -0700 Subject: [PATCH 0648/1801] Add API Sprout to new mock server section --- IMPLEMENTATIONS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 29ef9b6d92..df8c019677 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -43,6 +43,11 @@ These tools are not endorsed by the OAI. | Widdershins | [github/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x | | angular-swagger-ui | [github/angular-swagger-ui](https://github.com/Orange-OpenSource/angular-swagger-ui) | AngularJS | An angularJS implementation of Swagger UI | +#### Mock Servers +| Title | Project Link | Language | Description | +| -------------- | ------------ | -------- | ----------- | +| API Sprout | [github/danielgtaylor/apisprout](https://github.com/danielgtaylor/apisprout) | CLI / Docker | Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation | + #### Server Implementations | Title | Project Link | Language |Description | |----------------|--------------|----------|---------------------| From a02ba1560e8ecbde1b7c95efaa23a499d530f3ab Mon Sep 17 00:00:00 2001 From: Marsh Gardiner Date: Sun, 5 Aug 2018 19:37:56 -0700 Subject: [PATCH 0649/1801] proposed example changes incremented version to `3.0.1` leveraged `example` instead of `default` in `schema` for illustrating what an example value might be. misc minor fixes --- examples/v3.0/uspto.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/v3.0/uspto.yaml b/examples/v3.0/uspto.yaml index 774ca526b6..8e9b159f52 100644 --- a/examples/v3.0/uspto.yaml +++ b/examples/v3.0/uspto.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.0.1 servers: - url: '{scheme}://developer.uspto.gov/ds-api' variables: @@ -78,22 +78,22 @@ paths: parameters: - name: dataset in: path - description: 'Name of the dataset. In this case, the default value is oa_citations' + description: 'Name of the dataset.' required: true + example: "oa_citations" schema: type: string - default: oa_citations - name: version in: path description: Version of the dataset. required: true + example: "v1" schema: type: string - default: v1 responses: '200': description: >- - The dataset api for the given version is found and it is accessible + The dataset API for the given version is found and it is accessible to consume. content: application/json: From 84ba2668f5499d8aeb6faad1fdbf723a3de73626 Mon Sep 17 00:00:00 2001 From: Tatiana Fesenko Date: Thu, 23 Aug 2018 15:32:22 -0400 Subject: [PATCH 0650/1801] Consistent use of property name schema examples: petType vs pet_type * Pet Schema in the MediaTypes Examples and Schema Object Examples uses the camelCase notation(petType), * While Pets from the Discriminator Object use snake_case (pet_type). It's inconsistent. I chose the camelCase notation because it's used for propertyNames by the OpenAPI specification itself. --- versions/3.0.2.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index ef26940d9b..9fe93ac9f1 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -2707,15 +2707,15 @@ MyResponseType: - $ref: '#/components/schemas/Dog' - $ref: '#/components/schemas/Lizard' discriminator: - propertyName: pet_type + propertyName: petType ``` -The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: +The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: ```json { "id": 12345, - "pet_type": "Cat" + "petType": "Cat" } ``` @@ -2731,7 +2731,7 @@ MyResponseType: - $ref: '#/components/schemas/Lizard' - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' discriminator: - propertyName: pet_type + propertyName: petType mapping: dog: '#/components/schemas/Dog' monster: 'https://gigantic-server.com/schemas/Monster/schema.json' @@ -2751,12 +2751,12 @@ components: Pet: type: object required: - - pet_type + - petType properties: - pet_type: + petType: type: string discriminator: - propertyName: pet_type + propertyName: petType mapping: dog: Dog Cat: @@ -2789,7 +2789,7 @@ a payload like this: ```json { - "pet_type": "Cat", + "petType": "Cat", "name": "misty" } ``` @@ -2798,7 +2798,7 @@ will indicate that the `Cat` schema be used. Likewise this schema: ```json { - "pet_type": "dog", + "petType": "dog", "bark": "soft" } ``` From 7eba647d1777f91c49856ecc7014ca930109a414 Mon Sep 17 00:00:00 2001 From: Michael Gajda Date: Wed, 5 Sep 2018 10:39:34 +0200 Subject: [PATCH 0651/1801] Use semver for API version The specification recommends using semver for version specifications here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#versions --- examples/v3.0/api-with-examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/v3.0/api-with-examples.yaml b/examples/v3.0/api-with-examples.yaml index dd42b0e959..09003b6aba 100644 --- a/examples/v3.0/api-with-examples.yaml +++ b/examples/v3.0/api-with-examples.yaml @@ -1,7 +1,7 @@ openapi: "3.0.0" info: title: Simple API overview - version: v2 + version: 2.0.0 paths: /: get: From 71313228e69aedab46eb6ee3d71f17852d2ac122 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 20 Sep 2018 08:29:30 +0100 Subject: [PATCH 0652/1801] Revert "Add a period, because..." This reverts commit 4c79d31f3e9392131306d8b925325d2f9d809354. --- versions/3.0.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index 58aa7803a8..f865ba58f3 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -118,7 +118,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. -This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive**. +This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. From 9674980441ad9a92d91892fd92740216e118ef5b Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 20 Sep 2018 08:30:17 +0100 Subject: [PATCH 0653/1801] Revert "Added wording to clarify case sensitivity" This reverts commit 3e7d0a8c1735c535d68d44cb608d1d56d387a691. --- versions/3.0.1.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versions/3.0.1.md b/versions/3.0.1.md index f865ba58f3..0a8a834358 100644 --- a/versions/3.0.1.md +++ b/versions/3.0.1.md @@ -118,7 +118,6 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. -This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. @@ -824,7 +823,7 @@ Field Name | Type | Description summary | `string` | A short summary of what the operation does. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. -operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. From b8627dcec186f302db75fce91f4658f1b583d743 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 8 Apr 2018 21:25:29 -0400 Subject: [PATCH 0654/1801] Added wording to clarify case sensitivity --- versions/3.0.2.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 506f680569..74ab87e225 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -118,6 +118,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. +This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. @@ -844,7 +845,7 @@ Field Name | Type | Description summary | `string` | A short summary of what the operation does. description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. -operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. +operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. From 3d651d9ddf8afa337d8027dc84f1ad302d63c8c5 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 9 Apr 2018 19:39:58 +0300 Subject: [PATCH 0655/1801] Add a period, because... --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 74ab87e225..95198bfe0a 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -118,7 +118,7 @@ For example, if a field has an array value, the JSON array representation will b } ``` All field names in the specification are **case sensitive**. -This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive** +This includes all fields that are used as keys in a map, except where explicitly noted that keys are **case insensitive**. The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. From 8f8b7813dcfa212580ed5134c74b17e8da896b63 Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Wed, 26 Sep 2018 20:16:25 -0700 Subject: [PATCH 0656/1801] Change CLI -> Go --- IMPLEMENTATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index df8c019677..82445ad1ab 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -46,7 +46,7 @@ These tools are not endorsed by the OAI. #### Mock Servers | Title | Project Link | Language | Description | | -------------- | ------------ | -------- | ----------- | -| API Sprout | [github/danielgtaylor/apisprout](https://github.com/danielgtaylor/apisprout) | CLI / Docker | Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation | +| API Sprout | [github/danielgtaylor/apisprout](https://github.com/danielgtaylor/apisprout) | Go | Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation | #### Server Implementations | Title | Project Link | Language |Description | From 3b5540ab7194bc7921ea1e0fd6ec93e3609fac01 Mon Sep 17 00:00:00 2001 From: jban332 <1622399+jban332@users.noreply.github.com> Date: Sat, 29 Sep 2018 14:03:13 +0000 Subject: [PATCH 0657/1801] IMPLEMENTATIONS.md: add "kin-openapi" --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 29ef9b6d92..9567b1862b 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -20,6 +20,7 @@ These tools are not endorsed by the OAI. | oas3-remote-refs | [github//OverSpeedIO/oas3-remote-refs](https://github.com/OverSpeedIO/oas3-remote-refs) | Node.js | Tool to pull remote refernences and merge them into the definitions of the provided OpenAPI3 speicfication. | go-openapi | [github/nasa9084/go-openapi](https://github.com/nasa9084/go-openapi) | Go | Golang struct model for OpenAPI 3.x. | | openapi | [github/wzshiming/openapi](https://github.com/wzshiming/openapi) | Go | OpenAPI 3 Specification for golang | +| kin-openapi | [github/getkin/kin-openapi](https://github.com/getkin/kin-openapi) | Go | OpenAPI 3.x implementation for Go (parsing, converting, validation) | #### Editors From 9e980dbc68c0b4db60309d043d1349c4cfbae9ad Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 3 Oct 2018 14:15:14 -0600 Subject: [PATCH 0658/1801] Release Prep --- README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 56ea424143..dc72b09a43 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,6 @@ ![](https://avatars3.githubusercontent.com/u/16343502?v=3&s=200) -**This is the WIP branch for the next patch version of the spec - 3.0.2. Patch level corrections should be submitted against this branch, specifically against [3.0.2.md](https://github.com/OAI/OpenAPI-Specification/blob/v3.0.2-dev/versions/3.0.2.md).** - - The OpenAPI Specification is a community-driven open specification within the [Open API Initiative](https://www.openapis.org/), a Linux Foundation Collaborative Project. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for [REST APIs](https://en.wikipedia.org/wiki/Representational_state_transfer), which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service. @@ -17,13 +14,9 @@ The OpenAPI Specification does not require rewriting existing APIs. It does not This GitHub project is the starting point for OpenAPI. Here you will find the information you need about the OpenAPI Specification, simple examples of what it looks like, and some general information regarding the project. -## Current Version - 3.0.1 - -The current version of the OpenAPI specification is [OpenAPI Specification 3.0.1](versions/3.0.1.md). - -### Future Versions +## Current Version - 3.0.2 -[3.0.2](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.2-dev) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. +The current version of the OpenAPI specification is [OpenAPI Specification 3.0.2](versions/3.0.2.md). ### Previous Versions From 3c2afa6ee23d36f2c75018f80e6a2075d3e7ddf4 Mon Sep 17 00:00:00 2001 From: Maurits van der Schee Date: Thu, 4 Oct 2018 21:55:30 +0200 Subject: [PATCH 0659/1801] Add PHP-CRUD-API I would love to see my project added. Thank you. --- IMPLEMENTATIONS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPLEMENTATIONS.md b/IMPLEMENTATIONS.md index 29ef9b6d92..2d449a362a 100644 --- a/IMPLEMENTATIONS.md +++ b/IMPLEMENTATIONS.md @@ -51,6 +51,7 @@ These tools are not endorsed by the OAI. | Modern | [github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation | Koa2-OAS3 | [github/OverSpeedIO/koa2-oas3](https://github.com/OverSpeedIO/koa2-oas3) | Node.js | OpenAPI 3 request validation middleware for Koa2 based apps. | Exegesis | [github/exegesis-js/exegesis](https://github.com/exegesis-js/exegesis) | Node.js | OpenAPI 3 server-side framework for express and other frameworks. +| PHP-CRUD-API | [github/mevdschee/php-crud-api](https://github.com/mevdschee/php-crud-api) | PHP | Automatic CRUD API with OpenAPI 3 docs #### Code Generators From 3205baaa834305960d0805b8905bc93936c82c22 Mon Sep 17 00:00:00 2001 From: Ron Date: Sat, 6 Oct 2018 12:23:37 -0600 Subject: [PATCH 0660/1801] Update release date --- versions/3.0.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.2.md b/versions/3.0.2.md index 5a83f9c70f..3a6a343a8c 100644 --- a/versions/3.0.2.md +++ b/versions/3.0.2.md @@ -3399,7 +3399,7 @@ Two examples of this: Version | Date | Notes --- | --- | --- -3.0.2 | TBD | Patch release of the OpenAPI Specification 3.0.2 +3.0.2 | 2018-10-08 | Patch release of the OpenAPI Specification 3.0.2 3.0.1 | 2017-12-06 | Patch release of the OpenAPI Specification 3.0.1 3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification From 4939c82cbd1493a1d571d60f531546629c39d73a Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 8 Oct 2018 11:32:27 -0600 Subject: [PATCH 0661/1801] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 34ac1d10ef..26b564bbef 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ This GitHub project is the starting point for OpenAPI. Here you will find the in The current version of the OpenAPI specification is [OpenAPI Specification 3.0.2](versions/3.0.2.md). +### Future Versions + +[3.0.3](https://github.com/OAI/OpenAPI-Specification/tree/v3.0.3-dev) - The next PATCH version. Patch-level fixes (typos, clarifications, etc.) should be submitted against this branch. +[3.1.0](https://github.com/OAI/OpenAPI-Specification/tree/v3.1.0-dev) - The next MINOR version. Non-breaking changes should be submitted against this branch. + ### Previous Versions This repository also contains the [OpenAPI Specification 2.0](versions/2.0.md), which is identical to the Swagger 2.0 specification before it was renamed to "OpenAPI Specification", as well as the Swagger 1.2 and Swagger 2.0 specifications. From 26093259b1c0226bf6cc753377ed6a429dadea12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jarisch?= Date: Mon, 15 Oct 2018 09:38:55 +0200 Subject: [PATCH 0662/1801] Fix "current specification" version Fix "current specification" link to point to latest release 3.0.2. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26b564bbef..02ceacb82e 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The TSC holds weekly web conferences to review open pull requests and discuss op The Open API Initiative encourages participation from individuals and companies alike. If you want to participate in the evolution of the OpenAPI Specification, consider taking the following actions: -* Review the [current specification](versions/3.0.1.md). The human-readable markdown file _is the source of truth_ for the specification. +* Review the [current specification](versions/3.0.2.md). The human-readable markdown file _is the source of truth_ for the specification. * Review the [development](DEVELOPMENT.md) process so you understand how the spec is evolving. * Check the [issues](https://github.com/OAI/OpenAPI-Specification/issues) and [pull requests](https://github.com/OAI/OpenAPI-Specification/pulls) to see if someone has already documented your idea or feedback on the specification. You can follow an existing conversation by adding a comment to the existing issue or PR. * Create an issue to describe a new concern. If possible, propose a solution. From ec6f7677a4006ae3903866c207843af90b5a4cf0 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 26 Oct 2018 07:42:59 +0100 Subject: [PATCH 0663/1801] Simplify Travis CI setup --- .travis.yml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 822a22279c..098bf2e708 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,6 @@ sudo: false +language: node_js +node_js: + - "node" script: - - npm install -env: - - VALIDATORS=tv4 - - VALIDATORS=zschema -matrix: - allow_failures: - - env: VALIDATORS=tv4 -install: - - rm -rf ~/.nvm - - mkdir -p ~/.nvm - - curl -L https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh - - source ~/.nvm/nvm.sh - - nvm install 8 - - nvm use 8 -script: - - npm install - node node_modules/mdv/mdv versions/3.*.md From 532e2b29204989f1bdbae0b77b1abbe195516d61 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 26 Oct 2018 07:43:30 +0100 Subject: [PATCH 0664/1801] Remove v1.2/v2.0 test fixtures --- fixtures/v1.2/helloworld/server/README.md | 20 - fixtures/v1.2/helloworld/server/pom.xml | 111 - .../server/src/main/webapp/api-docs | 9 - .../src/main/webapp/css/highlight.default.css | 135 - .../server/src/main/webapp/css/screen.css | 1070 ------- .../src/main/webapp/images/logo_small.png | Bin 770 -> 0 bytes .../src/main/webapp/images/pet_store_api.png | Bin 824 -> 0 bytes .../src/main/webapp/images/throbber.gif | Bin 9257 -> 0 bytes .../src/main/webapp/images/wordnik_api.png | Bin 980 -> 0 bytes .../server/src/main/webapp/index.html | 78 - .../src/main/webapp/lib/backbone-min.js | 38 - .../src/main/webapp/lib/handlebars-1.0.0.js | 2278 -------------- .../src/main/webapp/lib/highlight.7.3.pack.js | 1 - .../src/main/webapp/lib/jquery-1.8.0.min.js | 2 - .../src/main/webapp/lib/jquery.ba-bbq.min.js | 18 - .../src/main/webapp/lib/jquery.slideto.min.js | 1 - .../src/main/webapp/lib/jquery.wiggle.min.js | 8 - .../src/main/webapp/lib/shred.bundle.js | 2765 ----------------- .../src/main/webapp/lib/shred/content.js | 193 -- .../server/src/main/webapp/lib/swagger.js | 1400 --------- .../src/main/webapp/lib/underscore-min.js | 32 - .../server/src/main/webapp/listings/greetings | 26 - .../server/src/main/webapp/swagger-ui.js | 2126 ------------- .../server/src/main/webapp/swagger-ui.min.js | 1 - fixtures/v1.2/helloworld/static/README.md | 3 - fixtures/v1.2/helloworld/static/api-docs | 9 - .../v1.2/helloworld/static/listings/greetings | 26 - .../v2.0/json/general/basicInfoObject.json | 15 - fixtures/v2.0/json/general/externalDocs.json | 4 - .../v2.0/json/general/minimalInfoObject.json | 4 - .../negative/negativeExternalDocs.json | 3 - .../general/negative/negativeInfoObject.json | 12 - .../v2.0/json/models/modelWithArrayRef.json | 17 - .../json/models/modelWithComposition.json | 86 - .../json/models/modelWithDateTimeMap.json | 7 - .../v2.0/json/models/modelWithExamples.json | 30 - .../v2.0/json/models/modelWithInt32Map.json | 7 - .../v2.0/json/models/modelWithInt64Map.json | 7 - .../models/modelWithMultipleProperties.json | 67 - .../json/models/modelWithPrimitiveArray.json | 18 - .../json/models/modelWithStringProperty.json | 8 - .../json/models/modelWithXmlAttributes.json | 26 - fixtures/v2.0/json/models/models.json | 12 - fixtures/v2.0/json/models/multipleModels.json | 26 - .../properties/propertyWithBooleanArray.json | 6 - .../properties/propertyWithByteArray.json | 7 - .../properties/propertyWithComplexArray.json | 6 - .../properties/propertyWithDateTimeArray.json | 7 - .../properties/propertyWithInt32Array.json | 7 - .../properties/propertyWithInt64Array.json | 7 - .../properties/propertyWithStringArray.json | 6 - .../properties/simpleBooleanProperty.json | 5 - .../models/properties/simpleByteProperty.json | 4 - .../properties/simpleDateTimeProperty.json | 4 - .../properties/simpleInt32Property.json | 4 - .../properties/simpleInt64Property.json | 4 - .../properties/simpleStringProperty.json | 3 - .../v2.0/json/resources/cascadingSchemes.json | 98 - .../v2.0/json/resources/commonParameters.json | 100 - .../json/resources/multipleMimeTypes.json | 109 - .../operations/operationWithTags.json | 30 - .../stringPathAndBoolQueryParamResource.json | 36 - .../operations/stringPathParamResource.json | 33 - .../parameters/bodyComplexArrayParameter.json | 12 - .../bodyComplexInlineParameter.json | 25 - .../parameters/bodyComplexParameter.json | 9 - .../parameters/bodyInt64Parameter.json | 10 - .../parameters/bodyStringArrayParameter.json | 12 - .../parameters/bodyStringParameter.json | 9 - .../parameters/formDataInt64Parameter.json | 8 - .../formDataStringArrayParameter.json | 10 - .../parameters/formDataStringParameter.json | 7 - .../parameters/headerInt64ArrayParameter.json | 12 - .../headerStringArrayParameter.json | 11 - .../parameters/headerStringParameter.json | 7 - .../negative/bodyFileParameter.json | 9 - .../negative/bodyNonSchemaParameter.json | 7 - .../negative/formDataComplexParameter.json | 7 - .../negative/formDataSchemaParameter.json | 9 - .../negative/headerComplexParameter.json | 7 - .../negative/headerFileParameter.json | 7 - .../negative/headerSchemaParameter.json | 9 - .../negative/pathComplexParameter.json | 7 - .../negative/pathFileParameter.json | 7 - .../pathNonRequiredStringParameter.json | 7 - .../negative/pathSchemaParameter.json | 9 - .../negative/queryComplexParameter.json | 7 - .../negative/queryFileParameter.json | 7 - .../negative/querySchemaParameter.json | 9 - .../parameters/pathInt64Parameter.json | 8 - .../parameters/pathStringArrayParameter.json | 11 - .../parameters/pathStringParameter.json | 7 - .../parameters/queryInt64ArrayParameter.json | 12 - .../parameters/queryInt64Parameter.json | 8 - .../resources/resourceWithExamplePayload.json | 114 - .../resourceWithLinkedDefinitions.json | 62 - .../resourceWithLinkedDefinitions_part1.json | 38 - .../resources/resourceWithRelativeHost.json | 99 - .../json/resources/reusableParameters.json | 105 - .../v2.0/json/resources/securityExample.json | 181 -- .../resources/stringPathParamResource.json | 97 - .../v2.0/json/resources/taggedResource.json | 112 - .../resources/vendorExtensionExamples.json | 107 - .../json/responses/complexArrayResponse.json | 9 - .../v2.0/json/responses/dateTimeResponse.json | 7 - .../v2.0/json/responses/int32Response.json | 7 - .../v2.0/json/responses/int64Response.json | 7 - .../json/responses/multipleResponses.json | 18 - .../json/responses/negative/noResponses.json | 3 - .../noResponsesWithVendorExtension.json | 2 - .../json/responses/stringArrayResponse.json | 9 - .../v2.0/json/responses/stringResponse.json | 6 - .../responses/stringResponseWithHeader.json | 10 - .../v2.0/json/responses/voidResponse.json | 3 - fixtures/v2.0/yaml/.gitkeep | 0 115 files changed, 12457 deletions(-) delete mode 100644 fixtures/v1.2/helloworld/server/README.md delete mode 100644 fixtures/v1.2/helloworld/server/pom.xml delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/api-docs delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/css/highlight.default.css delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/css/screen.css delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/images/logo_small.png delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/images/pet_store_api.png delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/images/throbber.gif delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/images/wordnik_api.png delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/index.html delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/backbone-min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/handlebars-1.0.0.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/highlight.7.3.pack.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/jquery-1.8.0.min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/jquery.ba-bbq.min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/jquery.slideto.min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/jquery.wiggle.min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/shred.bundle.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/shred/content.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/swagger.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/lib/underscore-min.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/listings/greetings delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/swagger-ui.js delete mode 100644 fixtures/v1.2/helloworld/server/src/main/webapp/swagger-ui.min.js delete mode 100644 fixtures/v1.2/helloworld/static/README.md delete mode 100644 fixtures/v1.2/helloworld/static/api-docs delete mode 100644 fixtures/v1.2/helloworld/static/listings/greetings delete mode 100644 fixtures/v2.0/json/general/basicInfoObject.json delete mode 100644 fixtures/v2.0/json/general/externalDocs.json delete mode 100644 fixtures/v2.0/json/general/minimalInfoObject.json delete mode 100644 fixtures/v2.0/json/general/negative/negativeExternalDocs.json delete mode 100644 fixtures/v2.0/json/general/negative/negativeInfoObject.json delete mode 100644 fixtures/v2.0/json/models/modelWithArrayRef.json delete mode 100644 fixtures/v2.0/json/models/modelWithComposition.json delete mode 100644 fixtures/v2.0/json/models/modelWithDateTimeMap.json delete mode 100644 fixtures/v2.0/json/models/modelWithExamples.json delete mode 100644 fixtures/v2.0/json/models/modelWithInt32Map.json delete mode 100644 fixtures/v2.0/json/models/modelWithInt64Map.json delete mode 100644 fixtures/v2.0/json/models/modelWithMultipleProperties.json delete mode 100644 fixtures/v2.0/json/models/modelWithPrimitiveArray.json delete mode 100644 fixtures/v2.0/json/models/modelWithStringProperty.json delete mode 100644 fixtures/v2.0/json/models/modelWithXmlAttributes.json delete mode 100644 fixtures/v2.0/json/models/models.json delete mode 100644 fixtures/v2.0/json/models/multipleModels.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithBooleanArray.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithByteArray.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithComplexArray.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithDateTimeArray.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithInt32Array.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithInt64Array.json delete mode 100644 fixtures/v2.0/json/models/properties/propertyWithStringArray.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleBooleanProperty.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleByteProperty.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleDateTimeProperty.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleInt32Property.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleInt64Property.json delete mode 100644 fixtures/v2.0/json/models/properties/simpleStringProperty.json delete mode 100644 fixtures/v2.0/json/resources/cascadingSchemes.json delete mode 100644 fixtures/v2.0/json/resources/commonParameters.json delete mode 100644 fixtures/v2.0/json/resources/multipleMimeTypes.json delete mode 100644 fixtures/v2.0/json/resources/operations/operationWithTags.json delete mode 100644 fixtures/v2.0/json/resources/operations/stringPathAndBoolQueryParamResource.json delete mode 100644 fixtures/v2.0/json/resources/operations/stringPathParamResource.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyComplexArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyComplexInlineParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyComplexParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyInt64Parameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyStringArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/bodyStringParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/formDataInt64Parameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/formDataStringArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/formDataStringParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/headerInt64ArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/headerStringArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/headerStringParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/bodyFileParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/bodyNonSchemaParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/formDataComplexParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/formDataSchemaParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/headerComplexParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/headerFileParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/headerSchemaParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/pathComplexParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/pathFileParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/pathNonRequiredStringParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/pathSchemaParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/queryComplexParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/queryFileParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/negative/querySchemaParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/pathInt64Parameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/pathStringArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/pathStringParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/queryInt64ArrayParameter.json delete mode 100644 fixtures/v2.0/json/resources/parameters/queryInt64Parameter.json delete mode 100644 fixtures/v2.0/json/resources/resourceWithExamplePayload.json delete mode 100644 fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json delete mode 100644 fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json delete mode 100644 fixtures/v2.0/json/resources/resourceWithRelativeHost.json delete mode 100644 fixtures/v2.0/json/resources/reusableParameters.json delete mode 100644 fixtures/v2.0/json/resources/securityExample.json delete mode 100644 fixtures/v2.0/json/resources/stringPathParamResource.json delete mode 100644 fixtures/v2.0/json/resources/taggedResource.json delete mode 100644 fixtures/v2.0/json/resources/vendorExtensionExamples.json delete mode 100644 fixtures/v2.0/json/responses/complexArrayResponse.json delete mode 100644 fixtures/v2.0/json/responses/dateTimeResponse.json delete mode 100644 fixtures/v2.0/json/responses/int32Response.json delete mode 100644 fixtures/v2.0/json/responses/int64Response.json delete mode 100644 fixtures/v2.0/json/responses/multipleResponses.json delete mode 100644 fixtures/v2.0/json/responses/negative/noResponses.json delete mode 100644 fixtures/v2.0/json/responses/negative/noResponsesWithVendorExtension.json delete mode 100644 fixtures/v2.0/json/responses/stringArrayResponse.json delete mode 100644 fixtures/v2.0/json/responses/stringResponse.json delete mode 100644 fixtures/v2.0/json/responses/stringResponseWithHeader.json delete mode 100644 fixtures/v2.0/json/responses/voidResponse.json delete mode 100644 fixtures/v2.0/yaml/.gitkeep diff --git a/fixtures/v1.2/helloworld/server/README.md b/fixtures/v1.2/helloworld/server/README.md deleted file mode 100644 index bd351e2c1c..0000000000 --- a/fixtures/v1.2/helloworld/server/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# All-in-one Static Hello World Sample - -This sample project provides an all-one-one package demo for the Hello World sample described in the [wiki](https://github.com/swagger-api/swagger-spec/wiki/Hello-World-Sample). - -## Requirements - -This samples requires Java 5 or above and [Maven](http://maven.apache.org) installed. - -## Run the sample - -In your favorite command-line, run: - -``` -mvn jetty:run -``` - -Then in your favorite web browser, open: -``` -http://localhost:8000 -``` diff --git a/fixtures/v1.2/helloworld/server/pom.xml b/fixtures/v1.2/helloworld/server/pom.xml deleted file mode 100644 index 3a2c61c671..0000000000 --- a/fixtures/v1.2/helloworld/server/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - 4.0.0 - io.swagger - swagger-demo - jar - swagger-demo - 1.0.1-SNAPSHOT - - 2.2.0 - - - - src/main/scala - src/test/scala - - - net.alchim31.maven - scala-maven-plugin - ${maven-plugin.version} - - - - compile - testCompile - - - - - - -Xms64m - -Xmx1024m - - - - - maven-surefire-plugin - - once - false - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - org.mortbay.jetty - jetty-maven-plugin - ${jetty-version} - - - / - - - - 8000 - 60000 - 8443 - - - - - - start-jetty - pre-integration-test - - run - - - 0 - true - - - - stop-jetty - post-integration-test - - stop - - - - - - - - - sonatype-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-releases - https://oss.sonatype.org/content/repositories/releases - - - - 3.1.0 - 7.6.0.v20120127 - - - diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/api-docs b/fixtures/v1.2/helloworld/server/src/main/webapp/api-docs deleted file mode 100644 index 6f2f3cb95b..0000000000 --- a/fixtures/v1.2/helloworld/server/src/main/webapp/api-docs +++ /dev/null @@ -1,9 +0,0 @@ -{ - "swaggerVersion": "1.2", - "apis": [ - { - "path": "http://localhost:8000/listings/greetings", - "description": "Generating greetings in our application." - } - ] -} diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/css/highlight.default.css b/fixtures/v1.2/helloworld/server/src/main/webapp/css/highlight.default.css deleted file mode 100644 index e417fc1799..0000000000 --- a/fixtures/v1.2/helloworld/server/src/main/webapp/css/highlight.default.css +++ /dev/null @@ -1,135 +0,0 @@ -/* - -Original style from softwaremaniacs.org (c) Ivan Sagalaev - -*/ - -pre code { - display: block; padding: 0.5em; - background: #F0F0F0; -} - -pre code, -pre .subst, -pre .tag .title, -pre .lisp .title, -pre .clojure .built_in, -pre .nginx .title { - color: black; -} - -pre .string, -pre .title, -pre .constant, -pre .parent, -pre .tag .value, -pre .rules .value, -pre .rules .value .number, -pre .preprocessor, -pre .ruby .symbol, -pre .ruby .symbol .string, -pre .aggregate, -pre .template_tag, -pre .django .variable, -pre .smalltalk .class, -pre .addition, -pre .flow, -pre .stream, -pre .bash .variable, -pre .apache .tag, -pre .apache .cbracket, -pre .tex .command, -pre .tex .special, -pre .erlang_repl .function_or_atom, -pre .markdown .header { - color: #800; -} - -pre .comment, -pre .annotation, -pre .template_comment, -pre .diff .header, -pre .chunk, -pre .markdown .blockquote { - color: #888; -} - -pre .number, -pre .date, -pre .regexp, -pre .literal, -pre .smalltalk .symbol, -pre .smalltalk .char, -pre .go .constant, -pre .change, -pre .markdown .bullet, -pre .markdown .link_url { - color: #080; -} - -pre .label, -pre .javadoc, -pre .ruby .string, -pre .decorator, -pre .filter .argument, -pre .localvars, -pre .array, -pre .attr_selector, -pre .important, -pre .pseudo, -pre .pi, -pre .doctype, -pre .deletion, -pre .envvar, -pre .shebang, -pre .apache .sqbracket, -pre .nginx .built_in, -pre .tex .formula, -pre .erlang_repl .reserved, -pre .prompt, -pre .markdown .link_label, -pre .vhdl .attribute, -pre .clojure .attribute, -pre .coffeescript .property { - color: #88F -} - -pre .keyword, -pre .id, -pre .phpdoc, -pre .title, -pre .built_in, -pre .aggregate, -pre .css .tag, -pre .javadoctag, -pre .phpdoc, -pre .yardoctag, -pre .smalltalk .class, -pre .winutils, -pre .bash .variable, -pre .apache .tag, -pre .go .typename, -pre .tex .command, -pre .markdown .strong, -pre .request, -pre .status { - font-weight: bold; -} - -pre .markdown .emphasis { - font-style: italic; -} - -pre .nginx .built_in { - font-weight: normal; -} - -pre .coffeescript .javascript, -pre .javascript .xml, -pre .tex .formula, -pre .xml .javascript, -pre .xml .vbscript, -pre .xml .css, -pre .xml .cdata { - opacity: 0.5; -} diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/css/screen.css b/fixtures/v1.2/helloworld/server/src/main/webapp/css/screen.css deleted file mode 100644 index 1627ecd0d3..0000000000 --- a/fixtures/v1.2/helloworld/server/src/main/webapp/css/screen.css +++ /dev/null @@ -1,1070 +0,0 @@ -/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ -html, -body, -div, -span, -applet, -object, -iframe, -h1, -h2, -h3, -h4, -h5, -h6, -p, -blockquote, -pre, -a, -abbr, -acronym, -address, -big, -cite, -code, -del, -dfn, -em, -img, -ins, -kbd, -q, -s, -samp, -small, -strike, -strong, -sub, -sup, -tt, -var, -b, -u, -i, -center, -dl, -dt, -dd, -ol, -ul, -li, -fieldset, -form, -label, -legend, -table, -caption, -tbody, -tfoot, -thead, -tr, -th, -td, -article, -aside, -canvas, -details, -embed, -figure, -figcaption, -footer, -header, -hgroup, -menu, -nav, -output, -ruby, -section, -summary, -time, -mark, -audio, -video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section { - display: block; -} -body { - line-height: 1; -} -ol, -ul { - list-style: none; -} -blockquote, -q { - quotes: none; -} -blockquote:before, -blockquote:after, -q:before, -q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -.swagger-ui-wrap { - line-height: 1; - font-family: "Droid Sans", sans-serif; - max-width: 960px; - margin-left: auto; - margin-right: auto; -} -.swagger-ui-wrap b, -.swagger-ui-wrap strong { - font-family: "Droid Sans", sans-serif; - font-weight: bold; -} -.swagger-ui-wrap q, -.swagger-ui-wrap blockquote { - quotes: none; -} -.swagger-ui-wrap p { - line-height: 1.4em; - padding: 0 0 10px; - color: #333333; -} -.swagger-ui-wrap q:before, -.swagger-ui-wrap q:after, -.swagger-ui-wrap blockquote:before, -.swagger-ui-wrap blockquote:after { - content: none; -} -.swagger-ui-wrap .heading_with_menu h1, -.swagger-ui-wrap .heading_with_menu h2, -.swagger-ui-wrap .heading_with_menu h3, -.swagger-ui-wrap .heading_with_menu h4, -.swagger-ui-wrap .heading_with_menu h5, -.swagger-ui-wrap .heading_with_menu h6 { - display: block; - clear: none; - float: left; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - width: 60%; -} -.swagger-ui-wrap table { - border-collapse: collapse; - border-spacing: 0; -} -.swagger-ui-wrap table thead tr th { - padding: 5px; - font-size: 0.9em; - color: #666666; - border-bottom: 1px solid #999999; -} -.swagger-ui-wrap table tbody tr:last-child td { - border-bottom: none; -} -.swagger-ui-wrap table tbody tr.offset { - background-color: #f0f0f0; -} -.swagger-ui-wrap table tbody tr td { - padding: 6px; - font-size: 0.9em; - border-bottom: 1px solid #cccccc; - vertical-align: top; - line-height: 1.3em; -} -.swagger-ui-wrap ol { - margin: 0px 0 10px; - padding: 0 0 0 18px; - list-style-type: decimal; -} -.swagger-ui-wrap ol li { - padding: 5px 0px; - font-size: 0.9em; - color: #333333; -} -.swagger-ui-wrap ol, -.swagger-ui-wrap ul { - list-style: none; -} -.swagger-ui-wrap h1 a, -.swagger-ui-wrap h2 a, -.swagger-ui-wrap h3 a, -.swagger-ui-wrap h4 a, -.swagger-ui-wrap h5 a, -.swagger-ui-wrap h6 a { - text-decoration: none; -} -.swagger-ui-wrap h1 a:hover, -.swagger-ui-wrap h2 a:hover, -.swagger-ui-wrap h3 a:hover, -.swagger-ui-wrap h4 a:hover, -.swagger-ui-wrap h5 a:hover, -.swagger-ui-wrap h6 a:hover { - text-decoration: underline; -} -.swagger-ui-wrap h1 span.divider, -.swagger-ui-wrap h2 span.divider, -.swagger-ui-wrap h3 span.divider, -.swagger-ui-wrap h4 span.divider, -.swagger-ui-wrap h5 span.divider, -.swagger-ui-wrap h6 span.divider { - color: #aaaaaa; -} -.swagger-ui-wrap a { - color: #547f00; -} -.swagger-ui-wrap a img { - border: none; -} -.swagger-ui-wrap article, -.swagger-ui-wrap aside, -.swagger-ui-wrap details, -.swagger-ui-wrap figcaption, -.swagger-ui-wrap figure, -.swagger-ui-wrap footer, -.swagger-ui-wrap header, -.swagger-ui-wrap hgroup, -.swagger-ui-wrap menu, -.swagger-ui-wrap nav, -.swagger-ui-wrap section, -.swagger-ui-wrap summary { - display: block; -} -.swagger-ui-wrap pre { - font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; - background-color: #fcf6db; - border: 1px solid #e5e0c6; - padding: 10px; -} -.swagger-ui-wrap pre code { - line-height: 1.6em; - background: none; -} -.swagger-ui-wrap .content > .content-type > div > label { - clear: both; - display: block; - color: #0F6AB4; - font-size: 1.1em; - margin: 0; - padding: 15px 0 5px; -} -.swagger-ui-wrap .content pre { - font-size: 12px; - margin-top: 5px; - padding: 5px; -} -.swagger-ui-wrap .icon-btn { - cursor: pointer; -} -.swagger-ui-wrap .info_title { - padding-bottom: 10px; - font-weight: bold; - font-size: 25px; -} -.swagger-ui-wrap p.big, -.swagger-ui-wrap div.big p { - font-size: 1em; - margin-bottom: 10px; -} -.swagger-ui-wrap form.fullwidth ol li.string input, -.swagger-ui-wrap form.fullwidth ol li.url input, -.swagger-ui-wrap form.fullwidth ol li.text textarea, -.swagger-ui-wrap form.fullwidth ol li.numeric input { - width: 500px !important; -} -.swagger-ui-wrap .info_license { - padding-bottom: 5px; -} -.swagger-ui-wrap .info_tos { - padding-bottom: 5px; -} -.swagger-ui-wrap .message-fail { - color: #cc0000; -} -.swagger-ui-wrap .info_contact { - padding-bottom: 5px; -} -.swagger-ui-wrap .info_description { - padding-bottom: 10px; - font-size: 15px; -} -.swagger-ui-wrap .markdown ol li, -.swagger-ui-wrap .markdown ul li { - padding: 3px 0px; - line-height: 1.4em; - color: #333333; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input, -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input, -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input { - display: block; - padding: 4px; - width: auto; - clear: both; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title, -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title, -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title { - font-size: 1.3em; -} -.swagger-ui-wrap table.fullwidth { - width: 100%; -} -.swagger-ui-wrap .model-signature { - font-family: "Droid Sans", sans-serif; - font-size: 1em; - line-height: 1.5em; -} -.swagger-ui-wrap .model-signature .signature-nav a { - text-decoration: none; - color: #AAA; -} -.swagger-ui-wrap .model-signature .signature-nav a:hover { - text-decoration: underline; - color: black; -} -.swagger-ui-wrap .model-signature .signature-nav .selected { - color: black; - text-decoration: none; -} -.swagger-ui-wrap .model-signature .propType { - color: #5555aa; -} -.swagger-ui-wrap .model-signature pre:hover { - background-color: #ffffdd; -} -.swagger-ui-wrap .model-signature pre { - font-size: .85em; - line-height: 1.2em; - overflow: auto; - max-height: 200px; - cursor: pointer; -} -.swagger-ui-wrap .model-signature ul.signature-nav { - display: block; - margin: 0; - padding: 0; -} -.swagger-ui-wrap .model-signature ul.signature-nav li:last-child { - padding-right: 0; - border-right: none; -} -.swagger-ui-wrap .model-signature ul.signature-nav li { - float: left; - margin: 0 5px 5px 0; - padding: 2px 5px 2px 0; - border-right: 1px solid #ddd; -} -.swagger-ui-wrap .model-signature .propOpt { - color: #555; -} -.swagger-ui-wrap .model-signature .snippet small { - font-size: 0.75em; -} -.swagger-ui-wrap .model-signature .propOptKey { - font-style: italic; -} -.swagger-ui-wrap .model-signature .description .strong { - font-weight: bold; - color: #000; - font-size: .9em; -} -.swagger-ui-wrap .model-signature .description div { - font-size: 0.9em; - line-height: 1.5em; - margin-left: 1em; -} -.swagger-ui-wrap .model-signature .description .stronger { - font-weight: bold; - color: #000; -} -.swagger-ui-wrap .model-signature .propName { - font-weight: bold; -} -.swagger-ui-wrap .model-signature .signature-container { - clear: both; -} -.swagger-ui-wrap .body-textarea { - width: 300px; - height: 100px; - border: 1px solid #aaa; -} -.swagger-ui-wrap .markdown p code, -.swagger-ui-wrap .markdown li code { - font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; - background-color: #f0f0f0; - color: black; - padding: 1px 3px; -} -.swagger-ui-wrap .required { - font-weight: bold; -} -.swagger-ui-wrap input.parameter { - width: 300px; - border: 1px solid #aaa; -} -.swagger-ui-wrap h1 { - color: black; - font-size: 1.5em; - line-height: 1.3em; - padding: 10px 0 10px 0; - font-family: "Droid Sans", sans-serif; - font-weight: bold; -} -.swagger-ui-wrap .heading_with_menu { - float: none; - clear: both; - overflow: hidden; - display: block; -} -.swagger-ui-wrap .heading_with_menu ul { - display: block; - clear: none; - float: right; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - margin-top: 10px; -} -.swagger-ui-wrap h2 { - color: black; - font-size: 1.3em; - padding: 10px 0 10px 0; -} -.swagger-ui-wrap h2 a { - color: black; -} -.swagger-ui-wrap h2 span.sub { - font-size: 0.7em; - color: #999999; - font-style: italic; -} -.swagger-ui-wrap h2 span.sub a { - color: #777777; -} -.swagger-ui-wrap span.weak { - color: #666666; -} -.swagger-ui-wrap .message-success { - color: #89BF04; -} -.swagger-ui-wrap caption, -.swagger-ui-wrap th, -.swagger-ui-wrap td { - text-align: left; - font-weight: normal; - vertical-align: middle; -} -.swagger-ui-wrap .code { - font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea { - font-family: "Droid Sans", sans-serif; - height: 250px; - padding: 4px; - display: block; - clear: both; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select { - display: block; - clear: both; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean { - float: none; - clear: both; - overflow: hidden; - display: block; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label { - display: block; - float: left; - clear: none; - margin: 0; - padding: 0; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input { - display: block; - float: left; - clear: none; - margin: 0 5px 0 0; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label { - color: black; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li label { - display: block; - clear: both; - width: auto; - padding: 0 0 3px; - color: #666666; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr { - padding-left: 3px; - color: #888888; -} -.swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints { - margin-left: 0; - font-style: italic; - font-size: 0.9em; - margin: 0; -} -.swagger-ui-wrap form.formtastic fieldset.buttons { - margin: 0; - padding: 0; -} -.swagger-ui-wrap span.blank, -.swagger-ui-wrap span.empty { - color: #888888; - font-style: italic; -} -.swagger-ui-wrap .markdown h3 { - color: #547f00; -} -.swagger-ui-wrap .markdown h4 { - color: #666666; -} -.swagger-ui-wrap .markdown pre { - font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; - background-color: #fcf6db; - border: 1px solid #e5e0c6; - padding: 10px; - margin: 0 0 10px 0; -} -.swagger-ui-wrap .markdown pre code { - line-height: 1.6em; -} -.swagger-ui-wrap div.gist { - margin: 20px 0 25px 0 !important; -} -.swagger-ui-wrap ul#resources { - font-family: "Droid Sans", sans-serif; - font-size: 0.9em; -} -.swagger-ui-wrap ul#resources li.resource { - border-bottom: 1px solid #dddddd; -} -.swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a, -.swagger-ui-wrap ul#resources li.resource.active div.heading h2 a { - color: black; -} -.swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a, -.swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a { - color: #555555; -} -.swagger-ui-wrap ul#resources li.resource:last-child { - border-bottom: none; -} -.swagger-ui-wrap ul#resources li.resource div.heading { - border: 1px solid transparent; - float: none; - clear: both; - overflow: hidden; - display: block; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options { - overflow: hidden; - padding: 0; - display: block; - clear: none; - float: right; - margin: 14px 10px 0 0; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li { - float: left; - clear: none; - margin: 0; - padding: 2px 10px; - border-right: 1px solid #dddddd; - color: #666666; - font-size: 0.9em; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li a { - color: #aaaaaa; - text-decoration: none; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover { - text-decoration: underline; - color: black; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover, -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active, -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active { - text-decoration: underline; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child, -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first { - padding-left: 0; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last { - padding-right: 0; - border-right: none; -} -.swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child, -.swagger-ui-wrap ul#resources li.resource div.heading ul.options.first { - padding-left: 0; -} -.swagger-ui-wrap ul#resources li.resource div.heading h2 { - color: #999999; - padding-left: 0; - display: block; - clear: none; - float: left; - font-family: "Droid Sans", sans-serif; - font-weight: bold; -} -.swagger-ui-wrap ul#resources li.resource div.heading h2 a { - color: #999999; -} -.swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover { - color: black; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation { - float: none; - clear: both; - overflow: hidden; - display: block; - margin: 0 0 10px; - padding: 0; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading { - float: none; - clear: both; - overflow: hidden; - display: block; - margin: 0; - padding: 0; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 { - display: block; - clear: none; - float: left; - width: auto; - margin: 0; - padding: 0; - line-height: 1.1em; - color: black; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path { - padding-left: 10px; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a { - color: black; - text-decoration: none; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover { - text-decoration: underline; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a { - text-transform: uppercase; - text-decoration: none; - color: white; - display: inline-block; - width: 50px; - font-size: 0.7em; - text-align: center; - padding: 7px 0 4px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -o-border-radius: 2px; - -ms-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span { - margin: 0; - padding: 0; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options { - overflow: hidden; - padding: 0; - display: block; - clear: none; - float: right; - margin: 6px 10px 0 0; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li { - float: left; - clear: none; - margin: 0; - padding: 2px 10px; - font-size: 0.9em; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a { - text-decoration: none; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content { - border-top: none; - padding: 10px; - -moz-border-radius-bottomleft: 6px; - -webkit-border-bottom-left-radius: 6px; - -o-border-bottom-left-radius: 6px; - -ms-border-bottom-left-radius: 6px; - -khtml-border-bottom-left-radius: 6px; - border-bottom-left-radius: 6px; - -moz-border-radius-bottomright: 6px; - -webkit-border-bottom-right-radius: 6px; - -o-border-bottom-right-radius: 6px; - -ms-border-bottom-right-radius: 6px; - -khtml-border-bottom-right-radius: 6px; - border-bottom-right-radius: 6px; - margin: 0 0 20px; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4 { - font-size: 1.1em; - margin: 0; - padding: 15px 0 5px; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header { - float: none; - clear: both; - overflow: hidden; - display: block; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a { - padding: 4px 0 0 10px; - display: inline-block; - font-size: 0.9em; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header img { - display: block; - clear: none; - float: right; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit { - display: block; - clear: none; - float: left; - padding: 6px 8px; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error { - outline: 2px solid black; - outline-color: #cc0000; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre { - font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; - padding: 10px; - font-size: 0.9em; - max-height: 400px; - overflow-y: auto; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading { - background-color: #f9f2e9; - border: 1px solid #f0e0ca; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a { - background-color: #c5862b; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #f0e0ca; - color: #c5862b; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a { - color: #c5862b; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content { - background-color: #faf5ee; - border: 1px solid #f0e0ca; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4 { - color: #c5862b; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a { - color: #dcb67f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading { - background-color: #fcffcd; - border: 1px solid black; - border-color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a { - text-transform: uppercase; - background-color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #ffd20f; - color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a { - color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content { - background-color: #fcffcd; - border: 1px solid black; - border-color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4 { - color: #ffd20f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a { - color: #6fc992; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading { - background-color: #f5e8e8; - border: 1px solid #e8c6c7; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a { - text-transform: uppercase; - background-color: #a41e22; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #e8c6c7; - color: #a41e22; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a { - color: #a41e22; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { - background-color: #f7eded; - border: 1px solid #e8c6c7; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4 { - color: #a41e22; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a { - color: #c8787a; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading { - background-color: #e7f6ec; - border: 1px solid #c3e8d1; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a { - background-color: #10a54a; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #c3e8d1; - color: #10a54a; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a { - color: #10a54a; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content { - background-color: #ebf7f0; - border: 1px solid #c3e8d1; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4 { - color: #10a54a; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a { - color: #6fc992; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading { - background-color: #FCE9E3; - border: 1px solid #F5D5C3; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a { - background-color: #D38042; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #f0cecb; - color: #D38042; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a { - color: #D38042; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content { - background-color: #faf0ef; - border: 1px solid #f0cecb; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4 { - color: #D38042; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a { - color: #dcb67f; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading { - background-color: #e7f0f7; - border: 1px solid #c3d9ec; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a { - background-color: #0f6ab4; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li { - border-right: 1px solid #dddddd; - border-right-color: #c3d9ec; - color: #0f6ab4; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a { - color: #0f6ab4; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content { - background-color: #ebf3f9; - border: 1px solid #c3d9ec; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4 { - color: #0f6ab4; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a { - color: #6fa5d2; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { - border-top: none; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last { - padding-right: 0; - border-right: none; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active { - text-decoration: underline; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first { - padding-left: 0; -} -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child, -.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first { - padding-left: 0; -} -.swagger-ui-wrap p#colophon { - margin: 0 15px 40px 15px; - padding: 10px 0; - font-size: 0.8em; - border-top: 1px solid #dddddd; - font-family: "Droid Sans", sans-serif; - color: #999999; - font-style: italic; -} -.swagger-ui-wrap p#colophon a { - text-decoration: none; - color: #547f00; -} -.swagger-ui-wrap h3 { - color: black; - font-size: 1.1em; - padding: 10px 0 10px 0; -} -.swagger-ui-wrap .markdown ol, -.swagger-ui-wrap .markdown ul { - font-family: "Droid Sans", sans-serif; - margin: 5px 0 10px; - padding: 0 0 0 18px; - list-style-type: disc; -} -.swagger-ui-wrap form.form_box { - background-color: #ebf3f9; - border: 1px solid #c3d9ec; - padding: 10px; -} -.swagger-ui-wrap form.form_box label { - color: #0f6ab4 !important; -} -.swagger-ui-wrap form.form_box input[type=submit] { - display: block; - padding: 10px; -} -.swagger-ui-wrap form.form_box p.weak { - font-size: 0.8em; -} -.swagger-ui-wrap form.form_box p { - font-size: 0.9em; - padding: 0 0 15px; - color: #7e7b6d; -} -.swagger-ui-wrap form.form_box p a { - color: #646257; -} -.swagger-ui-wrap form.form_box p strong { - color: black; -} -#header { - background-color: #89bf04; - padding: 14px; -} -#header a#logo { - font-size: 1.5em; - font-weight: bold; - text-decoration: none; - background: transparent url(../images/logo_small.png) no-repeat left center; - padding: 20px 0 20px 40px; - color: white; -} -#header form#api_selector { - display: block; - clear: none; - float: right; -} -#header form#api_selector .input { - display: block; - clear: none; - float: left; - margin: 0 10px 0 0; -} -#header form#api_selector .input input#input_apiKey { - width: 200px; -} -#header form#api_selector .input input#input_baseUrl { - width: 400px; -} -#header form#api_selector .input a#explore { - display: block; - text-decoration: none; - font-weight: bold; - padding: 6px 8px; - font-size: 0.9em; - color: white; - background-color: #547f00; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - -o-border-radius: 4px; - -ms-border-radius: 4px; - -khtml-border-radius: 4px; - border-radius: 4px; -} -#header form#api_selector .input a#explore:hover { - background-color: #547f00; -} -#header form#api_selector .input input { - font-size: 0.9em; - padding: 3px; - margin: 0; -} -#content_message { - margin: 10px 15px; - font-style: italic; - color: #999999; -} -#message-bar { - min-height: 30px; - text-align: center; - padding-top: 10px; -} diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/images/logo_small.png b/fixtures/v1.2/helloworld/server/src/main/webapp/images/logo_small.png deleted file mode 100644 index 5496a65579ae903d4008f9d268fac422ef9d3679..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 770 zcmV+d1O5DoP)K11rQipnJ)eVnTSzHNF zN8ab&RhE5cC$$4FI-PZXx$pga@8yN)KS}L2Us~^y$(x-xioWbnFcV+~b9ig=!ft8Q z0RD+rpA8910Smyc0GviVUOPGiY6YM@-r6Nn8S&~cxHl27$l)-R$1(!Xx045RDy;_& zeXkG{;_#i9rz0B6149#Ddj=KM6MV^rTD%ylzGdCBX<^=^@I0X3SCR7OMbn}sUKdeF zKO-flaJa%@kJ27@Rod?J9=+Qx5|=PtG8n> zy~9rIu}+48M}FW5Bbqw3t#po?c?kmG!FX32W(dOjzTb+U@64MzHItoeB!M0Jcd}|E z>ekW`<~FjR_ZVVJkF|_htH&v!({Oad?xax?0K0sLwBY%nr46DpCmIIaa?@|Y&?n0q z@kJlMy`pE2HtEgASNd~xNzt$Kn7w#^Fy5oi`e$bUE*+f>Vk5z7=-2pj68afrqli$_ zvqe##5V?a)QU_-s9+s?mJYT5m`MQDRH4cYs^L1lCW;Dua5Ln9lG0BC@9DJQHA(}y&Z}$apb{kU zbezR}b^|O%6i+$BFsT3zqAe8wg9`vfiRp#{)z2bsJw`vBQL7Bt!IexM3$Hsf0tHK3 z+R=x{lR$K`s;7__?ASPW=3?*xgCpGaiadSEpoi0pw-_V#OXM8Ap{4qlG08x0ig9IY z3Ijqh(t1_=g#jocuqyJO=729e9OSiNDSrhR0Gc5G)(QGH?*IS*07*qoM6N<$f<~fU A82|tP diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/images/pet_store_api.png b/fixtures/v1.2/helloworld/server/src/main/webapp/images/pet_store_api.png deleted file mode 100644 index f9f9cd4aeb35a108c4b2f1dddb59977d56c595d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 824 zcmV-81IPS{P)n=Rd;8mVwQNY4k4xJQ%YT}s;WA7;r!W@XgqjG_4og} z8w>{OB9REiMa8-B85td+y}bji^~2KA`Md4j-u{zw=H%Da@83%_8qEnl9k1WK;pWX- zb-lg)pQYAreK@>)*5Clqni{IZVYGG+NY67Bp-^bn;L{Nbh44I6CIK+n7p8#U?;fCA zYMFcy%UEjup4fgnli%NyzSe*@419QuU9lJ|T$?f9w?HIQ$RwEJGK7^!y7LhxIgVJp z9c!kB{0aydM1epU1NJ=h(}2X?Y{qn70yEN$dwm~favs=VbQ+T?!AvSl{P~PE zS&zsJbTQttne>kdM4$jBhLMFy@I1)3u-4cAzrY*l!o9eK^w%+jqY!oi(Ri8sMauvK zwnCP#%3hEH#FtNqq{iT(?=_JA_8XC>5Y8Y@!wmxKb|A87ZbpHA`+%v~0pt{5Nko1L zLKR^25YExt1lH7L1{t{|P z@n)yHyZf~3>LZ@#&CNw1rA#OlY^|)UJQKUrlKKO&x%wPhH}6&e0000K^a6u zQ3;5MiU^7p6*M3qDk!2=YEcHMQ>nzEYP;R`e2C@r+U+?#XaC*&gKPcB#k$`o&;7mu zYNhYYXe|Uo84#4ZIko#rcU5K8*yFL{qT47O&^5fZH$ zVZ@%(l~vVHjnm;H@KL8@r%yUHoo;rbHI_4lIH(_nsTT>S2`DFOD~uCb9_dF4`#QgI zy7ldMcLs+A_s%|e1pRPrbX-tpeNP!9(IpMFTce`t_5U%lP99z%&i6`1d~ zWeM!Rxc50<+d$e^9LT`?B+aMK~apR zHm?q;p<7{wN2g|I^aGlSws;VP84j(z%aQwvAWv83Z$}p(% zZ^?2;gxg(ey_`V5J7{;!o;o;KslW@z5EP~JGs|U)J7dF&(ff#A=6vU?cGQ$-4+;Jf z-ggJEa!yStn`_EWvl)#yhm6XVs}UUbsi;+agri;mCfjH^Uy;lH+Zw^h)4N?oZgZz4 zJk(fTZ|Bi^;+s_M=~+d#vyoxEPzTlOS=mX@sbl*uRj>=MaMr}cFIY8i?UM61>86uB zV$DlOUCiUJwbzJMP@D$urzK|lL2-PC!p1l47V-ZG<5Ev0Z5h~Kx?`KOp7gkAjV93A z-Gc7MrlxTf?wF;CbNc@tCHJH{TB3c;#{SVu%97}tyAM2n&|9W_?qv}$*Jt*%7Yxb# zV0;d;7|lDEltJYS+U)#aiJO};?_Jyy_4%syQ(uy?-J-Yx-9O5nKRk@@XSS~X<(2u~ zV-LamWm~!iqtH9wkpf8mAXZhOD&L#aA_%)4h2M;1M5jt zIR>Us+%W-GXa_f^opKg=DSrAs)AXeRa;Hp0aC1OgbxQ%Qr_QvTleM1jkR!2mkcX$3 ztsR8~G9iqh(-FJ@F_rQBIYDXV_6s7G9SxaVF^laZqcx$!D97m|7t16j6@Jt6UdDRy49Qyvs|c>RuA|@b%}`*wU}2^7q;&Vtc6@lb zcXl)T!6nYDzmMJ~%n$KNXyNlCG)GkJ4!82;v6@d3>s5r~E+3!O?049JDr14Y^PeMI02R`0lJ^=oJ zYd|*u9|SU(j7hY?+<=(?fP*mtV*zFhOrz6%{VA?ozdm&(Jf^V zMfPZ?>l`mS3{Uq8IM;e!+1YjJy2!mzK$O|wPeU{*QSbs9m+@`f5KxO3PBnQ=%RsZg%go*fJ`*w9TL{-WgZVIA$!YV}3BRcfeXaR$x#b zW)Tpd#8E4)^MyYdkH;4_;ChJuw%n+Be7Ko4;w-nHvyo$d_0e-YiF78Df&)_)(}fcr_r0mPH(4RRYWIu+d@t0&Ss@O^s! zOKyX&13)%N@83r^;QsgN{rl(!0|RF1FA)b1{CRXAy&1ySz@>olPiR4r$aMdq&_=nK zq|cFs8phWJ1@%dZ-gXd{zDbTILD>)qEvH-NU*Rf1b2J1Ri79`rBFl@ z8E^0I)OqEi{pH(a24b9YPG;Kz@t-qZW;3Mpe`MRlmYx{7bH-XZ&`RQ7Rb^%}gc&X| zd}Q-FZf|RWxHU?PR!(C?80zu(^l>*h{#ulSiid(O!J(8P-41bNM3tnX@U6NS5yo0? zdcF)~xFE&+&|gZ$23dV5t~?$$&ymZ;F8j7GGMncGSsDo%>J`26=&l=X#rSKv_64;0 zr;k6no@=gV`P)K!=kaHl>q?!`X>(A;84tg^Md<`zA%qbRLby1Z=fn*ZRdNqs%Tq|3 zOt}lZu0q9oKJhgz&+^7PCt$=UFW=R*w?a1)ePoL*`R$Gxj?TU@12tTHsT$giHQU+sqf;fS0FpT!< z z#UR4L_rT;lfRLVo8|3$7cmuxwjY5rmYs&kR6z_LRhf9-=4QalKQYEWw^4-EBI3j$& zA>$Im_{ZA>0`)E_&m%x6a)BThkx=e|aMkOrK9zb1YzqpQ&WZ^$)2T>CwTCuYRn5y) z3fVXg-@R5&Bf4?WUTyD|hBDe2>xEh|o-y}o5Se~+Ob!5xN>CaAN!<4)F zwNh!Y7B?@AigokFYNJL`0Vz&-ekrY95-n3M<%GR<;SzXRmO7(zd+gf|$Thb%;pby2 zyd{5TJ?|JYUgpSlJ0=LB@k6#d&opuPGq^qJAIumfhigC2qAX0OEnYnT@O;bA?X1O5 zpLe9|%_H+Yki!Rv$7Kvjv8r7Z?$<>G)g*%D*V#s&kz>Z3V1 z3!ZKh9H8Nl9IdhEW_rY#oYdDCLTe+nQ{(d2pBX8%CmxL+1`|b#Vb!?IY!kT7$PDWAP9$FY=e9KSK{DEH|408! zl-$lv)U8$EB{~es&j>rYg%{{JRvIl8@NK}L=xDAEVv(o#W@3LUDc*m?yKSPR0O|nY zAh;*QuBdpja8HzP8Uw`ce-r*LrUA47ZvZ)ff3k4^>;dFcof}9eXeeM<0OVj&CKDVK zpUKKIF%hSmry!pwK68UX>zOF@dv}B4Gg)^2GQmN7@A?zG!xO6dT*Cq0+r{eY6}AfU zf`|~y!?^R*nB0!iTcg|CgM}ou^H*s~5)%h;Xh;PYOM!|Yhfk$w;@`1Dx1y!EZrM&^zMat!^Wz# z=Z{;Pa0w21oA1X3*9=`*c7o3ePa^k%Vzu>2C_7DaZJ8FW5GJv|t>`Ym;_S>7g_3XI zdRb!Ppd`ErK`pUDHRsJd9@)bu>}s1)nKsyAR7h21<1u{DX1gd_Vf;^zdUpFPeSHHR z7AMgw^{FlFlK91CGMafKt`$FLhq#^=->@Uok7pqW6&#Zs4*E(i5-jog43A*qC@!(8 z8&F}pofRcMVmcJd=f;fvlfAR!ZqeaTE?#TQ^jQM0ioaJf8m^!Kdv^`f5kEsD0=gX#4={QE1$3A4K~V$ITKEd){XVLx?i6K*D>JF6E=i znqF^X#&UX}rfB|#A9%y|sR5i6B5gyk>8@Q+xHg|^5iz7C2}YkGF)nuP4LX#k2tRBP z=!VnWnXea(K#Wvg2&0f{!mXuuWaPpsoZ)3TSaEp;i|_)CvP=4wjI; zH%7tcLM8dQXsHW*#|}%TG9yiGpyjBltpcpXkpl8zg~x zD{QG)2Z8x$vfjgDc(J6i|OHoLX&!<+m^<$S3DtA8Mf!{ z7;g1}0uqJ0Mxuy%=#BFX5;Xh9JkrA$d}neS9T;$F$kXn}ss zF{Jn}9EDk=>h)sMy$YXfhKIDxr7U@3xl+uI|N5y!>?{aVn703L1Qgb$ql%JT^lsGD%)~)(H?Spj$zNt)h)Raob z@KyVB@&ngE0rtMW4!UTqGX>{&KHJAWqb)oYq9O)e)nmN0jVa;LNbKXx04a+8&O;q) zHBzGejrqt7Dk$Z2VR%%K#`!((pXE*MR{jGtv|q$p5#v9N0f^6B9IB!Q6(y$TmHRLM zsYXm2jn3f{9T)KVVzotDx=Ng8q0Z*VDZOkd5C!p0PRoFt>NyVEc9*%YR&2>Nq~$AI zXOQfjJ&wpGMe~I8y=cC(QR4=W2GWccFK(3`d&gN+)qWtW-`*}mZI%KDRl4@rUv1%d zxFO82lhW$xQyYxJg8tOZyXm1As%kEFNn)eW{R61M>af@wr(YW{R@+eL2 zx?SovK+867$F%T;Dfeajw|kiQ81GcOnS$Y4+hp8g_w1P8_~79d9p$*M1_Ei81$H$Ti6oi?ZW)&tmsJa7RV1LKddm7R*qL54L7j zvCr1Mrb;l!=m^TbJun-C_6$7w81E1eAQC^6s4>rZ4&I5+yyu$kha%Z&d+|S7Ki#{2 zy}%Giz|eR|G?ychX%%=eL`W(aLarb(L4jd>J+wlX;xMV9H8J!l&i?~Mw7)jlIuLD% zyq+AK92j#kC`ycv$SJ|E7!FBParx#v<3_rZ-DLQ@>`#sdl5}immok8&`{YgF|+< z`tB>e%6G{=B4?V-be>`&*}0d*f?$yBX@w+rJht@O+=^zttqB2p=IiA17#YD$4-fih z@$gJ95mGmFhN!d;3Ag4#>3o`>%L{G=9<}qOJ$wDN)%)MN6bVsAPG4oKB3+8r6!Qf9 z3m8?jIpWcEJbt6|f?Y4nMXK(--YZ|GA2_aRS!do%J9S7?Q&4FYL@sPilq}e4tlYa& z?f+we^=FH^Z9|dnXZghblW!IYGIAT{``58&7vZBybh+GuIPP{h*J?&vf7i8rv6qgx zab9~l+K`tvC7pWtlS!5lt(n#Yl}PAR(v01oXjc0F?T0w>+*p#PtE?Tf_hMrEaZ!^V zbv_>=4xibc0TUxg^I>TS?HR4fdiWl`@6{7|WU9G68l7tOz2p>oIe~NNr!>Q&PHm`4 z98R?g(IT*nl#{_|*WO_h0X78;WwMp?A^Zi)W@BX5q==TdOl?~J6HK(0b(xD6?m3e3 z#+zMaSJb(W$h5+d+6vujSjyi_R80c9>7h;0YlUFDvN`iNGu&5HQ5^e>6x?&JSc4V$6_I1jJ4vnCVbkU`Gz=Uy#~OI( zlL-$UAE$pVCsD_rICM#Q!ltzcqDphp5L|ZrqUm>=H%x!RjMrF#*?BN2shvUg=H;)& zy~_xWl*k$~9Hl6PIq({dELPE-r4*YNs7?5{>dlC`EcK~lPKB_8V)G@H)UZFF8$tXT z@^raW#Hq4OJGFL2Aye|HU&_NL%dYans6?ltqEBz`Q|m=@Zh4=-p2r;}q(Nbsk$fUI zP|(Ns2>MDvZi1H7<55frlQn#%?`WY3g`+fRuC#UJx%#d!zxEu3=}zF514S=6f@?~$ zeuSB=6E7r3ya|; z@K7M3VBrls6c{M*M_{AB_fVjgQ|F(FuK(@=1eWeVMSpLglllqV6Rg-L_46;?^IskS z)x6|SR1^gGl6amWjkb1dX}^8DumNXNmhsfxKA#;bBBIZE@0gma5yQY(FX>|N~Y^mgq`xc zdxOf6r{9u#_e0gV3(fdBTdV2Sc4SN5ZmP?cB4?KRdvj&>@zN_HP5m0E=+A=efDBI*IG*Gy%%< zz@yc%2XvGm)QQv5k^ZC6!9MwX8BCmQ{3eAX|GTwn#>(PS6PoB=$Pwn*?wz?%Tx2gwJ4apoy`A15D=>?%}hj`fV*p=6XW=YR(sp))`dxTnqHE&{&; zPdeO}SVkf*6_$c45W3Z}u|Z&a8{r!6ZNY62S>5{jAd)Hkjg@h%@c)c#BvZK2lmGw| z`Vh+%ECkF{t=)XpF3Z1bj=Pe9LpHbnQwjeTU#=4hB76#52DU2P2Ouj~^lRWwRd%eN zBw_z%FL0CUlk!`s2!`>QG&H__i_)I9=AuA=jn40z>;@hRsg)>J(58cx;l;h_zE*-R7Wbz6Ff#1Mss*)zTImU4`2@?a7y;v4 zH=lJ_PM5Rkw*AU`Cmq6aa>chASJ&Z3Ebj`y;w$MM!fa6`13VU7Kc|T5Xl#7ecj?mp zREV-nBJ6C)`?&}QDe_(KM>BrlN|iF{7-90j+J>N0^vY=LK;8!^9Y_m*aRPX{!S6ag zgRw(13pJvt`;{^S-vgUk?8pV_Vh4a4P7~}uHT)ENFMqd71QIOl8Q6+24TM_+158z) z54U-*C{M)S&!2Bfu&`?Ti6;WojY;%6+I;uCof+*T2iUMz!7Eg<{}#DJSx)C$5f zP(oSf>_s1t06cJ-U3?<9poS4O{Go>H>hro^ks;r3mm1Ehfq?m(_YE8UiVUgG%W9ZY z!@O^}KR%JW*0e=66rUYj5BP~=x%$^x92-m_ - - - Swagger UI - - - - - - - - - - - - - - - - - - - - -
-   -
- -
- -
- - - - diff --git a/fixtures/v1.2/helloworld/server/src/main/webapp/lib/backbone-min.js b/fixtures/v1.2/helloworld/server/src/main/webapp/lib/backbone-min.js deleted file mode 100644 index c1c0d4fff2..0000000000 --- a/fixtures/v1.2/helloworld/server/src/main/webapp/lib/backbone-min.js +++ /dev/null @@ -1,38 +0,0 @@ -// Backbone.js 0.9.2 - -// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://backbonejs.org -(function(){var l=this,y=l.Backbone,z=Array.prototype.slice,A=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:l.Backbone={};g.VERSION="0.9.2";var f=l._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var i=l.jQuery||l.Zepto||l.ender;g.setDomLibrary=function(a){i=a};g.noConflict=function(){l.Backbone=y;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var p=/\s+/,k=g.Events={on:function(a,b,c){var d,e,f,g,j;if(!b)return this;a=a.split(p);for(d=this._callbacks||(this._callbacks= -{});e=a.shift();)f=(j=d[e])?j.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:j?j.next:f};return this},off:function(a,b,c){var d,e,h,g,j,q;if(e=this._callbacks){if(!a&&!b&&!c)return delete this._callbacks,this;for(a=a?a.split(p):f.keys(e);d=a.shift();)if(h=e[d],delete e[d],h&&(b||c))for(g=h.tail;(h=h.next)!==g;)if(j=h.callback,q=h.context,b&&j!==b||c&&q!==c)this.on(d,j,q);return this}},trigger:function(a){var b,c,d,e,f,g;if(!(d=this._callbacks))return this;f=d.all;a=a.split(p);for(g= -z.call(arguments,1);b=a.shift();){if(c=d[b])for(e=c.tail;(c=c.next)!==e;)c.callback.apply(c.context||this,g);if(c=f){e=c.tail;for(b=[b].concat(g);(c=c.next)!==e;)c.callback.apply(c.context||this,b)}}return this}};k.bind=k.on;k.unbind=k.off;var o=g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=n(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.changed={};this._silent= -{};this._pending={};this.set(a,{silent:!0});this.changed={};this._silent={};this._pending={};this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(o.prototype,k,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.get(a);return this._escapedAttributes[a]=f.escape(null== -b?"":""+b)},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof o&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=c.changes={},h=this.attributes,g=this._escapedAttributes,j=this._previousAttributes||{};for(e in d){a=d[e];if(!f.isEqual(h[e],a)||c.unset&&f.has(h,e))delete g[e],(c.silent?this._silent: -b)[e]=!0;c.unset?delete h[e]:h[e]=a;!f.isEqual(j[e],a)||f.has(h,e)!=f.has(j,e)?(this.changed[e]=a,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}c.silent||this.change(c);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)}; -a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;e=f.clone(this.attributes)}a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;c.success=function(a,b,e){b=h.parse(a,e);if(c.wait){delete c.wait;b=f.extend(d||{},b)}if(!h.set(b,c))return false;i?i(h,a):h.trigger("sync",h,a,c)};c.error=g.wrapError(c.error, -h,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=n(this,"urlRoot")||n(this.collection,"url")||t(); -return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;for(;!f.isEmpty(this._pending);){this._pending= -{};this.trigger("change",this,a);for(c in this.changed)!this._pending[c]&&!this._silent[c]&&delete this.changed[c];this._previousAttributes=f.clone(this.attributes)}this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length|| -!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});var r=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);b.comparator&&(this.comparator=b.comparator); -this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(r.prototype,k,{model:o,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,d,e,g,i,j={},k={},l=[];b||(b={});a=f.isArray(a)?a.slice():[a];c=0;for(d=a.length;c=b))this.iframe=i('