From 204554d40ae6ef189f1f2c948c5d5d1c977a6d3b Mon Sep 17 00:00:00 2001 From: derberg Date: Mon, 4 Dec 2023 11:15:50 +0100 Subject: [PATCH 1/8] feat: add mqtt bindings schemas --- bindings/mqtt/0.2.0/message.json | 53 +++++++++++++++++-- bindings/mqtt/0.2.0/operation.json | 24 +++++++-- bindings/mqtt/0.2.0/server.json | 44 +++++++++++++-- bindings/mqtt5/0.2.0/server.json | 53 ------------------- definitions/3.0.0/channelBindingsObject.json | 1 - definitions/3.0.0/messageBindingsObject.json | 1 - .../3.0.0/operationBindingsObject.json | 1 - definitions/3.0.0/serverBindingsObject.json | 35 ------------ 8 files changed, 110 insertions(+), 102 deletions(-) delete mode 100644 bindings/mqtt5/0.2.0/server.json diff --git a/bindings/mqtt/0.2.0/message.json b/bindings/mqtt/0.2.0/message.json index e2d8f798..40210aaf 100644 --- a/bindings/mqtt/0.2.0/message.json +++ b/bindings/mqtt/0.2.0/message.json @@ -1,16 +1,54 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/message.json", + "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/message.json", "title": "MQTT message bindings object", "description": "This object contains information about the message representation in MQTT.", "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { + "^x-[\\w\\d\\.\\-\\_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, "properties": { + "payloadFormatIndicator": { + "type": "integer", + "enum": [0, 1], + "description": "1 indicates that the payload is UTF-8 encoded character data. 0 indicates that the payload format is unspecified.", + "default": 0 + }, + "correlationData": { + "oneOf": [ + { + "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + } + ], + "description": "Correlation Data is used by the sender of the request message to identify which request the response message is for when it is received." + }, + "contentType": { + "type": "string", + "description": "String describing the content type of the message payload. This should not conflict with the contentType field of the associated AsyncAPI Message object." + }, + "responseTopic": { + "oneOf": [ + { + "type": "string", + "format": "uri-template", + "minLength": 1 + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + } + ], + "description": "The topic (channel URI) to be used for a response message." + }, + "bindingVersion": { "type": "string", "enum": [ @@ -22,6 +60,15 @@ "examples": [ { "bindingVersion": "0.2.0" + }, + { + "contentType": "application/json", + "correlationData": { + "type": "string", + "format": "uuid" + }, + "responseTopic": "application/responses", + "bindingVersion": "0.2.0" } ] -} +} \ No newline at end of file diff --git a/bindings/mqtt/0.2.0/operation.json b/bindings/mqtt/0.2.0/operation.json index ec042529..22df1030 100644 --- a/bindings/mqtt/0.2.0/operation.json +++ b/bindings/mqtt/0.2.0/operation.json @@ -1,24 +1,41 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/operation.json", + "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/operation.json", "title": "MQTT operation bindings object", "description": "This object contains information about the operation representation in MQTT.", "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { + "^x-[\\w\\d\\.\\-\\_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, "properties": { "qos": { "type": "integer", + "enum": [0,1,2], "description": "Defines the Quality of Service (QoS) levels for the message flow between client and server. Its value MUST be either 0 (At most once delivery), 1 (At least once delivery), or 2 (Exactly once delivery)." }, "retain": { "type": "boolean", "description": "Whether the broker should retain the message or not." }, + "messageExpiryInterval": { + "oneOf": [ + { + "type": "integer", + "minimum": 0, + "maximum": 4294967295 + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + } + ], + "description": "Lifetime of the message in seconds" + }, "bindingVersion": { "type": "string", "enum": [ @@ -31,7 +48,8 @@ { "qos": 2, "retain": true, + "messageExpiryInterval": 60, "bindingVersion": "0.2.0" } ] -} +} \ No newline at end of file diff --git a/bindings/mqtt/0.2.0/server.json b/bindings/mqtt/0.2.0/server.json index d45fdb8e..4cc84fef 100644 --- a/bindings/mqtt/0.2.0/server.json +++ b/bindings/mqtt/0.2.0/server.json @@ -1,23 +1,24 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/server.json", - "title": "MQTT server bindings object", + "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/server.json", + "title": "Server Schema", "description": "This object contains information about the server representation in MQTT.", "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { + "^x-[\\w\\d\\.\\-\\_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, "properties": { + "clientId": { "type": "string", "description": "The client identifier." }, "cleanSession": { "type": "boolean", - "description": "Whether to create a persistent connection or not. When 'false', the connection will be persistent." + "description": "Whether to create a persistent connection or not. When 'false', the connection will be persistent. This is called clean start in MQTTv5." }, "lastWill": { "type": "object", @@ -46,6 +47,37 @@ "type": "integer", "description": "Interval in seconds of the longest period of time the broker and the client can endure without sending a message." }, + "sessionExpiryInterval": { + "oneOf": [ + { + "type": "integer", + "minimum": 0 + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + } + ], + "description": "Interval time in seconds or a Schema Object containing the definition of the interval. The broker maintains a session for a disconnected client until this interval expires." + }, + "maximumPacketSize": { + "oneOf": [ + { + "type": "integer", + "minimum": 1, + "maximum": 4294967295 + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + } + ], + "description": "Number of bytes or a Schema Object representing the Maximum Packet Size the Client is willing to accept." + }, "bindingVersion": { "type": "string", "enum": [ @@ -65,7 +97,9 @@ "retain": false }, "keepAlive": 60, + "sessionExpiryInterval": 120, + "maximumPacketSize": 1024, "bindingVersion": "0.2.0" } ] -} +} \ No newline at end of file diff --git a/bindings/mqtt5/0.2.0/server.json b/bindings/mqtt5/0.2.0/server.json deleted file mode 100644 index 0ef7db4c..00000000 --- a/bindings/mqtt5/0.2.0/server.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt5/0.2.0/server.json", - "title": "Server Schema", - "description": "This object contains information about the server representation in MQTT5.", - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { - "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" - } - }, - "properties": { - - "sessionExpiryInterval": { - "oneOf": [ - { - "type": "integer", - "minimum": 0 - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ], - "description": "Session Expiry Interval in seconds or a Schema Object containing the definition of the interval." - }, - "bindingVersion": { - "type": "string", - "enum": [ - "0.2.0" - ], - "description": "The version of this binding. If omitted, 'latest' MUST be assumed." - } - }, - "examples": [ - { - "sessionExpiryInterval": 60, - "bindingVersion": "0.2.0" - }, - { - "sessionExpiryInterval": { - "type": "integer", - "minimum": 100 - }, - "bindingVersion": "0.2.0" - } - ] - } - - \ No newline at end of file diff --git a/definitions/3.0.0/channelBindingsObject.json b/definitions/3.0.0/channelBindingsObject.json index bb6f1fe4..490e5b35 100644 --- a/definitions/3.0.0/channelBindingsObject.json +++ b/definitions/3.0.0/channelBindingsObject.json @@ -81,7 +81,6 @@ }, "amqp1": {}, "mqtt": {}, - "mqtt5": {}, "kafka": { "properties": { "bindingVersion": { diff --git a/definitions/3.0.0/messageBindingsObject.json b/definitions/3.0.0/messageBindingsObject.json index 0bbb1e11..44266860 100644 --- a/definitions/3.0.0/messageBindingsObject.json +++ b/definitions/3.0.0/messageBindingsObject.json @@ -115,7 +115,6 @@ } ] }, - "mqtt5": { }, "kafka": { "properties": { "bindingVersion": { diff --git a/definitions/3.0.0/operationBindingsObject.json b/definitions/3.0.0/operationBindingsObject.json index 5ed6837f..af9e550b 100644 --- a/definitions/3.0.0/operationBindingsObject.json +++ b/definitions/3.0.0/operationBindingsObject.json @@ -115,7 +115,6 @@ } ] }, - "mqtt5": {}, "kafka": { "properties": { "bindingVersion": { diff --git a/definitions/3.0.0/serverBindingsObject.json b/definitions/3.0.0/serverBindingsObject.json index 79343211..c483725e 100644 --- a/definitions/3.0.0/serverBindingsObject.json +++ b/definitions/3.0.0/serverBindingsObject.json @@ -47,41 +47,6 @@ } ] }, - "mqtt5": { - "properties": { - "bindingVersion": { - "enum": ["0.2.0"] - } - }, - "allOf": [ - { - "description": "If no bindingVersion specified, use the latest binding", - "if": { - "not": { - "required": [ - "bindingVersion" - ] - } - }, - "then": { - "$ref": "http://asyncapi.com/bindings/mqtt5/0.2.0/server.json" - } - }, - { - "if": { - "required": [ "bindingVersion" ], - "properties": { - "bindingVersion": { - "const": "0.2.0" - } - } - }, - "then": { - "$ref": "http://asyncapi.com/bindings/mqtt5/0.2.0/server.json" - } - } - ] - }, "kafka": { "properties": { "bindingVersion": { From be928dd0ca1905b405312fac1ae683f0a02d4d18 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:05:50 +0100 Subject: [PATCH 2/8] Update bindings/mqtt/0.2.0/message.json --- bindings/mqtt/0.2.0/message.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/message.json b/bindings/mqtt/0.2.0/message.json index 40210aaf..070791c5 100644 --- a/bindings/mqtt/0.2.0/message.json +++ b/bindings/mqtt/0.2.0/message.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/message.json", + "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/message.json", "title": "MQTT message bindings object", "description": "This object contains information about the message representation in MQTT.", "type": "object", From 95c07460c869f18e4da2ec5ebda1ff1fc544faa5 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:05:57 +0100 Subject: [PATCH 3/8] Update bindings/mqtt/0.2.0/operation.json --- bindings/mqtt/0.2.0/operation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/operation.json b/bindings/mqtt/0.2.0/operation.json index 22df1030..63dcc966 100644 --- a/bindings/mqtt/0.2.0/operation.json +++ b/bindings/mqtt/0.2.0/operation.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/operation.json", + "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/operation.json", "title": "MQTT operation bindings object", "description": "This object contains information about the operation representation in MQTT.", "type": "object", From 657420b9918a18cac37a765177263291fa8e687b Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:06:18 +0100 Subject: [PATCH 4/8] Update bindings/mqtt/0.2.0/server.json --- bindings/mqtt/0.2.0/server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/server.json b/bindings/mqtt/0.2.0/server.json index 4cc84fef..cbc002a6 100644 --- a/bindings/mqtt/0.2.0/server.json +++ b/bindings/mqtt/0.2.0/server.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/mqtt/0.0.2/server.json", + "$id": "http://asyncapi.com/bindings/mqtt/0.2.0/server.json", "title": "Server Schema", "description": "This object contains information about the server representation in MQTT.", "type": "object", From fe21433844f3af25f16719cfd7368233c0d81256 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:06:23 +0100 Subject: [PATCH 5/8] Update bindings/mqtt/0.2.0/server.json --- bindings/mqtt/0.2.0/server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/server.json b/bindings/mqtt/0.2.0/server.json index cbc002a6..28f8d800 100644 --- a/bindings/mqtt/0.2.0/server.json +++ b/bindings/mqtt/0.2.0/server.json @@ -6,7 +6,7 @@ "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\-\\_]+$": { + "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, From 0689e495bbf57b47ede104a4b6840af21e4721bd Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:06:30 +0100 Subject: [PATCH 6/8] Update bindings/mqtt/0.2.0/message.json --- bindings/mqtt/0.2.0/message.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/message.json b/bindings/mqtt/0.2.0/message.json index 070791c5..76959bcc 100644 --- a/bindings/mqtt/0.2.0/message.json +++ b/bindings/mqtt/0.2.0/message.json @@ -6,7 +6,7 @@ "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\-\\_]+$": { + "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, From 9f9e56b664674487e126a27ee5cf480b25702dee Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:06:57 +0100 Subject: [PATCH 7/8] Update bindings/mqtt/0.2.0/operation.json --- bindings/mqtt/0.2.0/operation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/mqtt/0.2.0/operation.json b/bindings/mqtt/0.2.0/operation.json index 63dcc966..ab526cc4 100644 --- a/bindings/mqtt/0.2.0/operation.json +++ b/bindings/mqtt/0.2.0/operation.json @@ -6,7 +6,7 @@ "type": "object", "additionalProperties": false, "patternProperties": { - "^x-[\\w\\d\\.\\-\\_]+$": { + "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, From 0487f176da9e9a86b50eefafd51b6041f9661236 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 4 Dec 2023 22:52:01 +0100 Subject: [PATCH 8/8] use http --- bindings/mqtt/0.2.0/message.json | 6 +++--- bindings/mqtt/0.2.0/operation.json | 4 ++-- bindings/mqtt/0.2.0/server.json | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bindings/mqtt/0.2.0/message.json b/bindings/mqtt/0.2.0/message.json index 76959bcc..2374d341 100644 --- a/bindings/mqtt/0.2.0/message.json +++ b/bindings/mqtt/0.2.0/message.json @@ -20,10 +20,10 @@ "correlationData": { "oneOf": [ { - "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ], "description": "Correlation Data is used by the sender of the request message to identify which request the response message is for when it is received." @@ -43,7 +43,7 @@ "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ], "description": "The topic (channel URI) to be used for a response message." diff --git a/bindings/mqtt/0.2.0/operation.json b/bindings/mqtt/0.2.0/operation.json index ab526cc4..1e058dde 100644 --- a/bindings/mqtt/0.2.0/operation.json +++ b/bindings/mqtt/0.2.0/operation.json @@ -28,10 +28,10 @@ "maximum": 4294967295 }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ], "description": "Lifetime of the message in seconds" diff --git a/bindings/mqtt/0.2.0/server.json b/bindings/mqtt/0.2.0/server.json index 28f8d800..47c93674 100644 --- a/bindings/mqtt/0.2.0/server.json +++ b/bindings/mqtt/0.2.0/server.json @@ -54,10 +54,10 @@ "minimum": 0 }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ], "description": "Interval time in seconds or a Schema Object containing the definition of the interval. The broker maintains a session for a disconnected client until this interval expires." @@ -70,10 +70,10 @@ "maximum": 4294967295 }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/schema.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { - "$ref": "https://asyncapi.com/definitions/3.0.0/Reference.json" + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ], "description": "Number of bytes or a Schema Object representing the Maximum Packet Size the Client is willing to accept."