From 290bbf5153d7938810432f755e394225886df78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Urba=C5=84czyk?= Date: Tue, 7 Feb 2023 17:16:45 +0100 Subject: [PATCH] feat: add reusable tags and externalDocs objects (#245) --- definitions/3.0.0/asyncapi.json | 10 ---------- definitions/3.0.0/channel.json | 24 +++++++++++++++++++----- definitions/3.0.0/components.json | 26 ++++++++++++++++++++++++++ definitions/3.0.0/info.json | 18 ++++++++++++++++-- definitions/3.0.0/message.json | 18 ++++++++++++++++-- definitions/3.0.0/messageTrait.json | 18 ++++++++++++++++-- definitions/3.0.0/operation.json | 18 ++++++++++++++++-- definitions/3.0.0/schema.json | 9 ++++++++- definitions/3.0.0/server.json | 24 ++++++++++++++++++++++++ definitions/3.0.0/tag.json | 9 ++++++++- 10 files changed, 149 insertions(+), 25 deletions(-) diff --git a/definitions/3.0.0/asyncapi.json b/definitions/3.0.0/asyncapi.json index 4042edfc..0157a6dd 100644 --- a/definitions/3.0.0/asyncapi.json +++ b/definitions/3.0.0/asyncapi.json @@ -43,16 +43,6 @@ }, "components": { "$ref": "http://asyncapi.com/definitions/3.0.0/components.json" - }, - "tags": { - "type": "array", - "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" } } } \ No newline at end of file diff --git a/definitions/3.0.0/channel.json b/definitions/3.0.0/channel.json index 17d9d9d1..22a3c4b6 100644 --- a/definitions/3.0.0/channel.json +++ b/definitions/3.0.0/channel.json @@ -37,18 +37,32 @@ }, "uniqueItems": true }, - "bindings": { - "$ref": "http://asyncapi.com/definitions/3.0.0/channelBindingsObject.json" - }, "tags": { "type": "array", "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] }, "uniqueItems": true }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] + }, + "bindings": { + "$ref": "http://asyncapi.com/definitions/3.0.0/channelBindingsObject.json" } }, "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/definitions/3.0.0/components.json b/definitions/3.0.0/components.json index fd2df606..f7c7a7d1 100644 --- a/definitions/3.0.0/components.json +++ b/definitions/3.0.0/components.json @@ -91,6 +91,32 @@ "additionalProperties": { "$ref": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json" } + }, + "tags": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] + } + }, + "externalDocs": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] + } } }, "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/definitions/3.0.0/info.json b/definitions/3.0.0/info.json index b3f3d877..bf8c1491 100644 --- a/definitions/3.0.0/info.json +++ b/definitions/3.0.0/info.json @@ -38,12 +38,26 @@ "tags": { "type": "array", "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] }, "uniqueItems": true }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] } }, "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/definitions/3.0.0/message.json b/definitions/3.0.0/message.json index 2cefb300..26bdb168 100644 --- a/definitions/3.0.0/message.json +++ b/definitions/3.0.0/message.json @@ -66,7 +66,14 @@ "tags": { "type": "array", "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] }, "uniqueItems": true }, @@ -87,7 +94,14 @@ "description": "A longer description of the message. CommonMark is allowed." }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] }, "deprecated": { "type": "boolean", diff --git a/definitions/3.0.0/messageTrait.json b/definitions/3.0.0/messageTrait.json index 5dbc42e2..b6d33df4 100644 --- a/definitions/3.0.0/messageTrait.json +++ b/definitions/3.0.0/messageTrait.json @@ -43,7 +43,14 @@ "tags": { "type": "array", "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] }, "uniqueItems": true }, @@ -64,7 +71,14 @@ "description": "A longer description of the message. CommonMark is allowed." }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] }, "deprecated": { "type": "boolean", diff --git a/definitions/3.0.0/operation.json b/definitions/3.0.0/operation.json index a8d00ad2..aead26de 100644 --- a/definitions/3.0.0/operation.json +++ b/definitions/3.0.0/operation.json @@ -69,12 +69,26 @@ "tags": { "type": "array", "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] }, "uniqueItems": true }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] }, "bindings": { "$ref": "http://asyncapi.com/definitions/3.0.0/operationBindingsObject.json" diff --git a/definitions/3.0.0/schema.json b/definitions/3.0.0/schema.json index c5770a09..7f08ab44 100644 --- a/definitions/3.0.0/schema.json +++ b/definitions/3.0.0/schema.json @@ -84,7 +84,14 @@ "type": "string" }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] }, "deprecated": { "type": "boolean", diff --git a/definitions/3.0.0/server.json b/definitions/3.0.0/server.json index 5da34f82..934a7b5d 100644 --- a/definitions/3.0.0/server.json +++ b/definitions/3.0.0/server.json @@ -40,6 +40,30 @@ "security": { "$ref": "http://asyncapi.com/definitions/3.0.0/securityRequirements.json" }, + "tags": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/tag.json" + } + ] + }, + "uniqueItems": true + }, + "externalDocs": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] + }, "bindings": { "$ref": "http://asyncapi.com/definitions/3.0.0/serverBindingsObject.json" } diff --git a/definitions/3.0.0/tag.json b/definitions/3.0.0/tag.json index 32d3413b..135fd63b 100644 --- a/definitions/3.0.0/tag.json +++ b/definitions/3.0.0/tag.json @@ -12,7 +12,14 @@ "type": "string" }, "externalDocs": { - "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json" + } + ] } }, "patternProperties": {