From 97247492c72c393fcf112a2d05f80e7faf36410f Mon Sep 17 00:00:00 2001
From: Mike Ralphson 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 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here. For example, if a field has an array value, the JSON array representation will be used: All field names in the specification are case sensitive.
@@ -250,19 +258,19 @@
A single server would be described as: The following shows how multiple servers can be described, for example, at the OpenAPI Object’s The following shows how variables can be used for a server configuration: Describes the operations available on a single path.
@@ -895,7 +903,7 @@
A header parameter with an array of 64 bit integer numbers: A path parameter of a string value: An optional query parameter of a string value, allowing multiple values by repeating the query parameter: A free-form query parameter, allowing undefined parameters of a specific type: A complex parameter using A request body with a referenced model definition. A body parameter that is an array of string values: In contrast with the 2.0 specification, In this example, the contents in the When passing complex objects in the When passing complex objects in the It is common to use When passing in An A 200 response for a successful operation and a default response for others (implying an error): Describes a single response from an API Operation, including design-time, static
@@ -2147,7 +2155,7 @@
Response of an array of a complex type: Response with a string type: Plain text response with headers: Response with no return value:Status of This Document
The source-of-truth for the specification is the GitHub markdown file referenced above.Status of This Document
The source-of-truth for the specification is the GitHub markdown file referenced above.OpenAPI Specification
Version 3.0.3
{
- "field": [ 1, 2, 3 ]
+ "field": [ 1, 2, 3 ]
}
Info Object Example
{
- "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"
+ "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"
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
- "version": "1.0.1"
+ "version": "1.0.1"
}
@@ -311,9 +319,9 @@
Contact Object Example
{
- "name": "API Support",
- "url": "http://www.example.com/support",
- "email": "support@example.com"
+ "name": "API Support",
+ "url": "http://www.example.com/support",
+ "email": "support@example.com"
}
@@ -349,8 +357,8 @@
License Object Example
{
- "name": "Apache 2.0",
- "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
@@ -391,8 +399,8 @@
{
- "url": "https://development.gigantic-server.com/v1",
- "description": "Development server"
+ "url": "https://development.gigantic-server.com/v1",
+ "description": "Development server"
}
@@ -402,18 +410,18 @@
servers
:
{
- "servers": [
+ "servers": [
{
- "url": "https://development.gigantic-server.com/v1",
- "description": "Development server"
+ "url": "https://development.gigantic-server.com/v1",
+ "description": "Development server"
},
{
- "url": "https://staging.gigantic-server.com/v1",
- "description": "Staging server"
+ "url": "https://staging.gigantic-server.com/v1",
+ "description": "Staging server"
},
{
- "url": "https://api.gigantic-server.com/v1",
- "description": "Production server"
+ "url": "https://api.gigantic-server.com/v1",
+ "description": "Production server"
}
]
}
@@ -430,24 +438,24 @@
{
- "servers": [
+ "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`"
+ "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"
+ "port": {
+ "enum": [
+ "8443",
+ "443"
],
- "default": "8443"
+ "default": "8443"
},
- "basePath": {
- "default": "v2"
+ "basePath": {
+ "default": "v2"
}
}
}
@@ -465,9 +473,9 @@
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
@@ -517,47 +525,47 @@
schemas
-Map[
+string
, Schema Object ¦ Reference Object]Map[
string
, Schema Object | Reference Object]An object to hold reusable Schema Objects.
responses
-Map[
+string
, Response Object ¦ Reference Object]Map[
string
, Response Object | Reference Object]An object to hold reusable Response Objects.
parameters
-Map[
+string
, Parameter Object ¦ Reference Object]Map[
string
, Parameter Object | Reference Object]An object to hold reusable Parameter Objects.
examples
-Map[
+string
, Example Object ¦ Reference Object]Map[
string
, Example Object | Reference Object]An object to hold reusable Example Objects.
requestBodies
-Map[
+string
, Request Body Object ¦ Reference Object]Map[
string
, Request Body Object | Reference Object]An object to hold reusable Request Body Objects.
headers
-Map[
+string
, Header Object ¦ Reference Object]Map[
string
, Header Object | Reference Object]An object to hold reusable Header Objects.
securitySchemes
-Map[
+string
, Security Scheme Object ¦ Reference Object]Map[
string
, Security Scheme Object | Reference Object]An object to hold reusable Security Scheme Objects.
links
-Map[
+string
, Link Object ¦ Reference Object]Map[
string
, Link Object | Reference Object]An object to hold reusable Link Objects.
@@ -574,99 +582,99 @@
callbacks
-Map[
+string
, Callback Object ¦ Reference Object]Map[
string
, Callback Object | Reference Object]An object to hold reusable Callback Objects.
Components Object Example
-"components": {
- "schemas": {
- "GeneralError": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "format": "int32"
+"components": {
+ "schemas": {
+ "GeneralError": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
},
- "message": {
- "type": "string"
+ "message": {
+ "type": "string"
}
}
},
- "Category": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64"
+ "Category": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
},
- "name": {
- "type": "string"
+ "name": {
+ "type": "string"
}
}
},
- "Tag": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64"
+ "Tag": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
},
- "name": {
- "type": "string"
+ "name": {
+ "type": "string"
}
}
}
},
- "parameters": {
- "skipParam": {
- "name": "skip",
- "in": "query",
- "description": "number of items to skip",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int32"
+ "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"
+ "limitParam": {
+ "name": "limit",
+ "in": "query",
+ "description": "max records to return",
+ "required": true,
+ "schema" : {
+ "type": "integer",
+ "format": "int32"
}
}
},
- "responses": {
- "NotFound": {
- "description": "Entity not found."
+ "responses": {
+ "NotFound": {
+ "description": "Entity not found."
},
- "IllegalInput": {
- "description": "Illegal input for operation."
+ "IllegalInput": {
+ "description": "Illegal input for operation."
},
- "GeneralError": {
- "description": "General Error",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/GeneralError"
+ "GeneralError": {
+ "description": "General Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GeneralError"
}
}
}
}
},
- "securitySchemes": {
- "api_key": {
- "type": "apiKey",
- "name": "api_key",
- "in": "header"
+ "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"
+ "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"
}
}
}
@@ -728,7 +736,7 @@
content:
application/json:
schema:
- $ref: '#/components/schemas/GeneralError'
+ $ref: '#/components/schemas/GeneralError'
securitySchemes:
api_key:
type: apiKey
@@ -759,7 +767,7 @@
@@ -783,18 +791,18 @@
/{path}
Path Item Object
-A relative path to an individual endpoint. The field name MUST begin with a forward slash (
+/
). The path is appended (no relative URL resolution) to the expanded URL from the Server Object
's url
field in order to construct the full URL. Path templating 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.A relative path to an individual endpoint. The field name MUST begin with a forward slash (
/
). The path is appended (no relative URL resolution) to the expanded URL from the Server Object
’s url
field in order to construct the full URL. Path templating 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.Paths Object Example
{
- "/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"
+ "/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"
}
}
}
@@ -810,14 +818,14 @@
get:
description: Returns all pets from the system that the user has access to
responses:
- '200':
+ '200':
description: A list of pets.
content:
application/json:
schema:
type: array
items:
- $ref: '#/components/schemas/pet'
+ $ref: '#/components/schemas/pet'
Path Item Object
@@ -904,49 +912,49 @@
parameters
-[Parameter Object ¦ Reference Object]
+[Parameter Object | Reference Object]
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 and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.
Path Item Object Example
{
- "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"
+ "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"
+ "default": {
+ "description": "error payload",
+ "content": {
+ "text/html": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
}
}
}
}
}
},
- "parameters": [
+ "parameters": [
{
- "name": "id",
- "in": "path",
- "description": "ID of pet to use",
- "required": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "string"
+ "name": "id",
+ "in": "path",
+ "description": "ID of pet to use",
+ "required": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
}
},
- "style": "simple"
+ "style": "simple"
}
]
}
@@ -957,20 +965,20 @@
summary: Find pets by ID
operationId: getPetsById
responses:
- '200':
+ '200':
description: pet response
content:
- '*/*' :
+ '*/*' :
schema:
type: array
items:
- $ref: '#/components/schemas/Pet'
+ $ref: '#/components/schemas/Pet'
default:
description: error payload
content:
- 'text/html':
+ 'text/html':
schema:
- $ref: '#/components/schemas/ErrorModel'
+ $ref: '#/components/schemas/ErrorModel'
parameters:
- name: id
in: path
@@ -1021,12 +1029,12 @@
parameters
-[Parameter Object ¦ Reference Object]
+[Parameter Object | Reference Object]
A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, 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 and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.
requestBody
-Request Body Object ¦ Reference Object
+Request Body Object | Reference Object
The request body applicable for this operation. The
requestBody
is only supported in HTTP methods where the HTTP 1.1 specification [[!RFC7231]] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody
SHALL be ignored by consumers.
@@ -1036,7 +1044,7 @@
callbacks
-Map[
+string
, Callback Object ¦ Reference Object]Map[
string
, Callback Object | Reference Object]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 that describes a request that may be initiated by the API provider and the expected responses.
@@ -1060,63 +1068,63 @@
Operation Object Example
{
- "tags": [
- "pet"
+ "tags": [
+ "pet"
],
- "summary": "Updates a pet in the store with form data",
- "operationId": "updatePetWithForm",
- "parameters": [
+ "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"
+ "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"
+ "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"
+ "status": {
+ "description": "Updated status of the pet",
+ "type": "string"
}
},
- "required": ["status"]
+ "required": ["status"]
}
}
}
},
- "responses": {
- "200": {
- "description": "Pet updated.",
- "content": {
- "application/json": {},
- "application/xml": {}
+ "responses": {
+ "200": {
+ "description": "Pet updated.",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
}
},
- "405": {
- "description": "Method Not Allowed",
- "content": {
- "application/json": {},
- "application/xml": {}
+ "405": {
+ "description": "Method Not Allowed",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
}
}
},
- "security": [
+ "security": [
{
- "petstore_auth": [
- "write:pets",
- "read:pets"
+ "petstore_auth": [
+ "write:pets",
+ "read:pets"
]
}
]
@@ -1136,7 +1144,7 @@
type: string
requestBody:
content:
- 'application/x-www-form-urlencoded':
+ 'application/x-www-form-urlencoded':
schema:
properties:
name:
@@ -1148,16 +1156,16 @@
required:
- status
responses:
- '200':
+ '200':
description: Pet updated.
content:
- 'application/json': {}
- 'application/xml': {}
- '405':
+ 'application/json': {}
+ 'application/xml': {}
+ '405':
description: Method Not Allowed
content:
- 'application/json': {}
- 'application/xml': {}
+ 'application/json': {}
+ 'application/xml': {}
security:
- petstore_auth:
- write:pets
@@ -1191,8 +1199,8 @@
External Documentation Object Example
{
- "description": "Find more info here",
- "url": "https://example.com"
+ "description": "Find more info here",
+ "url": "https://example.com"
}
@@ -1280,7 +1288,7 @@
schema
-Schema Object ¦ Reference Object
+Schema Object | Reference Object
The schema defining the type used for the parameter.
@@ -1290,7 +1298,7 @@
@@ -1467,8 +1475,8 @@
examples
-Map[
+string
, Example Object ¦ Reference Object]Map[
string
, Example Object | Reference Object]Examples of the parameter’s potential value. 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
that contains an example, the examples
value SHALL override the example provided by the schema.false
n/a
n/a
-blue¦black¦brown
-R¦100¦G¦200¦B¦150
+blue|black|brown
+R|100|G|200|B|150
@@ -1485,18 +1493,18 @@
deepObject
@@ -1476,7 +1484,7 @@
n/a
n/a
n/a
-color\R=100&color\G=200&color\B=150
+color[R]=100&color[G]=200&color[B]=150
{
- "name": "token",
- "in": "header",
- "description": "token to be passed as a header",
- "required": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer",
- "format": "int64"
+ "name": "token",
+ "in": "header",
+ "description": "token to be passed as a header",
+ "required": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer",
+ "format": "int64"
}
},
- "style": "simple"
+ "style": "simple"
}
@@ -1514,12 +1522,12 @@
@@ -1534,18 +1542,18 @@
{
- "name": "username",
- "in": "path",
- "description": "username to fetch",
- "required": true,
- "schema": {
- "type": "string"
+ "name": "username",
+ "in": "path",
+ "description": "username to fetch",
+ "required": true,
+ "schema": {
+ "type": "string"
}
}
{
- "name": "id",
- "in": "query",
- "description": "ID of the object to fetch",
- "required": false,
- "schema": {
- "type": "array",
- "items": {
- "type": "string"
+ "name": "id",
+ "in": "query",
+ "description": "ID of the object to fetch",
+ "required": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
}
},
- "style": "form",
- "explode": true
+ "style": "form",
+ "explode": true
}
@@ -1563,15 +1571,15 @@
{
- "in": "query",
- "name": "freeForm",
- "schema": {
- "type": "object",
- "additionalProperties": {
- "type": "integer"
+ "in": "query",
+ "name": "freeForm",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "integer"
},
},
- "style": "form"
+ "style": "form"
}
@@ -1586,22 +1594,22 @@
content
to define serialization:
{
- "in": "query",
- "name": "coordinates",
- "content": {
- "application/json": {
- "schema": {
- "type": "object",
- "required": [
- "lat",
- "long"
+ "in": "query",
+ "name": "coordinates",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "lat",
+ "long"
],
- "properties": {
- "lat": {
- "type": "number"
+ "properties": {
+ "lat": {
+ "type": "number"
},
- "long": {
- "type": "number"
+ "long": {
+ "type": "number"
}
}
}
@@ -1659,43 +1667,43 @@
{
- "description": "user to add to the system",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
+ "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"
+ "examples": {
+ "user" : {
+ "summary": "User Example",
+ "externalValue": "http://foo.bar/examples/user-example.json"
}
}
},
- "application/xml": {
- "schema": {
- "$ref": "#/components/schemas/User"
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
},
- "examples": {
- "user" : {
- "summary": "User example in XML",
- "externalValue": "http://foo.bar/examples/user-example.xml"
+ "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"
+ "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"
+ "*/*": {
+ "examples": {
+ "user" : {
+ "summary": "User example in other format",
+ "externalValue": "http://foo.bar/examples/user-example.whatever"
}
}
}
@@ -1705,41 +1713,41 @@
description: user to add to the system
content:
- 'application/json':
+ 'application/json':
schema:
- $ref: '#/components/schemas/User'
+ $ref: '#/components/schemas/User'
examples:
user:
summary: User Example
- externalValue: 'http://foo.bar/examples/user-example.json'
- 'application/xml':
+ externalValue: 'http://foo.bar/examples/user-example.json'
+ 'application/xml':
schema:
- $ref: '#/components/schemas/User'
+ $ref: '#/components/schemas/User'
examples:
user:
summary: User Example in XML
- externalValue: 'http://foo.bar/examples/user-example.xml'
- 'text/plain':
+ 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'
- '*/*':
+ externalValue: 'http://foo.bar/examples/user-example.txt'
+ '*/*':
examples:
user:
summary: User example in other format
- externalValue: 'http://foo.bar/examples/user-example.whatever'
+ externalValue: 'http://foo.bar/examples/user-example.whatever'
{
- "description": "user to add to the system",
- "content": {
- "text/plain": {
- "schema": {
- "type": "array",
- "items": {
- "type": "string"
+ "description": "user to add to the system",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
}
}
}
@@ -1770,7 +1778,7 @@
schema
-Schema Object ¦ Reference Object
+Schema Object | Reference Object
The schema defining the content of the request, response, or parameter.
@@ -1780,7 +1788,7 @@
examples
-Map[
+string
, Example Object ¦ Reference Object]Map[
string
, Example Object | Reference Object]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.
@@ -1794,33 +1802,33 @@
Media Type Examples
{
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Pet"
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
},
- "examples": {
- "cat" : {
- "summary": "An example of a cat",
- "value":
+ "examples": {
+ "cat" : {
+ "summary": "An example of a cat",
+ "value":
{
- "name": "Fluffy",
- "petType": "Cat",
- "color": "White",
- "gender": "male",
- "breed": "Persian"
+ "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"
+ "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"
+ "frog": {
+ "$ref": "#/components/examples/frog-example"
}
}
}
@@ -1830,7 +1838,7 @@
application/json:
schema:
- $ref: "#/components/schemas/Pet"
+ $ref: "#/components/schemas/Pet"
examples:
cat:
summary: An example of a cat
@@ -1841,7 +1849,7 @@
gender: male
breed: Persian
dog:
- summary: An example of a dog with a cat's name
+ summary: An example of a dog with a cat's name
value:
name: Puma
petType: Dog
@@ -1849,7 +1857,7 @@
gender: Female
breed: Mixed
frog:
- $ref: "#/components/examples/frog-example"
+ $ref: "#/components/examples/frog-example"
Considerations for File Uploads
file
input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:requestBody
MUST be stringified per [[!RFC1866]] when passed to the server. In addition, the address
field complex object will be stringified.application/x-www-form-urlencoded
content type, the default serialization strategy of such properties is described in the Encoding Object
's style
property as form
.application/x-www-form-urlencoded
content type, the default serialization strategy of such properties is described in the Encoding Object
’s style
property as form
.Special Considerations for
multipart
Contentmultipart/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.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
: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
@@ -1984,7 +1992,7 @@
headers
-Map[
+string
, Header Object ¦ Reference Object]Map[
string
, Header Object | Reference Object]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
.
@@ -2020,12 +2028,12 @@
address:
# default is application/json
type: object
- properties: {}
+ properties: {}
historyMetadata:
# need to declare XML format!
description: metadata in XML format
type: object
- properties: {}
+ properties: {}
profileImage:
# default is application/octet-stream, need to declare an image type only!
type: string
@@ -2064,7 +2072,7 @@
@@ -2081,7 +2089,7 @@
default
-Response Object ¦ Reference Object
+Response Object | Reference Object
The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
@@ -2091,22 +2099,22 @@
HTTP Status Code
-Response Object ¦ Reference Object
+Response Object | Reference Object
Any HTTP status code 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 can link to a response that is defined in the OpenAPI Object’s components/responses 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.
{
- "200": {
- "description": "a pet to be returned",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Pet"
+ "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"
+ "default": {
+ "description": "Unexpected error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
}
}
}
@@ -2114,18 +2122,18 @@
}
-'200':
+'200':
description: a pet to be returned
content:
application/json:
schema:
- $ref: '#/components/schemas/Pet'
+ $ref: '#/components/schemas/Pet'
default:
description: Unexpected error
content:
application/json:
schema:
- $ref: '#/components/schemas/ErrorModel'
+ $ref: '#/components/schemas/ErrorModel'
Response Object
headers
-Map[
+string
, Header Object ¦ Reference Object]Map[
string
, Header Object | Reference Object]Maps a header name to its definition. [[!RFC7230]] states header names are case insensitive. If a response header is defined with the name
"Content-Type"
, it SHALL be ignored.
@@ -2157,7 +2165,7 @@
@@ -2167,13 +2175,13 @@
links
-Map[
+string
, Link Object ¦ Reference Object]Map[
string
, Link Object | Reference Object]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.
{
- "description": "A complex object array response",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/VeryComplexType"
+ "description": "A complex object array response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/VeryComplexType"
}
}
}
@@ -2187,16 +2195,16 @@
schema:
type: array
items:
- $ref: '#/components/schemas/VeryComplexType'
+ $ref: '#/components/schemas/VeryComplexType'
{
- "description": "A simple string response",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
+ "description": "A simple string response",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
}
}
}
@@ -2213,32 +2221,32 @@
{
- "description": "A simple string response",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string",
- "example": "whoa!"
+ "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"
+ "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-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"
+ "X-Rate-Limit-Reset": {
+ "description": "The number of seconds left in the current period",
+ "schema": {
+ "type": "integer"
}
}
}
@@ -2250,7 +2258,7 @@
text/plain:
schema:
type: string
- example: 'whoa!'
+ example: 'whoa!'
headers:
X-Rate-Limit-Limit:
description: The number of allowed requests in the current period
@@ -2268,7 +2276,7 @@
{
- "description": "object created"
+ "description": "object created"
}
@@ -2303,22 +2311,22 @@
This includes accessing any part of a body that a JSON Pointer [[!RFC6901]] can reference.
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: 187
+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"
+{
+ "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
+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
.
parameters | -Map[string , Any ¦ {expression}] |
+Map[string , Any | {expression}] |
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 [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). |
||
requestBody | -Any ¦ {expression} | +Any | {expression} | A literal value or {expression} to use as a request body when calling the target operation. | ||
webhooks | -Map[string , Path Item Object ¦ Reference Object] ] |
+Map[string , Path Item Object | Reference Object] ] |
The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the callbacks feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An example is available. |
||
responses | -Map[string , Response Object ¦ Reference Object] |
+Map[string , Response Object | Reference Object] |
An object to hold reusable Response Objects. | ||
parameters | -Map[string , Parameter Object ¦ Reference Object] |
+Map[string , Parameter Object | Reference Object] |
An object to hold reusable Parameter Objects. | ||
examples | -Map[string , Example Object ¦ Reference Object] |
+Map[string , Example Object | Reference Object] |
An object to hold reusable Example Objects. | ||
requestBodies | -Map[string , Request Body Object ¦ Reference Object] |
+Map[string , Request Body Object | Reference Object] |
An object to hold reusable Request Body Objects. | ||
headers | -Map[string , Header Object ¦ Reference Object] |
+Map[string , Header Object | Reference Object] |
An object to hold reusable Header Objects. | ||
securitySchemes | -Map[string , Security Scheme Object ¦ Reference Object] |
+Map[string , Security Scheme Object | Reference Object] |
An object to hold reusable Security Scheme Objects. | ||
links | -Map[string , Link Object ¦ Reference Object] |
+Map[string , Link Object | Reference Object] |
An object to hold reusable Link Objects. | ||
callbacks | -Map[string , Callback Object ¦ Reference Object] |
+Map[string , Callback Object | Reference Object] |
An object to hold reusable Callback Objects. | ||
pathItems | -Map[string , Path Item Object ¦ Reference Object] |
+Map[string , Path Item Object | Reference Object] |
An object to hold reusable Path Item Object. | ||
parameters | -[Parameter Object ¦ Reference Object] | +[Parameter Object | Reference Object] | 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 and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters. | ||
parameters | -[Parameter Object ¦ Reference Object] | +[Parameter Object | Reference Object] | A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, 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 and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters. | ||
requestBody | -Request Body Object ¦ Reference Object | +Request Body Object | Reference Object | The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [[!RFC7231]] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as [GET]section-4.3.1), [HEAD]section-4.3.2) and [DELETE]section-4.3.5)), requestBody is permitted but does not have well-defined semantics and SHOULD be avoided if possible. |
||
callbacks | -Map[string , Callback Object ¦ Reference Object] |
+Map[string , Callback Object | Reference Object] |
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 that describes a request that may be initiated by the API provider and the expected responses. | ||
examples | -Map[ string , Example Object ¦ Reference Object] |
+Map[ string , Example Object | Reference Object] |
Examples of the parameter’s potential value. 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 that contains an example, the examples value SHALL override the example provided by the schema. |
false | n/a | n/a | -blue¦black¦brown | -R¦100¦G¦200¦B¦150 | +blue|black|brown | +R|100|G|200|B|150 |
deepObject | @@ -1481,7 +1481,7 @@n/a | n/a | n/a | -color\R=100&color\G=200&color\B=150 | +color[R]=100&color[G]=200&color[B]=150 |
string
, Example Object ¦ Reference Object]string
, Example Object | Reference Object]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.string
, Header Object ¦ Reference Object]string
, Header Object | Reference Object]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
.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.string
, Header Object ¦ Reference Object]string
, Header Object | Reference Object]"Content-Type"
, it SHALL be ignored.string
, Link Object ¦ Reference Object]string
, Link Object | Reference Object]string
, Any ¦ {expression}]string
, Any | {expression}]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 [{in}.]{name}
for operations that use the same parameter name in different locations (e.g. path.id).