From 71c1166c98b720e7f143098e519cf811e6e85b7a Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Thu, 18 Aug 2022 14:10:03 +0200 Subject: [PATCH 1/2] docs: make usage of Schema Object consistent --- anypointmq/README.md | 2 +- anypointmq/json_schemas/message.json | 11 +++++++++-- http/README.md | 7 ++++--- http/json_schemas/message.json | 11 +++++++++-- http/json_schemas/operation.json | 11 +++++++++-- kafka/README.md | 9 +++++---- kafka/json_schemas/message.json | 11 +++++++++-- websockets/README.md | 7 ++++--- websockets/json_schemas/channel.json | 20 +++++++++++++++++--- 9 files changed, 67 insertions(+), 22 deletions(-) diff --git a/anypointmq/README.md b/anypointmq/README.md index 196df062..ee2a2b9c 100644 --- a/anypointmq/README.md +++ b/anypointmq/README.md @@ -89,7 +89,7 @@ The Anypoint MQ [Message Binding Object](https://github.com/asyncapi/spec/blob/m Field Name | Type | Description ---|:---:|--- -`headers` | [Schema Object](https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject) | **Optional**. A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type `object` and have a `properties` key. Examples of Anypoint MQ protocol headers are `messageId` and `messageGroupId`. +`headers` | [Schema Object](https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject) \| [Reference Object](https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#referenceObject) | **Optional**. A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type `object` and have a `properties` key. Examples of Anypoint MQ protocol headers are `messageId` and `messageGroupId`. `bindingVersion` | string | **Optional**, defaults to `latest`. The version of this binding. Note that application headers must be specified in the [`headers` field of the standard Message Object](https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#messageObjectHeaders) and are transmitted in the [`properties` section of the Anypoint MQ message](https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/anypoint-mq-broker/). diff --git a/anypointmq/json_schemas/message.json b/anypointmq/json_schemas/message.json index fa63cb5d..5e8ac1aa 100644 --- a/anypointmq/json_schemas/message.json +++ b/anypointmq/json_schemas/message.json @@ -7,12 +7,19 @@ "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\-\\_]+$": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension" + "$ref": "https://asyncapi.com/definitions/2.4.0/specificationExtension.json" } }, "properties": { "headers": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "A Schema object containing the definitions for Anypoint MQ-specific headers (protocol headers). This schema MUST be of type 'object' and have a 'properties' key. Examples of Anypoint MQ protocol headers are 'messageId' and 'messageGroupId'." }, "bindingVersion": { diff --git a/http/README.md b/http/README.md index e036b4b5..085b3273 100644 --- a/http/README.md +++ b/http/README.md @@ -35,7 +35,7 @@ Field Name | Type | Description ---|:---:|--- `type` | string | **Required**. Type of operation. Its value MUST be either `request` or `response`. `method` | string | When `type` is `request`, this is the HTTP method, otherwise it MUST be ignored. Its value MUST be one of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS`, `CONNECT`, and `TRACE`. -`query` | [Schema Object][schemaObject] | A Schema object containing the definitions for each query parameter. This schema MUST be of type `object` and have a `properties` key. +`query` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | A Schema object containing the definitions for each query parameter. This schema MUST be of type `object` and have a `properties` key. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above. @@ -74,7 +74,7 @@ This object contains information about the message representation in HTTP. Field Name | Type | Description ---|:---:|--- -`headers` | [Schema Object][schemaObject] | A Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type `object` and have a `properties` key. +`headers` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | A Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type `object` and have a `properties` key. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above. @@ -96,4 +96,5 @@ channels: bindingVersion: '0.1.0' ``` -[schemaObject]: https://www.asyncapi.com/docs/specifications/2.0.0/#schemaObject \ No newline at end of file +[schemaObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject +[referenceObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#referenceObject \ No newline at end of file diff --git a/http/json_schemas/message.json b/http/json_schemas/message.json index 2437d2cc..faeeb089 100644 --- a/http/json_schemas/message.json +++ b/http/json_schemas/message.json @@ -7,12 +7,19 @@ "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\-\\_]+$": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension" + "$ref": "https://asyncapi.com/definitions/2.4.0/specificationExtension.json" } }, "properties": { "headers": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "\tA Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type 'object' and have a 'properties' key." }, "bindingVersion": { diff --git a/http/json_schemas/operation.json b/http/json_schemas/operation.json index 67483a4c..76873f1c 100644 --- a/http/json_schemas/operation.json +++ b/http/json_schemas/operation.json @@ -7,7 +7,7 @@ "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\-\\_]+$": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension" + "$ref": "https://asyncapi.com/definitions/2.4.0/specificationExtension.json" } }, "properties": { @@ -35,7 +35,14 @@ "description": "When 'type' is 'request', this is the HTTP method, otherwise it MUST be ignored. Its value MUST be one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', and 'TRACE'." }, "query": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "A Schema object containing the definitions for each query parameter. This schema MUST be of type 'object' and have a properties key." }, "bindingVersion": { diff --git a/kafka/README.md b/kafka/README.md index adc5606e..fb5adc20 100644 --- a/kafka/README.md +++ b/kafka/README.md @@ -35,8 +35,8 @@ This object contains information about the operation representation in Kafka. Field Name | Type | Description ---|:---:|--- -`groupId` | [Schema Object][schemaObject] | Id of the consumer group. -`clientId` | [Schema Object][schemaObject] | Id of the consumer inside a consumer group. +`groupId` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | Id of the consumer group. +`clientId` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | Id of the consumer inside a consumer group. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above. @@ -69,7 +69,7 @@ This object contains information about the message representation in Kafka. Field Name | Type | Description ---|:---:|--- -`key` | [Schema Object][schemaObject] \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. **NOTE**: You can also use the [reference object](https://asyncapi.io/docs/specifications/v2.1.0#referenceObject) way. +`key` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. **NOTE**: You can also use the [reference object](https://asyncapi.io/docs/specifications/v2.1.0#referenceObject) way. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above. @@ -88,4 +88,5 @@ channels: bindingVersion: '0.1.0' ``` -[schemaObject]: https://www.asyncapi.com/docs/specifications/2.0.0/#schemaObject +[schemaObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject +[referenceObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#referenceObject \ No newline at end of file diff --git a/kafka/json_schemas/message.json b/kafka/json_schemas/message.json index 701beaa4..4fdee576 100644 --- a/kafka/json_schemas/message.json +++ b/kafka/json_schemas/message.json @@ -6,12 +6,19 @@ "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\-\\_]+$": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension" + "$ref": "https://asyncapi.com/definitions/2.4.0/specificationExtension.json" } }, "properties": { "key": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "The message key." }, "bindingVersion": { diff --git a/websockets/README.md b/websockets/README.md index 47b18121..8d67e068 100644 --- a/websockets/README.md +++ b/websockets/README.md @@ -29,8 +29,8 @@ When using WebSockets, the channel represents the connection. Unlike other proto Field Name | Type | Description ---|:---:|--- `method` | string | The HTTP method to use when establishing the connection. Its value MUST be either `GET` or `POST`. -`query` | [Schema Object][schemaObject] | A Schema object containing the definitions for each query parameter. This schema MUST be of type `object` and have a `properties` key. -`headers` | [Schema Object][schemaObject] | A Schema object containing the definitions of the HTTP headers to use when establishing the connection. This schema MUST be of type `object` and have a `properties` key. +`query` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | A Schema object containing the definitions for each query parameter. This schema MUST be of type `object` and have a `properties` key. +`headers` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) | A Schema object containing the definitions of the HTTP headers to use when establishing the connection. This schema MUST be of type `object` and have a `properties` key. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above. @@ -49,4 +49,5 @@ This object MUST NOT contain any properties. Its name is reserved for future use This object MUST NOT contain any properties. Its name is reserved for future use. -[schemaObject]: https://www.asyncapi.com/docs/specifications/2.0.0/#schemaObject \ No newline at end of file +[schemaObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject +[referenceObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#referenceObject \ No newline at end of file diff --git a/websockets/json_schemas/channel.json b/websockets/json_schemas/channel.json index ebb51eea..15b3da52 100644 --- a/websockets/json_schemas/channel.json +++ b/websockets/json_schemas/channel.json @@ -7,7 +7,7 @@ "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\-\\_]+$": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension" + "$ref": "https://asyncapi.com/definitions/2.4.0/specificationExtension.json" } }, "properties": { @@ -20,11 +20,25 @@ "description": "The HTTP method to use when establishing the connection. Its value MUST be either 'GET' or 'POST'." }, "query": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "A Schema object containing the definitions for each query parameter. This schema MUST be of type 'object' and have a 'properties' key." }, "headers": { - "$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema", + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/2.4.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json" + } + ], "description": "A Schema object containing the definitions of the HTTP headers to use when establishing the connection. This schema MUST be of type 'object' and have a 'properties' key." }, "bindingVersion": { From 50a5fd9f426d9b578c0cd6626aaeae8417233f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Thu, 25 Aug 2022 12:35:09 +0200 Subject: [PATCH 2/2] Update kafka/README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fran Méndez --- kafka/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/README.md b/kafka/README.md index fb5adc20..38a907dc 100644 --- a/kafka/README.md +++ b/kafka/README.md @@ -69,7 +69,7 @@ This object contains information about the message representation in Kafka. Field Name | Type | Description ---|:---:|--- -`key` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. **NOTE**: You can also use the [reference object](https://asyncapi.io/docs/specifications/v2.1.0#referenceObject) way. +`key` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. `bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. This object MUST contain only the properties defined above.