diff --git a/examples/next/application-headers.yml b/examples/next/application-headers.yml index b48844bb..70d7b3d2 100644 --- a/examples/next/application-headers.yml +++ b/examples/next/application-headers.yml @@ -8,7 +8,8 @@ info: url: https://www.apache.org/licenses/LICENSE-2.0 servers: - - url: api.streetlights.smartylighting.com:{port} + production: + url: api.streetlights.smartylighting.com:{port} protocol: mqtt description: Test broker variables: @@ -24,7 +25,8 @@ defaultContentType: application/json channels: smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' subscribe: summary: Receive information about environmental lighting conditions of a particular streetlight. operationId: receiveLightMeasurement @@ -76,7 +78,6 @@ components: parameters: streetlightId: - name: streetlightId description: The ID of the streetlight. schema: type: string diff --git a/examples/next/correlation-id.yml b/examples/next/correlation-id.yml index 864d94c4..0243be07 100644 --- a/examples/next/correlation-id.yml +++ b/examples/next/correlation-id.yml @@ -8,7 +8,8 @@ info: url: https://www.apache.org/licenses/LICENSE-2.0 servers: - - url: api.streetlights.smartylighting.com:{port} + production: + url: api.streetlights.smartylighting.com:{port} protocol: mqtt description: Test broker variables: @@ -31,7 +32,8 @@ defaultContentType: application/json channels: smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' subscribe: summary: Receive information about environmental lighting conditions of a particular streetlight. operationId: receiveLightMeasurement @@ -40,7 +42,8 @@ channels: smartylighting/streetlights/1/0/action/{streetlightId}/dim: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' publish: operationId: dimLight message: @@ -93,7 +96,6 @@ components: parameters: streetlightId: - name: streetlightId description: The ID of the streetlight. schema: type: string diff --git a/examples/next/gitter-streaming.yml b/examples/next/gitter-streaming.yml index 4211b49c..7e86a253 100644 --- a/examples/next/gitter-streaming.yml +++ b/examples/next/gitter-streaming.yml @@ -5,7 +5,8 @@ info: version: '1.0.0' servers: - - url: https://stream.gitter.im/v1 + production: + url: https://stream.gitter.im/v1 protocol: https protocolVersion: '1.1' security: @@ -14,13 +15,13 @@ servers: channels: /rooms/{roomId}/{resource}: parameters: - - name: roomId + roomId: description: Id of the Gitter room. schema: type: string examples: - 53307860c3599d1de448e19d - - name: resource + resource: description: The resource to consume. schema: type: string diff --git a/examples/next/rpc-client.yml b/examples/next/rpc-client.yml index c94f2537..7d36cc46 100644 --- a/examples/next/rpc-client.yml +++ b/examples/next/rpc-client.yml @@ -8,13 +8,14 @@ info: version: '1.0.0' servers: - - url: rabbitmq.example.org + production: + url: rabbitmq.example.org protocol: amqp channels: '{queue}': parameters: - - name: queue + queue: schema: type: string pattern: '^amq\\.gen\\-.+$' diff --git a/examples/next/rpc-server.yml b/examples/next/rpc-server.yml index e99570e3..4c582f3d 100644 --- a/examples/next/rpc-server.yml +++ b/examples/next/rpc-server.yml @@ -8,13 +8,14 @@ info: version: '1.0.0' servers: - - url: rabbitmq.example.org + production: + url: rabbitmq.example.org protocol: amqp channels: '{queue}': parameters: - - name: queue + queue: schema: type: string pattern: '^amq\\.gen\\-.+$' diff --git a/examples/next/slack-rtm.yml b/examples/next/slack-rtm.yml index d03db95c..25583c8b 100644 --- a/examples/next/slack-rtm.yml +++ b/examples/next/slack-rtm.yml @@ -5,7 +5,8 @@ info: version: '1.0.0' servers: - - url: https://slack.com/api/rtm.connect + production: + url: https://slack.com/api/rtm.connect protocol: https protocolVersion: '1.1' security: diff --git a/examples/next/streetlights.yml b/examples/next/streetlights.yml index 65a02c17..db371738 100644 --- a/examples/next/streetlights.yml +++ b/examples/next/streetlights.yml @@ -16,7 +16,8 @@ info: url: https://www.apache.org/licenses/LICENSE-2.0 servers: - - url: api.streetlights.smartylighting.com:{port} + production: + url: api.streetlights.smartylighting.com:{port} protocol: mqtt description: Test broker variables: @@ -40,7 +41,8 @@ channels: smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured: description: The topic on which measured values may be produced and consumed. parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' subscribe: summary: Receive information about environmental lighting conditions of a particular streetlight. operationId: receiveLightMeasurement @@ -51,7 +53,8 @@ channels: smartylighting/streetlights/1/0/action/{streetlightId}/turn/on: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' publish: operationId: turnOn traits: @@ -61,7 +64,8 @@ channels: smartylighting/streetlights/1/0/action/{streetlightId}/turn/off: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' publish: operationId: turnOff traits: @@ -71,7 +75,8 @@ channels: smartylighting/streetlights/1/0/action/{streetlightId}/dim: parameters: - - $ref: '#/components/parameters/streetlightId' + streetlightId: + $ref: '#/components/parameters/streetlightId' publish: operationId: dimLight traits: @@ -184,7 +189,6 @@ components: parameters: streetlightId: - name: streetlightId description: The ID of the streetlight. schema: type: string diff --git a/versions/next/asyncapi.md b/versions/next/asyncapi.md index b9b3eb9a..f0ba7c97 100644 --- a/versions/next/asyncapi.md +++ b/versions/next/asyncapi.md @@ -299,7 +299,35 @@ url: http://www.apache.org/licenses/LICENSE-2.0.html #### Servers Object -The Servers Object is an array of Server Objects. +The Servers Object is a map of [Server Objects](#serverObject). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +`^[A-Za-z0-9_\-]+$` | [Server Object](#serverObject) | The definition of a server this application MAY connect to. + +##### Servers Object Example + +```json +{ + "production": { + "url": "development.gigantic-server.com", + "description": "Development server", + "protocol": "kafka", + "protocolVersion": "1.0.0" + } +} +``` + +```yaml +production: + url: development.gigantic-server.com + description: Development server + protocol: kafka + protocolVersion: '1.0.0' +``` + #### Server Object @@ -486,8 +514,6 @@ Field Pattern | Type | Description ---|:---:|--- {channel} | [Channel Item Object](#channelItemObject) | A relative path to an individual channel. The field name MUST be in the form of a [RFC 6570 URI template](https://tools.ietf.org/html/rfc6570). Query parameters and fragments SHALL NOT be used, instead use [protocolInfo](#protocolInfoObject) to define them. -This object can be extended with [Specification Extensions](#specificationExtensions). - ##### Channels Object Example ```json @@ -521,7 +547,7 @@ Field Name | Type | Description description | `string` | An optional description of this channel item. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. subscribe | [Operation Object](#operationObject) | A definition of the SUBSCRIBE operation. publish | [Operation Object](#operationObject) | A definition of the PUBLISH operation. -parameters | [[Parameter Object](#parameterObject) | [Reference Object](#referenceObject)] | A list of the parameters included in the channel name. It SHOULD be present only when using channels with expressions (as defined by [RFC 6570 section 2.2](https://tools.ietf.org/html/rfc6570#section-2.2)). +parameters | [Parameters Object](#parametersObject) | A map of the parameters included in the channel name. It SHOULD be present only when using channels with expressions (as defined by [RFC 6570 section 2.2](https://tools.ietf.org/html/rfc6570#section-2.2)). protocolInfo | Map[`string`, [Protocol Info Object](#protocolInfoObject)] | A free-form map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the channel. This object can be extended with [Specification Extensions](#specificationExtensions). @@ -737,6 +763,53 @@ protocolInfo: +#### Parameters Object + +Describes a map of parameters included in a channel name. + +This map MUST contain all the parameters used in the parent channel name. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +`^[A-Za-z0-9_\-]+$` | [Parameter Object](#parameterObject) | [Reference Object](#referenceObject) | The key represents the name of the parameter. It MUST match the parameter name used in the parent channel name. + +##### Parameters Object Example + +```json +{ + "user/{userId}/signup": { + "parameters": { + "userId": { + "description": "Id of the user.", + "schema": { + "type": "string" + } + } + }, + "subscribe": { + "$ref": "#/components/messages/userSignedUp" + } + } +} +``` + +```yaml +user/{userId}/signup: + parameters: + userId: + description: Id of the user. + schema: + type: string + subscribe: + $ref: "#/components/messages/userSignedUp" +``` + + + + + #### Parameter Object Describes a parameter included in a channel name. @@ -745,7 +818,6 @@ Describes a parameter included in a channel name. Field Name | Type | Description ---|:---:|--- -name | `string` | The name of the parameter. description | `string` | A verbose explanation of the parameter. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. schema | [Schema Object](#schemaObject) | Definition of the parameter. @@ -756,15 +828,14 @@ This object can be extended with [Specification Extensions](#specificationExtens ```json { "user/{userId}/signup": { - "parameters": [ - { - "name": "userId", + "parameters": { + "userId": { "description": "Id of the user.", "schema": { "type": "string" } } - ], + }, "subscribe": { "$ref": "#/components/messages/userSignedUp" } @@ -775,7 +846,7 @@ This object can be extended with [Specification Extensions](#specificationExtens ```yaml user/{userId}/signup: parameters: - - name: userId + userId: description: Id of the user. schema: type: string @@ -786,7 +857,6 @@ user/{userId}/signup: - #### Protocol Info Object Free-form key-value object describing protocol-specific definitions for channels, operations, and messages. diff --git a/versions/next/schema.json b/versions/next/schema.json index bef6b66e..6cb1025e 100644 --- a/versions/next/schema.json +++ b/versions/next/schema.json @@ -30,11 +30,10 @@ "$ref": "#/definitions/info" }, "servers": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/definitions/server" - }, - "uniqueItems": true + } }, "defaultContentType": { "type": "string" @@ -572,10 +571,8 @@ "$ref": "#/definitions/ReferenceObject" }, "parameters": { - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/definitions/parameter" } }, @@ -613,10 +610,6 @@ "type": "string", "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, "schema": { "$ref": "#/definitions/schema" },