From 039652401db6890b778f0e259aa45a4edf9445ef Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 11 Mar 2024 01:30:31 +0400 Subject: [PATCH 01/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a a json schema Change allOf to anyOf in multiFormatSchema https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- schemas/3.0.0-without-$id.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 87306fe9..2df4fb69 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2702,7 +2702,7 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "allOf": [ + "anyOf": [ { "if": { "not": { From 8af32beb15741ee9b5066c94df4a1ccee62b6f7a Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 11 Mar 2024 02:02:19 +0400 Subject: [PATCH 02/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a a json schema Fix missing queue definition for SQS channel binding https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- schemas/3.0.0-without-$id.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 2df4fb69..19ad0158 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -5617,7 +5617,7 @@ "properties": { "queue": { "description": "A definition of the queue that will be used as the channel.", - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/queue" }, "deadLetterQueue": { "description": "A definition of the queue that will be used for un-processable messages.", From 518e3e0dcd4962b4c3aedf8fdb1465d6206a0225 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 11 Mar 2024 21:55:48 +0400 Subject: [PATCH 03/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a a json schema - Revert changes from auto generated schema - Change allOf to anyOf in multiFormatSchema https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/multiFormatSchema.json | 2 +- schemas/3.0.0-without-$id.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json index d4047bb0..de3d027b 100644 --- a/definitions/3.0.0/multiFormatSchema.json +++ b/definitions/3.0.0/multiFormatSchema.json @@ -54,7 +54,7 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "allOf": [ + "anyOf": [ { "if": { "not": { diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 19ad0158..87306fe9 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2702,7 +2702,7 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "anyOf": [ + "allOf": [ { "if": { "not": { @@ -5617,7 +5617,7 @@ "properties": { "queue": { "description": "A definition of the queue that will be used as the channel.", - "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/queue" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel" }, "deadLetterQueue": { "description": "A definition of the queue that will be used for un-processable messages.", From b5f2139c354ce8d96d1574520b0f7b73806c79c6 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 12 Mar 2024 17:04:52 +0400 Subject: [PATCH 04/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema Include internal definitions from bindings to composed schema https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- .gitignore | 9 ++++++- schemas/3.0.0-without-$id.json | 46 +++++++++++++++++----------------- schemas/3.0.0.json | 2 +- tools/bundler/index.js | 8 +++++- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index d4a20833..1d9bc514 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ node_modules .nyc_output .vscode -coverage \ No newline at end of file +coverage + +.DS_Store +/test/.DS_Store +/examples/.DS_Store +/bindings/.DS_Store +/.git/.DS_Store +/definitions/.DS_Store \ No newline at end of file diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 87306fe9..2c69576d 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2005,7 +2005,7 @@ "properties": { "type": "array", "items": { - "$ref": "#/definitions/bindings-jms-0.0.1-server" + "$ref": "#/definitions/bindings-jms-0.0.1-server/definitions/property" }, "description": "Additional properties to set on the JMS ConnectionFactory implementation for the JMS Provider." }, @@ -2702,7 +2702,7 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "allOf": [ + "anyOf": [ { "if": { "not": { @@ -5472,10 +5472,10 @@ "description": "The name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations." }, "ordering": { - "$ref": "#/definitions/bindings-sns-0.1.0-channel" + "$ref": "#/definitions/bindings-sns-0.1.0-channel/definitions/ordering" }, "policy": { - "$ref": "#/definitions/bindings-sns-0.1.0-channel" + "$ref": "#/definitions/bindings-sns-0.1.0-channel/definitions/policy" }, "tags": { "type": "object", @@ -5530,7 +5530,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this topic", "items": { - "$ref": "#/definitions/bindings-sns-0.1.0-channel" + "$ref": "#/definitions/bindings-sns-0.1.0-channel/definitions/statement" } } }, @@ -5617,11 +5617,11 @@ "properties": { "queue": { "description": "A definition of the queue that will be used as the channel.", - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/queue" }, "deadLetterQueue": { "description": "A definition of the queue that will be used for un-processable messages.", - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/queue" }, "bindingVersion": { "type": "string", @@ -5700,10 +5700,10 @@ "default": 345600 }, "redrivePolicy": { - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/redrivePolicy" }, "policy": { - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/policy" }, "tags": { "type": "object", @@ -5725,7 +5725,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/identifier" }, "maxReceiveCount": { "type": "integer", @@ -5769,7 +5769,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this queue.", "items": { - "$ref": "#/definitions/bindings-sqs-0.2.0-channel" + "$ref": "#/definitions/bindings-sqs-0.2.0-channel/definitions/statement" } } }, @@ -7330,19 +7330,19 @@ }, "properties": { "topic": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation", + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/identifier", "description": "Often we can assume that the SNS Topic is the channel name-we provide this field in case the you need to supply the ARN, or the Topic name is not the channel name in the AsyncAPI document." }, "consumers": { "type": "array", "description": "The protocols that listen to this topic and their endpoints.", "items": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation" + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/consumer" }, "minItems": 1 }, "deliveryPolicy": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation", + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/deliveryPolicy", "description": "Policy for retries to HTTP. The field is the default for HTTP receivers of the SNS Topic which may be overridden by a specific consumer." }, "bindingVersion": { @@ -7410,7 +7410,7 @@ }, "endpoint": { "description": "The endpoint messages are delivered to.", - "$ref": "#/definitions/bindings-sns-0.1.0-operation" + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/identifier" }, "filterPolicy": { "type": "object", @@ -7451,10 +7451,10 @@ "description": "If true AWS SNS attributes are removed from the body, and for SQS, SNS message attributes are copied to SQS message attributes. If false the SNS attributes are included in the body." }, "redrivePolicy": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation" + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/redrivePolicy" }, "deliveryPolicy": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation", + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/deliveryPolicy", "description": "Policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic." }, "displayName": { @@ -7526,7 +7526,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "#/definitions/bindings-sns-0.1.0-operation", + "$ref": "#/definitions/bindings-sns-0.1.0-operation/definitions/identifier", "description": "The SQS queue to use as a dead letter queue (DLQ)." }, "maxReceiveCount": { @@ -7604,7 +7604,7 @@ "type": "array", "description": "Queue objects that are either the endpoint for an SNS Operation Binding Object, or the deadLetterQueue of the SQS Operation Binding Object.", "items": { - "$ref": "#/definitions/bindings-sqs-0.2.0-operation" + "$ref": "#/definitions/bindings-sqs-0.2.0-operation/definitions/queue" } }, "bindingVersion": { @@ -7688,10 +7688,10 @@ "default": 345600 }, "redrivePolicy": { - "$ref": "#/definitions/bindings-sqs-0.2.0-operation" + "$ref": "#/definitions/bindings-sqs-0.2.0-operation/definitions/redrivePolicy" }, "policy": { - "$ref": "#/definitions/bindings-sqs-0.2.0-operation" + "$ref": "#/definitions/bindings-sqs-0.2.0-operation/definitions/policy" }, "tags": { "type": "object", @@ -7712,7 +7712,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "#/definitions/bindings-sqs-0.2.0-operation" + "$ref": "#/definitions/bindings-sqs-0.2.0-operation/definitions/identifier" }, "maxReceiveCount": { "type": "integer", @@ -7756,7 +7756,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this queue.", "items": { - "$ref": "#/definitions/bindings-sqs-0.2.0-operation" + "$ref": "#/definitions/bindings-sqs-0.2.0-operation/definitions/statement" } } }, diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 22f2f2c8..97d236f7 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2752,7 +2752,7 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "allOf": [ + "anyOf": [ { "if": { "not": { diff --git a/tools/bundler/index.js b/tools/bundler/index.js index c405b2e4..d8729ad0 100644 --- a/tools/bundler/index.js +++ b/tools/bundler/index.js @@ -165,7 +165,13 @@ function getDefinitionName(def) { } if (def.startsWith('http://asyncapi.com/bindings')) { const result = bindingsRegex.exec(def); - if (result) return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}`; + if (result) { + if (result[4] === '') { + return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}`; + } else { + return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}/${result[4].replace('#/', '')}`; + } + } } return path.basename(def, '.json'); From 87a6097a33bb289bdc94764d986ce870ce7ca290 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 12 Mar 2024 17:12:34 +0400 Subject: [PATCH 05/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema fix linter issue https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- tools/bundler/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bundler/index.js b/tools/bundler/index.js index d8729ad0..b9b9d9e0 100644 --- a/tools/bundler/index.js +++ b/tools/bundler/index.js @@ -168,9 +168,9 @@ function getDefinitionName(def) { if (result) { if (result[4] === '') { return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}`; - } else { - return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}/${result[4].replace('#/', '')}`; } + + return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}/${result[4].replace('#/', '')}`; } } From 981c80d2209d674f901dc1f4843ea0cbfe700f0b Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 12 Mar 2024 17:21:13 +0400 Subject: [PATCH 06/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema Add clarification comment for fix https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- tools/bundler/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/bundler/index.js b/tools/bundler/index.js index b9b9d9e0..3596c8b3 100644 --- a/tools/bundler/index.js +++ b/tools/bundler/index.js @@ -166,6 +166,16 @@ function getDefinitionName(def) { if (def.startsWith('http://asyncapi.com/bindings')) { const result = bindingsRegex.exec(def); if (result) { + /* + 4th element is for internal definitions like http://asyncapi.com/bindings/jms/0.0.1/server.json#/definitions/property + + When is empty, we can ignore it: + convert this: http://asyncapi.com/bindings/jms/0.0.1/server.json + to this: bindings-jms-0.0.1-server + Otherwise we MUST add it to not broke Json Schema validation: + convert this: http://asyncapi.com/bindings/jms/0.0.1/server.json#/definitions/property + to this: bindings-jms-0.0.1-server/definitions/property + */ if (result[4] === '') { return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}`; } From b573b540ca43eec5bb3340de0024c61e5614f0f3 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 19 Mar 2024 17:18:49 +0400 Subject: [PATCH 07/17] Update .gitignore Co-authored-by: Sergio Moya <1083296+smoya@users.noreply.github.com> --- .gitignore | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 1d9bc514..fc668545 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,4 @@ node_modules .vscode coverage -.DS_Store -/test/.DS_Store -/examples/.DS_Store -/bindings/.DS_Store -/.git/.DS_Store -/definitions/.DS_Store \ No newline at end of file +.DS_Store \ No newline at end of file From 62c51936f5bf4c303eda23446b94add396977b7c Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 19 Mar 2024 21:48:03 +0400 Subject: [PATCH 08/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/multiFormatSchema.json | 251 +++++++++------------ schemas/3.0.0-without-$id.json | 273 +++++++++++------------ schemas/3.0.0.json | 273 +++++++++++------------ 3 files changed, 368 insertions(+), 429 deletions(-) diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json index de3d027b..ee96b828 100644 --- a/definitions/3.0.0/multiFormatSchema.json +++ b/definitions/3.0.0/multiFormatSchema.json @@ -54,169 +54,134 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "anyOf": [ + "oneOf": [ { - "if": { - "not": { - "description": "If no schemaFormat has been defined, default to schema or reference", - "required": [ - "schemaFormat" - ] - } + "type": "object", + "not": { + "required": ["schemaFormat"] }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] - } + "required": ["$ref"], + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } }, { - "if": { - "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] - } + "type": "object", + "required": ["schemaFormat"], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://json-schema.org/draft-07/schema" - } - ] - } + "type": "object", + "required": ["schemaFormat"], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + }, + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - } + "type": "object", + "required": ["schemaFormat"], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - } - ] - } + } + }, + { + "type": "object", + "required": ["schemaFormat", "schema"], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - } + "type": "object", + "required": ["schemaFormat"], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - } - ] - } + } + }, + { + "type": "object", + "required": ["schemaFormat", "schema"], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } } diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index ea001316..b2220e0e 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2752,169 +2752,156 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "anyOf": [ + "oneOf": [ { - "if": { - "not": { - "description": "If no schemaFormat has been defined, default to schema or reference", - "required": [ - "schemaFormat" - ] - } + "type": "object", + "not": { + "required": [ + "schemaFormat" + ] }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/schema" - } - ] - } + "required": [ + "$ref" + ], + "properties": { + "schema": { + "$ref": "#/definitions/Reference" } } }, { - "if": { - "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/schema" - } - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "#/definitions/schema" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/json-schema-draft-07-schema" - } - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + }, + "schema": { + "$ref": "#/definitions/json-schema-draft-07-schema" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "#/definitions/openapiSchema_3_0" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/openapiSchema_3_0" - } - ] - } + } + }, + { + "type": "object", + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "required": [ + "$ref" + ], + "$ref": "#/definitions/Reference" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "$ref": "#/definitions/avroSchema_v1" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/avroSchema_v1" - } - ] - } + } + }, + { + "type": "object", + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "required": [ + "$ref" + ], + "$ref": "#/definitions/Reference" } } } diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index ac7e7aab..5b83c4e3 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2803,169 +2803,156 @@ "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." } }, - "anyOf": [ + "oneOf": [ { - "if": { - "not": { - "description": "If no schemaFormat has been defined, default to schema or reference", - "required": [ - "schemaFormat" - ] - } + "type": "object", + "not": { + "required": [ + "schemaFormat" + ] }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] - } + "required": [ + "$ref" + ], + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } }, { - "if": { - "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - } - } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://json-schema.org/draft-07/schema" - } - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + }, + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - } - ] - } + } + }, + { + "type": "object", + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "required": [ + "$ref" + ], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } }, { - "if": { - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - } + "type": "object", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" } - }, - "then": { - "properties": { - "schema": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - } - ] - } + } + }, + { + "type": "object", + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "required": [ + "$ref" + ], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } } From 297e77827da493851ac551ea153e0e067447f324 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Wed, 20 Mar 2024 01:54:15 +0400 Subject: [PATCH 09/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/multiFormatSchema.json | 2 ++ schemas/3.0.0-without-$id.json | 10 ++++++++++ schemas/3.0.0.json | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json index ee96b828..0a5a8051 100644 --- a/definitions/3.0.0/multiFormatSchema.json +++ b/definitions/3.0.0/multiFormatSchema.json @@ -131,6 +131,7 @@ ] }, "schema": { + "not": {"required": ["$ref"]}, "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" } } @@ -164,6 +165,7 @@ ] }, "schema": { + "not": {"required": ["$ref"]}, "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" } } diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index b2220e0e..5769341d 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2839,6 +2839,11 @@ ] }, "schema": { + "not": { + "required": [ + "$ref" + ] + }, "$ref": "#/definitions/openapiSchema_3_0" } } @@ -2879,6 +2884,11 @@ ] }, "schema": { + "not": { + "required": [ + "$ref" + ] + }, "$ref": "#/definitions/avroSchema_v1" } } diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 5b83c4e3..915cc614 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2890,6 +2890,11 @@ ] }, "schema": { + "not": { + "required": [ + "$ref" + ] + }, "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" } } @@ -2930,6 +2935,11 @@ ] }, "schema": { + "not": { + "required": [ + "$ref" + ] + }, "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" } } From dddb3d37958210c753eb98873830be01f6bbc78b Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 22 Mar 2024 14:50:05 +0400 Subject: [PATCH 10/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/anySchema.json | 138 +++- definitions/3.0.0/multiFormatSchema.json | 194 ----- schemas/3.0.0-without-$id.json | 940 +++++++++++----------- schemas/3.0.0.json | 945 +++++++++++------------ 4 files changed, 999 insertions(+), 1218 deletions(-) delete mode 100644 definitions/3.0.0/multiFormatSchema.json diff --git a/definitions/3.0.0/anySchema.json b/definitions/3.0.0/anySchema.json index 4a0bf239..0a7d387d 100644 --- a/definitions/3.0.0/anySchema.json +++ b/definitions/3.0.0/anySchema.json @@ -1,16 +1,132 @@ { - "if": { - "required": [ - "schema" - ] - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" - }, - "else": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", + "type": "object", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": { + "required": ["schemaFormat", "schema"] + }, + "additionalProperties": false, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "type": "object", + "description": "Multi format schema: Avro Schema", + "required": ["schemaFormat", "schema"], + "not": {"required": ["$ref"]}, + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "if": { + "not": {"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"} + }, + "then": { + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" + }, + "else": { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + } + } + }, + { + "type": "object", + "description": "Multi format schema: OpenAPI Schema", + "required": ["schemaFormat", "schema"], + "not": {"required": ["$ref"]}, + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "anyOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi format schema: Json Schema", + "required": ["schemaFormat", "schema"], + "not": {"required": ["$ref"]}, + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + }, + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" + } + } + }, + { + "type": "object", + "description": "Multi format schema: AsyncAPI Schema", + "required": ["schemaFormat", "schema"], + "not": {"required": ["$ref"]}, + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + ], "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json" } diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json deleted file mode 100644 index 0a5a8051..00000000 --- a/definitions/3.0.0/multiFormatSchema.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", - "if": { - "not": { - "type": "object" - } - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - "else": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { - "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" - } - }, - "properties": { - "schemaFormat": { - "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", - "anyOf": [ - { - "type": "string" - }, - { - "description": "All the schema formats tooling MUST support", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07", - - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - { - "description": "All the schema formats tools are RECOMMENDED to support", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0", - - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0", - - "application/raml+yaml;version=1.0" - ] - } - ] - }, - "schema": { - "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." - } - }, - "oneOf": [ - { - "type": "object", - "not": { - "required": ["schemaFormat"] - }, - "required": ["$ref"], - "properties": { - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - }, - { - "type": "object", - "required": ["schemaFormat"], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - } - }, - { - "type": "object", - "required": ["schemaFormat"], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - }, - "schema": { - "$ref": "http://json-schema.org/draft-07/schema" - } - } - }, - { - "type": "object", - "required": ["schemaFormat"], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "not": {"required": ["$ref"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - } - } - }, - { - "type": "object", - "required": ["schemaFormat", "schema"], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - }, - { - "type": "object", - "required": ["schemaFormat"], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - }, - "schema": { - "not": {"required": ["$ref"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - } - } - }, - { - "type": "object", - "required": ["schemaFormat", "schema"], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - }, - "schema": { - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - } - ] - }, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" -} \ No newline at end of file diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 5769341d..e9934f15 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2686,550 +2686,194 @@ ] }, "anySchema": { - "if": { - "required": [ - "schema" - ] - }, - "then": { - "$ref": "#/definitions/multiFormatSchema" - }, - "else": { - "$ref": "#/definitions/schema" - }, - "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise." - }, - "multiFormatSchema": { - "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", - "if": { - "not": { - "type": "object" - } - }, - "then": { - "$ref": "#/definitions/schema" - }, - "else": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "schemaFormat": { - "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", - "anyOf": [ - { - "type": "string" - }, - { - "description": "All the schema formats tooling MUST support", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - { - "description": "All the schema formats tools are RECOMMENDED to support", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0", - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0", - "application/raml+yaml;version=1.0" - ] - } + "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", + "type": "object", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": { + "required": [ + "schemaFormat", + "schema" ] }, - "schema": { - "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." - } + "additionalProperties": false, + "$ref": "#/definitions/schema" }, - "oneOf": [ - { - "type": "object", - "not": { - "required": [ - "schemaFormat" - ] - }, + { + "type": "object", + "description": "Multi format schema: Avro Schema", + "required": [ + "schemaFormat", + "schema" + ], + "not": { "required": [ "$ref" - ], - "properties": { - "schema": { - "$ref": "#/definitions/Reference" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "$ref": "#/definitions/schema" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - }, - "schema": { - "$ref": "#/definitions/json-schema-draft-07-schema" - } - } + ] }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "if": { "not": { - "required": [ - "$ref" - ] - }, - "$ref": "#/definitions/openapiSchema_3_0" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "required": [ - "$ref" - ], - "$ref": "#/definitions/Reference" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] + "$ref": "#/definitions/Reference" + } }, - "schema": { - "not": { - "required": [ - "$ref" - ] - }, + "then": { "$ref": "#/definitions/avroSchema_v1" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] }, - "schema": { - "required": [ - "$ref" - ], + "else": { "$ref": "#/definitions/Reference" } } } - ] - } - }, - "openapiSchema_3_0": { - "type": "object", - "definitions": { - "ExternalDocumentation": { + }, + { "type": "object", + "description": "Multi format schema: OpenAPI Schema", "required": [ - "url" + "schemaFormat", + "schema" ], + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, "properties": { - "description": { - "type": "string" - }, - "url": { + "schemaFormat": { "type": "string", - "format": "uri-reference" + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "anyOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/Reference" + } + ] } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false + } }, - "Discriminator": { + { "type": "object", + "description": "Multi format schema: Json Schema", "required": [ - "propertyName" + "schemaFormat", + "schema" ], + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, "properties": { - "propertyName": { - "type": "string" + "schemaFormat": { + "type": "string", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] }, - "mapping": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "schema": { + "$ref": "#/definitions/json-schema-draft-07-schema" } } }, - "Reference": { + { "type": "object", + "description": "Multi format schema: AsyncAPI Schema", "required": [ - "$ref" + "schemaFormat", + "schema" ], - "patternProperties": { - "^\\$ref$": { + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, + "properties": { + "schemaFormat": { "type": "string", - "format": "uri-reference" + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "#/definitions/schema" } } + } + ] + }, + "avroSchema_v1": { + "definitions": { + "avroSchema": { + "title": "Avro Schema", + "description": "Root Schema", + "oneOf": [ + { + "$ref": "#/definitions/avroSchema_v1/definitions/types" + } + ] }, - "XML": { - "type": "object", - "properties": { - "name": { - "type": "string" + "types": { + "title": "Avro Types", + "description": "Allowed Avro types", + "oneOf": [ + { + "$ref": "#/definitions/avroSchema_v1/definitions/primitiveType" }, - "namespace": { - "type": "string", - "format": "uri" + { + "$ref": "#/definitions/avroSchema_v1/definitions/primitiveTypeWithMetadata" }, - "prefix": { - "type": "string" + { + "$ref": "#/definitions/avroSchema_v1/definitions/customTypeReference" }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - } - }, - "properties": { - "title": { - "type": "string" - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { - "type": "integer", - "minimum": 0 - }, - "minLength": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": { - "type": "integer", - "minimum": 0 - }, - "minItems": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { - "type": "integer", - "minimum": 0 - }, - "minProperties": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "uniqueItems": true - }, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": false - }, - "type": { - "type": "string", - "enum": [ - "array", - "boolean", - "integer", - "number", - "object", - "string" - ] - }, - "not": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - }, - "allOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "oneOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "anyOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - }, - { - "type": "boolean" - } - ], - "default": true - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - }, - "default": true, - "nullable": { - "type": "boolean", - "default": false - }, - "discriminator": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Discriminator" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "example": true, - "externalDocs": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/ExternalDocumentation" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/XML" - } - }, - "patternProperties": { - "^x-": true - }, - "additionalProperties": false - }, - "avroSchema_v1": { - "definitions": { - "avroSchema": { - "title": "Avro Schema", - "description": "Root Schema", - "oneOf": [ - { - "$ref": "#/definitions/avroSchema_v1/definitions/types" - } - ] - }, - "types": { - "title": "Avro Types", - "description": "Allowed Avro types", - "oneOf": [ - { - "$ref": "#/definitions/avroSchema_v1/definitions/primitiveType" - }, - { - "$ref": "#/definitions/avroSchema_v1/definitions/primitiveTypeWithMetadata" - }, - { - "$ref": "#/definitions/avroSchema_v1/definitions/customTypeReference" - }, - { - "$ref": "#/definitions/avroSchema_v1/definitions/avroRecord" + { + "$ref": "#/definitions/avroSchema_v1/definitions/avroRecord" }, { "$ref": "#/definitions/avroSchema_v1/definitions/avroEnum" @@ -3519,6 +3163,292 @@ ], "title": "Avro Schema Definition" }, + "openapiSchema_3_0": { + "type": "object", + "definitions": { + "ExternalDocumentation": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri-reference" + } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false + }, + "Discriminator": { + "type": "object", + "required": [ + "propertyName" + ], + "properties": { + "propertyName": { + "type": "string" + }, + "mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "Reference": { + "type": "object", + "required": [ + "$ref" + ], + "patternProperties": { + "^\\$ref$": { + "type": "string", + "format": "uri-reference" + } + } + }, + "XML": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string", + "format": "uri" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false + } + }, + "properties": { + "title": { + "type": "string" + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { + "type": "integer", + "minimum": 0 + }, + "minLength": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { + "type": "integer", + "minimum": 0 + }, + "minItems": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { + "type": "integer", + "minimum": 0 + }, + "minProperties": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "required": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": false + }, + "type": { + "type": "string", + "enum": [ + "array", + "boolean", + "integer", + "number", + "object", + "string" + ] + }, + "not": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + }, + "allOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "oneOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "anyOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + }, + "properties": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + }, + { + "type": "boolean" + } + ], + "default": true + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "default": true, + "nullable": { + "type": "boolean", + "default": false + }, + "discriminator": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Discriminator" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "example": true, + "externalDocs": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/ExternalDocumentation" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/XML" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + }, "correlationId": { "type": "object", "description": "An object that specifies an identifier at design time that can used for message tracing and correlation.", diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 915cc614..7a0de46b 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2736,553 +2736,195 @@ }, "http://asyncapi.com/definitions/3.0.0/anySchema.json": { "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json", - "if": { - "required": [ - "schema" - ] - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" - }, - "else": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise." - }, - "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json": { - "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", - "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", - "if": { - "not": { - "type": "object" - } - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - "else": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-[\\w\\d\\.\\x2d_]+$": { - "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" - } - }, - "properties": { - "schemaFormat": { - "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", - "anyOf": [ - { - "type": "string" - }, - { - "description": "All the schema formats tooling MUST support", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - { - "description": "All the schema formats tools are RECOMMENDED to support", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0", - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0", - "application/raml+yaml;version=1.0" - ] - } + "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", + "type": "object", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": { + "required": [ + "schemaFormat", + "schema" ] }, - "schema": { - "description": "Definition of the message payload. It can be of any type but defaults to Schema Object. It MUST match the schema format defined in schemaFormat, including the encoding type. E.g., Avro should be inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based schemas (e.g., Protobuf or XSD) MUST be inlined as a string." - } + "additionalProperties": false, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, - "oneOf": [ - { - "type": "object", - "not": { - "required": [ - "schemaFormat" - ] - }, + { + "type": "object", + "description": "Multi format schema: Avro Schema", + "required": [ + "schemaFormat", + "schema" + ], + "not": { "required": [ "$ref" - ], - "properties": { - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - }, - "schema": { - "$ref": "http://json-schema.org/draft-07/schema" - } - } + ] }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { + "additionalProperties": false, + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "if": { "not": { - "required": [ - "$ref" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "required": [ - "$ref" - ], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } }, - "schema": { - "not": { - "required": [ - "$ref" - ] - }, + "then": { "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - } - } - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] }, - "schema": { - "required": [ - "$ref" - ], + "else": { "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } } } - ] - } - }, - "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json": { - "$id": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json", - "type": "object", - "definitions": { - "ExternalDocumentation": { + }, + { "type": "object", + "description": "Multi format schema: OpenAPI Schema", "required": [ - "url" + "schemaFormat", + "schema" ], + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, "properties": { - "description": { - "type": "string" - }, - "url": { + "schemaFormat": { "type": "string", - "format": "uri-reference" + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "anyOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false + } }, - "Discriminator": { + { "type": "object", + "description": "Multi format schema: Json Schema", "required": [ - "propertyName" + "schemaFormat", + "schema" ], + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, "properties": { - "propertyName": { - "type": "string" + "schemaFormat": { + "type": "string", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] }, - "mapping": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" } } }, - "Reference": { + { "type": "object", + "description": "Multi format schema: AsyncAPI Schema", "required": [ - "$ref" + "schemaFormat", + "schema" ], - "patternProperties": { - "^\\$ref$": { + "not": { + "required": [ + "$ref" + ] + }, + "additionalProperties": false, + "properties": { + "schemaFormat": { "type": "string", - "format": "uri-reference" + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } } + } + ] + }, + "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json", + "definitions": { + "avroSchema": { + "title": "Avro Schema", + "description": "Root Schema", + "oneOf": [ + { + "$ref": "#/definitions/types" + } + ] }, - "XML": { - "type": "object", - "properties": { - "name": { - "type": "string" + "types": { + "title": "Avro Types", + "description": "Allowed Avro types", + "oneOf": [ + { + "$ref": "#/definitions/primitiveType" }, - "namespace": { - "type": "string", - "format": "uri" + { + "$ref": "#/definitions/primitiveTypeWithMetadata" }, - "prefix": { - "type": "string" + { + "$ref": "#/definitions/customTypeReference" }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - } - }, - "properties": { - "title": { - "type": "string" - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { - "type": "integer", - "minimum": 0 - }, - "minLength": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": { - "type": "integer", - "minimum": 0 - }, - "minItems": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { - "type": "integer", - "minimum": 0 - }, - "minProperties": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "uniqueItems": true - }, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": false - }, - "type": { - "type": "string", - "enum": [ - "array", - "boolean", - "integer", - "number", - "object", - "string" - ] - }, - "not": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - }, - "allOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "oneOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "anyOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - }, - { - "type": "boolean" - } - ], - "default": true - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - }, - "default": true, - "nullable": { - "type": "boolean", - "default": false - }, - "discriminator": { - "$ref": "#/definitions/Discriminator" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "example": true, - "externalDocs": { - "$ref": "#/definitions/ExternalDocumentation" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/XML" - } - }, - "patternProperties": { - "^x-": true - }, - "additionalProperties": false - }, - "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json": { - "$id": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json", - "definitions": { - "avroSchema": { - "title": "Avro Schema", - "description": "Root Schema", - "oneOf": [ - { - "$ref": "#/definitions/types" - } - ] - }, - "types": { - "title": "Avro Types", - "description": "Allowed Avro types", - "oneOf": [ - { - "$ref": "#/definitions/primitiveType" - }, - { - "$ref": "#/definitions/primitiveTypeWithMetadata" - }, - { - "$ref": "#/definitions/customTypeReference" - }, - { - "$ref": "#/definitions/avroRecord" + { + "$ref": "#/definitions/avroRecord" }, { "$ref": "#/definitions/avroEnum" @@ -3572,6 +3214,293 @@ ], "title": "Avro Schema Definition" }, + "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json", + "type": "object", + "definitions": { + "ExternalDocumentation": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri-reference" + } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false + }, + "Discriminator": { + "type": "object", + "required": [ + "propertyName" + ], + "properties": { + "propertyName": { + "type": "string" + }, + "mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "Reference": { + "type": "object", + "required": [ + "$ref" + ], + "patternProperties": { + "^\\$ref$": { + "type": "string", + "format": "uri-reference" + } + } + }, + "XML": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string", + "format": "uri" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false + } + }, + "properties": { + "title": { + "type": "string" + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { + "type": "integer", + "minimum": 0 + }, + "minLength": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { + "type": "integer", + "minimum": 0 + }, + "minItems": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { + "type": "integer", + "minimum": 0 + }, + "minProperties": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "required": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": false + }, + "type": { + "type": "string", + "enum": [ + "array", + "boolean", + "integer", + "number", + "object", + "string" + ] + }, + "not": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + }, + "allOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "oneOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "anyOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + }, + "properties": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + }, + { + "type": "boolean" + } + ], + "default": true + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "default": true, + "nullable": { + "type": "boolean", + "default": false + }, + "discriminator": { + "$ref": "#/definitions/Discriminator" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "example": true, + "externalDocs": { + "$ref": "#/definitions/ExternalDocumentation" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/XML" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + }, "http://asyncapi.com/definitions/3.0.0/correlationId.json": { "$id": "http://asyncapi.com/definitions/3.0.0/correlationId.json", "type": "object", From a4c5ef0776b5c34d2f3f6e76edbb146367d802f2 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 25 Mar 2024 18:11:09 +0400 Subject: [PATCH 11/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- common/avroSchema_v1.json | 21 +- definitions/3.0.0/anySchema.json | 152 ++--- definitions/3.0.0/components.json | 9 +- definitions/3.0.0/multiFormatSchema.json | 236 +++++++ schemas/3.0.0-without-$id.json | 287 +++++++-- schemas/3.0.0.json | 288 +++++++-- test/docs/3.0.0/streetlights-all.json | 687 ++++++++++++++++++++- test/docs/3.0.0/streetlights-asyncapi.json | 126 ++++ test/docs/3.0.0/streetlights-avro.json | 20 +- test/docs/3.0.0/streetlights-json.json | 225 +++++++ test/docs/3.0.0/streetlights-openapi.json | 16 +- test/docs/3.0.0/streetlights-unknown.json | 106 ++++ 12 files changed, 1881 insertions(+), 292 deletions(-) create mode 100644 definitions/3.0.0/multiFormatSchema.json create mode 100644 test/docs/3.0.0/streetlights-asyncapi.json create mode 100644 test/docs/3.0.0/streetlights-json.json create mode 100644 test/docs/3.0.0/streetlights-unknown.json diff --git a/common/avroSchema_v1.json b/common/avroSchema_v1.json index d3448f10..72bc4dae 100644 --- a/common/avroSchema_v1.json +++ b/common/avroSchema_v1.json @@ -70,7 +70,8 @@ }, "required": [ "type" - ] + ], + "additionalProperties": false }, "customTypeReference": { "title": "Custom Type", @@ -122,7 +123,8 @@ "required": [ "name", "type" - ] + ], + "additionalProperties": false }, "avroRecord": { "title": "Record", @@ -159,7 +161,8 @@ "type", "name", "fields" - ] + ], + "additionalProperties": false }, "avroEnum": { "title": "Enum", @@ -196,7 +199,8 @@ "type", "name", "symbols" - ] + ], + "additionalProperties": false }, "avroArray": { "title": "Array", @@ -229,7 +233,8 @@ "required": [ "type", "items" - ] + ], + "additionalProperties": false }, "avroMap": { "title": "Map", @@ -262,7 +267,8 @@ "required": [ "type", "values" - ] + ], + "additionalProperties": false }, "avroFixed": { "title": "Fixed", @@ -296,7 +302,8 @@ "type", "name", "size" - ] + ], + "additionalProperties": false }, "name": { "type": "string", diff --git a/definitions/3.0.0/anySchema.json b/definitions/3.0.0/anySchema.json index 0a7d387d..cc60af06 100644 --- a/definitions/3.0.0/anySchema.json +++ b/definitions/3.0.0/anySchema.json @@ -1,132 +1,50 @@ { - "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", + "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "anyOf": [ - { - "type": "object", - "description": "AsyncAPI Schema", - "not": { - "required": ["schemaFormat", "schema"] - }, - "additionalProperties": false, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "type": "object", - "description": "Multi format schema: Avro Schema", - "required": ["schemaFormat", "schema"], - "not": {"required": ["$ref"]}, - "additionalProperties": false, - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - }, - "schema": { - "if": { - "not": {"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"} - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - }, - "else": { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - } - } + "description": "An object representing either a Reference, a Schema or a Multi Format Schema", + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema format" }, - { + "schema": { "type": "object", - "description": "Multi format schema: OpenAPI Schema", - "required": ["schemaFormat", "schema"], - "not": {"required": ["$ref"]}, - "additionalProperties": false, - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "anyOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] - } - } + "description": "Schema definition" }, + "$ref": { + "type": "string", + "description": "Reference to schema" + } + }, + "minProperties": 1, + "oneOf": [ { - "type": "object", - "description": "Multi format schema: Json Schema", - "required": ["schemaFormat", "schema"], - "not": {"required": ["$ref"]}, - "additionalProperties": false, - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] + "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", + "not": {"required": ["schemaFormat", "schema"]}, + "anyOf": [ + { + "type": "object", + "required": ["$ref"], + "not": {"required": ["schemaFormat", "schema"]}, + "minProperties": 1, + "maxProperties": 1, + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" }, - "schema": { - "$ref": "http://json-schema.org/draft-07/schema" + { + "type": "object", + "not": {"required": ["schemaFormat", "schema"]}, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } - } + ] }, { "type": "object", - "description": "Multi format schema: AsyncAPI Schema", "required": ["schemaFormat", "schema"], "not": {"required": ["$ref"]}, - "additionalProperties": false, - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - } + "minProperties": 2, + "maxProperties": 2, + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" } - ], - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json" + ] } diff --git a/definitions/3.0.0/components.json b/definitions/3.0.0/components.json index 2d7b5e2f..2243d978 100644 --- a/definitions/3.0.0/components.json +++ b/definitions/3.0.0/components.json @@ -13,14 +13,7 @@ "description": "An object to hold reusable Schema Object. If this is a Schema Object, then the schemaFormat will be assumed to be 'application/vnd.aai.asyncapi+json;version=asyncapi' where the version is equal to the AsyncAPI Version String.", "patternProperties": { "^[\\w\\d\\.\\-_]+$": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/anySchema.json" - } - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/anySchema.json" } } }, diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json new file mode 100644 index 00000000..dd03f474 --- /dev/null +++ b/definitions/3.0.0/multiFormatSchema.json @@ -0,0 +1,236 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", + "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "required": ["schemaFormat", "schema"], + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema formats" + }, + "schema": { + "type": "object", + "description": "Schema definition" + } + }, + "minProperties": 2, + "maxProperties": 2, + "oneOf": [ + { + "type": "object", + "description": "Multi Format Schema: Avro Schema or Reference", + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + }, + "schema": { + "oneOf": [ + { + "type": "object", + "description": "Avro Schema", + "not": {"required": ["$ref"]}, + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" + }, + { + "type": "object", + "description": "Reference to Avro Schema", + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: OpenAPI Schema or Reference", + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + }, + "schema": { + "oneOf": [ + { + "type": "object", + "description": "OpenAPI Schema", + "not": {"required": ["$ref"]}, + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" + }, + { + "type": "object", + "description": "Reference to OpenAPI Schema", + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: Json Schema or Reference", + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + }, + "schema": { + "description": "Because of $ref collision in Reference and Json Schema", + "anyOf": [ + { + "type": "object", + "description": "Json Schema", + "not": {"required": ["$ref"]}, + "$ref": "http://json-schema.org/draft-07/schema" + }, + { + "type": "object", + "description": "Reference to Json Schema", + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: AsyncAPI Schema or Reference", + "properties": { + "schemaFormat": { + "type": "string", + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + "schema": { + "description": "Because of $ref collision in Reference and AsyncAPI Schema", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": {"required": ["$ref"]}, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "type": "object", + "description": "Reference to AsyncAPI Schema", + "required": ["$ref"], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", + "properties": { + "schemaFormat": { + "type": "string", + "not": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0", + + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0", + + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + }, + "schema": { + "type": "object", + "description": "AsyncAPI Schema", + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + ] +} \ No newline at end of file diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index e9934f15..574c75ed 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2686,24 +2686,62 @@ ] }, "anySchema": { - "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", "type": "object", - "anyOf": [ - { + "description": "An object representing either a Reference, a Schema or a Multi Format Schema", + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema format" + }, + "schema": { "type": "object", - "description": "AsyncAPI Schema", + "description": "Schema definition" + }, + "$ref": { + "type": "string", + "description": "Reference to schema" + } + }, + "minProperties": 1, + "oneOf": [ + { + "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", "not": { "required": [ "schemaFormat", "schema" ] }, - "additionalProperties": false, - "$ref": "#/definitions/schema" + "anyOf": [ + { + "type": "object", + "required": [ + "$ref" + ], + "not": { + "required": [ + "schemaFormat", + "schema" + ] + }, + "minProperties": 1, + "maxProperties": 1, + "$ref": "#/definitions/Reference" + }, + { + "type": "object", + "not": { + "required": [ + "schemaFormat", + "schema" + ] + }, + "$ref": "#/definitions/schema" + } + ] }, { "type": "object", - "description": "Multi format schema: Avro Schema", "required": [ "schemaFormat", "schema" @@ -2713,7 +2751,41 @@ "$ref" ] }, - "additionalProperties": false, + "minProperties": 2, + "maxProperties": 2, + "$ref": "#/definitions/multiFormatSchema" + } + ] + }, + "multiFormatSchema": { + "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "#/definitions/specificationExtension" + } + }, + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema formats" + }, + "schema": { + "type": "object", + "description": "Schema definition" + } + }, + "minProperties": 2, + "maxProperties": 2, + "oneOf": [ + { + "type": "object", + "description": "Multi Format Schema: Avro Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2724,33 +2796,32 @@ ] }, "schema": { - "if": { - "not": { + "oneOf": [ + { + "type": "object", + "description": "Avro Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "#/definitions/avroSchema_v1" + }, + { + "type": "object", + "description": "Reference to Avro Schema", + "required": [ + "$ref" + ], "$ref": "#/definitions/Reference" } - }, - "then": { - "$ref": "#/definitions/avroSchema_v1" - }, - "else": { - "$ref": "#/definitions/Reference" - } + ] } } }, { "type": "object", - "description": "Multi format schema: OpenAPI Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: OpenAPI Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2761,11 +2832,23 @@ ] }, "schema": { - "anyOf": [ + "oneOf": [ { + "type": "object", + "description": "OpenAPI Schema", + "not": { + "required": [ + "$ref" + ] + }, "$ref": "#/definitions/openapiSchema_3_0" }, { + "type": "object", + "description": "Reference to OpenAPI Schema", + "required": [ + "$ref" + ], "$ref": "#/definitions/Reference" } ] @@ -2774,17 +2857,7 @@ }, { "type": "object", - "description": "Multi format schema: Json Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: Json Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2794,23 +2867,33 @@ ] }, "schema": { - "$ref": "#/definitions/json-schema-draft-07-schema" + "description": "Because of $ref collision in Reference and Json Schema", + "anyOf": [ + { + "type": "object", + "description": "Json Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "#/definitions/json-schema-draft-07-schema" + }, + { + "type": "object", + "description": "Reference to Json Schema", + "required": [ + "$ref" + ], + "$ref": "#/definitions/Reference" + } + ] } } }, { "type": "object", - "description": "Multi format schema: AsyncAPI Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: AsyncAPI Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2842,6 +2925,76 @@ ] }, "schema": { + "description": "Because of $ref collision in Reference and AsyncAPI Schema", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "#/definitions/schema" + }, + { + "type": "object", + "description": "Reference to AsyncAPI Schema", + "required": [ + "$ref" + ], + "$ref": "#/definitions/Reference" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", + "properties": { + "schemaFormat": { + "type": "string", + "not": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0", + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0", + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + }, + "schema": { + "type": "object", + "description": "AsyncAPI Schema", "$ref": "#/definitions/schema" } } @@ -2918,7 +3071,8 @@ }, "required": [ "type" - ] + ], + "additionalProperties": false }, "customTypeReference": { "title": "Custom Type", @@ -2970,7 +3124,8 @@ "required": [ "name", "type" - ] + ], + "additionalProperties": false }, "avroRecord": { "title": "Record", @@ -3007,7 +3162,8 @@ "type", "name", "fields" - ] + ], + "additionalProperties": false }, "avroEnum": { "title": "Enum", @@ -3044,7 +3200,8 @@ "type", "name", "symbols" - ] + ], + "additionalProperties": false }, "avroArray": { "title": "Array", @@ -3077,7 +3234,8 @@ "required": [ "type", "items" - ] + ], + "additionalProperties": false }, "avroMap": { "title": "Map", @@ -3110,7 +3268,8 @@ "required": [ "type", "values" - ] + ], + "additionalProperties": false }, "avroFixed": { "title": "Fixed", @@ -3144,7 +3303,8 @@ "type", "name", "size" - ] + ], + "additionalProperties": false }, "name": { "type": "string", @@ -8441,14 +8601,7 @@ "description": "An object to hold reusable Schema Object. If this is a Schema Object, then the schemaFormat will be assumed to be 'application/vnd.aai.asyncapi+json;version=asyncapi' where the version is equal to the AsyncAPI Version String.", "patternProperties": { "^[\\w\\d\\.\\-_]+$": { - "oneOf": [ - { - "$ref": "#/definitions/Reference" - }, - { - "$ref": "#/definitions/anySchema" - } - ] + "$ref": "#/definitions/anySchema" } } }, diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 7a0de46b..f6da964a 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2736,24 +2736,62 @@ }, "http://asyncapi.com/definitions/3.0.0/anySchema.json": { "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json", - "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", "type": "object", - "anyOf": [ - { + "description": "An object representing either a Reference, a Schema or a Multi Format Schema", + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema format" + }, + "schema": { "type": "object", - "description": "AsyncAPI Schema", + "description": "Schema definition" + }, + "$ref": { + "type": "string", + "description": "Reference to schema" + } + }, + "minProperties": 1, + "oneOf": [ + { + "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", "not": { "required": [ "schemaFormat", "schema" ] }, - "additionalProperties": false, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + "anyOf": [ + { + "type": "object", + "required": [ + "$ref" + ], + "not": { + "required": [ + "schemaFormat", + "schema" + ] + }, + "minProperties": 1, + "maxProperties": 1, + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "type": "object", + "not": { + "required": [ + "schemaFormat", + "schema" + ] + }, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + ] }, { "type": "object", - "description": "Multi format schema: Avro Schema", "required": [ "schemaFormat", "schema" @@ -2763,7 +2801,42 @@ "$ref" ] }, - "additionalProperties": false, + "minProperties": 2, + "maxProperties": 2, + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" + } + ] + }, + "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", + "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "required": [ + "schemaFormat", + "schema" + ], + "properties": { + "schemaFormat": { + "type": "string", + "description": "Supported Schema formats" + }, + "schema": { + "type": "object", + "description": "Schema definition" + } + }, + "minProperties": 2, + "maxProperties": 2, + "oneOf": [ + { + "type": "object", + "description": "Multi Format Schema: Avro Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2774,33 +2847,32 @@ ] }, "schema": { - "if": { - "not": { + "oneOf": [ + { + "type": "object", + "description": "Avro Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" + }, + { + "type": "object", + "description": "Reference to Avro Schema", + "required": [ + "$ref" + ], "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } - }, - "then": { - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - }, - "else": { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } + ] } } }, { "type": "object", - "description": "Multi format schema: OpenAPI Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: OpenAPI Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2811,11 +2883,23 @@ ] }, "schema": { - "anyOf": [ + "oneOf": [ { + "type": "object", + "description": "OpenAPI Schema", + "not": { + "required": [ + "$ref" + ] + }, "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" }, { + "type": "object", + "description": "Reference to OpenAPI Schema", + "required": [ + "$ref" + ], "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" } ] @@ -2824,17 +2908,7 @@ }, { "type": "object", - "description": "Multi format schema: Json Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: Json Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2844,23 +2918,33 @@ ] }, "schema": { - "$ref": "http://json-schema.org/draft-07/schema" + "description": "Because of $ref collision in Reference and Json Schema", + "anyOf": [ + { + "type": "object", + "description": "Json Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "http://json-schema.org/draft-07/schema" + }, + { + "type": "object", + "description": "Reference to Json Schema", + "required": [ + "$ref" + ], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] } } }, { "type": "object", - "description": "Multi format schema: AsyncAPI Schema", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "additionalProperties": false, + "description": "Multi Format Schema: AsyncAPI Schema or Reference", "properties": { "schemaFormat": { "type": "string", @@ -2892,6 +2976,76 @@ ] }, "schema": { + "description": "Because of $ref collision in Reference and AsyncAPI Schema", + "anyOf": [ + { + "type": "object", + "description": "AsyncAPI Schema", + "not": { + "required": [ + "$ref" + ] + }, + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + { + "type": "object", + "description": "Reference to AsyncAPI Schema", + "required": [ + "$ref" + ], + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + } + ] + } + } + }, + { + "type": "object", + "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", + "properties": { + "schemaFormat": { + "type": "string", + "not": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0", + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0", + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + }, + "schema": { + "type": "object", + "description": "AsyncAPI Schema", "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } } @@ -2969,7 +3123,8 @@ }, "required": [ "type" - ] + ], + "additionalProperties": false }, "customTypeReference": { "title": "Custom Type", @@ -3021,7 +3176,8 @@ "required": [ "name", "type" - ] + ], + "additionalProperties": false }, "avroRecord": { "title": "Record", @@ -3058,7 +3214,8 @@ "type", "name", "fields" - ] + ], + "additionalProperties": false }, "avroEnum": { "title": "Enum", @@ -3095,7 +3252,8 @@ "type", "name", "symbols" - ] + ], + "additionalProperties": false }, "avroArray": { "title": "Array", @@ -3128,7 +3286,8 @@ "required": [ "type", "items" - ] + ], + "additionalProperties": false }, "avroMap": { "title": "Map", @@ -3161,7 +3320,8 @@ "required": [ "type", "values" - ] + ], + "additionalProperties": false }, "avroFixed": { "title": "Fixed", @@ -3195,7 +3355,8 @@ "type", "name", "size" - ] + ], + "additionalProperties": false }, "name": { "type": "string", @@ -8542,14 +8703,7 @@ "description": "An object to hold reusable Schema Object. If this is a Schema Object, then the schemaFormat will be assumed to be 'application/vnd.aai.asyncapi+json;version=asyncapi' where the version is equal to the AsyncAPI Version String.", "patternProperties": { "^[\\w\\d\\.\\-_]+$": { - "oneOf": [ - { - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "$ref": "http://asyncapi.com/definitions/3.0.0/anySchema.json" - } - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/anySchema.json" } } }, diff --git a/test/docs/3.0.0/streetlights-all.json b/test/docs/3.0.0/streetlights-all.json index 15b7cdc6..e0e3e781 100644 --- a/test/docs/3.0.0/streetlights-all.json +++ b/test/docs/3.0.0/streetlights-all.json @@ -6,7 +6,53 @@ "description": "This service is in charge of processing user signups" }, "channels": { - "UserSignedUpChannel": { + "AsyncAPI-UserSignedUpChannel": { + "address": "user/signedup/{test_param}", + "parameters": { + "test_param": { + "enum": [ + "test" + ], + "default": "test", + "description": "Just a test description", + "examples": [ + "test" + ], + "location": "$message.payload#", + "x-custom-extension": "test" + } + }, + "messages": { + "AsyncAPI-UserSignedUp": { + "$ref": "#/components/messages/AsyncAPI-UserSignedUp" + } + } + }, + "Avro-UserSignedUpChannel": { + "address": "user/signedup", + "messages": { + "UserSignedUp": { + "$ref": "#/components/messages/Avro-UserSignedUp" + } + } + }, + "Json-UserSignedUpChannel": { + "address": "user/signedup", + "messages": { + "UserSignedUp": { + "$ref": "#/components/messages/Json-UserSignedUp" + } + } + }, + "OpenAPI-UserSignedUpChannel": { + "address": "user/signedup", + "messages": { + "UserSignedUp": { + "$ref": "#/components/messages/OpenAPI-UserSignedUp" + } + } + }, + "Unknown-UserSignedUpChannel": { "address": "user/signedup/{test_param}", "parameters": { "test_param": { @@ -24,16 +70,96 @@ }, "messages": { "UserSignedUp": { - "$ref": "#/components/messages/UserSignedUp" + "$ref": "#/components/messages/Unknown-UserSignedUp" } } } }, "operations": { - "PublishUserSignedUp": { + "AsyncAPI-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/AsyncAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "AsyncAPI-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/AsyncAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Avro-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/Avro-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Avro-PublishUserSignedUpDefaultBinding": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/Avro-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Json-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/Json-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -51,10 +177,90 @@ } } }, - "PublishUserSignedUpDefaultBinding": { + "Json-PublishUserSignedUpDefaultBinding": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/Json-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "OpenAPI-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/OpenAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "OpenAPI-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/OpenAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Unknown-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/Unknown-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Unknown-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/Unknown-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -72,8 +278,85 @@ } }, "components": { + "schemas": { + "Avro-UserSignedUpHeaders": { + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "fields": [ + { + "name": "applicationInstanceId", + "type": "string" + }, + { + "name": "correlationId", + "type": "string" + } + ], + "name": "UserSignedUpHeaders", + "namespace": "com.example.avro", + "type": "record" + } + }, + "Avro-ReferencedSchema": { + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "$ref": "reference-to-some-avro-file.avsc" + } + }, + "Json-UserSignedUpHeaders": { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "type": "object", + "properties": { + "applicationInstanceId": { + "type": "string", + "description": "Application instance Id" + }, + "correlationId": { + "type": "string", + "description": "Correlation Id" + } + } + } + }, + "Json-ReferencedSchema": { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$ref": "reference-to-some-json-schema-file.json" + } + }, + "OpenAPI-ReferencedSchema": { + "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", + "schema": { + "$ref": "reference-to-some-openapi-file.json" + } + } + }, "messages": { - "UserSignedUp": { + "AsyncAPI-UserSignedUp": { + "payload": { + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false + } + } + }, + "AsyncAPI-UserSignedUpV2": { "payload": { "type": "object", "properties": { @@ -86,10 +369,398 @@ "format": "email", "description": "Email of the user" } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false + } + }, + "AsyncAPI-UserSignedUpV3": { + "payload": { + "$ref": "external-schema.json" + } + }, + "Avro-UserSignedUp": { + "headers": { + "$ref": "#/components/schemas/Avro-UserSignedUpHeaders" + }, + "payload": { + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "doc": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!", + "fields": [ + { + "name": "id", + "doc": "System-assigned numeric user ID. Cannot be changed by the user.", + "type": "int" + }, + { + "name": "username", + "doc": "The username chosen by the user. Can be changed by the user.", + "type": "string" + }, + { + "name": "passwordHash", + "doc": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html).", + "type": "string" + }, + { + "name": "signupDate", + "doc": "Timestamp (milliseconds since epoch) when the user signed up", + "type": "long" + }, + { + "name": "emailAddresses", + "doc": "All email addresses on the user's account", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "EmailAddress", + "doc": "Stores details about an email address that a user has associated with their account.", + "fields": [ + { + "name": "address", + "doc": "The email address, e.g. `foo@example.com`", + "type": "string" + }, + { + "name": "verified", + "doc": "true if the user has clicked the link in a confirmation email to this address.", + "type": "boolean", + "default": false + }, + { + "name": "dateAdded", + "doc": "Timestamp (milliseconds since epoch) when the email address was added to the account.", + "type": "long" + }, + { + "name": "dateBounced", + "doc": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces.", + "type": [ + "null", + "long" + ] + } + ] + } + } + }, + { + "name": "twitterAccounts", + "doc": "All Twitter accounts that the user has OAuthed", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "TwitterAccount", + "doc": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.", + "fields": [ + { + "name": "status", + "doc": "Indicator of whether this authorization is currently active, or has been revoked", + "type": { + "type": "enum", + "name": "OAuthStatus", + "doc": "* `PENDING`: the user has started authorizing, but not yet finished\n* `ACTIVE`: the token should work\n* `DENIED`: the user declined the authorization\n* `EXPIRED`: the token used to work, but now it doesn't\n* `REVOKED`: the user has explicitly revoked the token", + "symbols": [ + "PENDING", + "ACTIVE", + "DENIED", + "EXPIRED", + "REVOKED" + ] + } + }, + { + "name": "userId", + "doc": "Twitter's numeric ID for this user", + "type": "long" + }, + { + "name": "screenName", + "doc": "The twitter username for this account (can be changed by the user)", + "type": "string" + }, + { + "name": "oauthToken", + "doc": "The OAuth token for this Twitter account", + "type": "string" + }, + { + "name": "oauthTokenSecret", + "doc": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete.", + "type": [ + "null", + "string" + ] + }, + { + "name": "dateAuthorized", + "doc": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account", + "type": "long" + } + ] + } + } + }, + { + "name": "toDoItems", + "doc": "The top-level items in the user's to-do list", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "ToDoItem", + "doc": "A record is one node in a To-Do item tree (every record can contain nested sub-records).", + "fields": [ + { + "name": "status", + "doc": "User-selected state for this item (e.g. whether or not it is marked as done)", + "type": { + "type": "enum", + "name": "ToDoStatus", + "doc": "* `HIDDEN`: not currently visible, e.g. because it becomes actionable in future\n* `ACTIONABLE`: appears in the current to-do list\n* `DONE`: marked as done, but still appears in the list\n* `ARCHIVED`: marked as done and no longer visible\n* `DELETED`: not done and removed from list (preserved for undo purposes)", + "symbols": [ + "HIDDEN", + "ACTIONABLE", + "DONE", + "ARCHIVED", + "DELETED" + ] + } + }, + { + "name": "title", + "doc": "One-line summary of the item", + "type": "string" + }, + { + "name": "description", + "doc": "Detailed description (may contain HTML markup)", + "type": [ + "null", + "string" + ] + }, + { + "name": "snoozeDate", + "doc": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status", + "type": [ + "null", + "long" + ] + }, + { + "name": "subItems", + "doc": "List of children of this to-do tree node", + "type": { + "type": "array", + "items": "ToDoItem" + } + } + ] + } + } + } + ], + "name": "User", + "namespace": "com.example.avro", + "type": "record" + } + } + }, + "Json-UserSignedUp": { + "headers": { + "$ref": "#/components/schemas/Json-UserSignedUpHeaders" + }, + "payload": { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "type": "object", + "description": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!", + "properties": { + "id": { + "type": "integer", + "description": "System-assigned numeric user ID. Cannot be changed by the user." + }, + "username": { + "type": "string", + "description": "The username chosen by the user. Can be changed by the user." + }, + "passwordHash": { + "type": "string", + "description": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html)." + }, + "signupDate": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the user signed up" + }, + "emailAddresses": { + "type": "array", + "description": "All email addresses on the user's account", + "items": { + "type": "object", + "description": "Stores details about an email address that a user has associated with their account.", + "properties": { + "address": { + "type": "string", + "description": "The email address, e.g. `foo@example.com`" + }, + "verified": { + "type": "boolean", + "description": "true if the user has clicked the link in a confirmation email to this address.", + "default": false + }, + "dateAdded": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the email address was added to the account." + }, + "dateBounced": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces." + } + } + } + }, + "twitterAccounts": { + "type": "array", + "description": "All Twitter accounts that the user has OAuthed", + "items": { + "type": "object", + "description": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.", + "properties": { + "status": { + "type": "string", + "description": "Indicator of whether this authorization is currently active, or has been revoked", + "enum": [ + "PENDING", + "ACTIVE", + "DENIED", + "EXPIRED", + "REVOKED" + ] + }, + "userId": { + "type": "number", + "description": "Twitter's numeric ID for this user" + }, + "screenName": { + "type": "string", + "description": "The twitter username for this account (can be changed by the user)" + }, + "oauthToken": { + "type": "string", + "description": "The OAuth token for this Twitter account" + }, + "oauthTokenSecret": { + "type": "string", + "description": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete." + }, + "dateAuthorized": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account" + } + } + } + }, + "toDoItems": { + "type": "array", + "items": { + "type": "object", + "description": "A record is one node in a To-Do item tree (every record can contain nested sub-records).", + "properties": { + "status": { + "type": "string", + "description": "User-selected state for this item (e.g. whether or not it is marked as done)", + "enum": [ + "HIDDEN", + "ACTIONABLE", + "DONE", + "ARCHIVED", + "DELETED" + ] + }, + "title": { + "type": "string", + "description": "One-line summary of the item" + }, + "description": { + "type": "string", + "description": "Detailed description (may contain HTML markup)" + }, + "snoozeDate": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status" + }, + "subItems": { + "type": "array", + "doc": "List of children of this to-do tree node", + "items": { + "$ref": "#/components/messages/UserSignedUp/payload/schema/properties/toDoItems" + } + } + } + } + } + } + } + } + }, + "OpenAPI-UserSignedUp": { + "payload": { + "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", + "schema": { + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "completed": { + "type": "boolean" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "required": [ + "id", + "name", + "completed" + ] + } + } + }, + "Unknown-UserSignedUp": { + "payload": { + "schemaFormat": "unknown-schema-format", + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false } } }, - "UserSignedUpV2": { + "Unknown-UserSignedUpV2": { "payload": { "$ref": "external-schema.json" } diff --git a/test/docs/3.0.0/streetlights-asyncapi.json b/test/docs/3.0.0/streetlights-asyncapi.json new file mode 100644 index 00000000..c6885a2e --- /dev/null +++ b/test/docs/3.0.0/streetlights-asyncapi.json @@ -0,0 +1,126 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups" + }, + "channels": { + "AsyncAPI-UserSignedUpChannel": { + "address": "user/signedup/{test_param}", + "parameters": { + "test_param": { + "enum": [ + "test" + ], + "default": "test", + "description": "Just a test description", + "examples": [ + "test" + ], + "location": "$message.payload#", + "x-custom-extension": "test" + } + }, + "messages": { + "AsyncAPI-UserSignedUp": { + "$ref": "#/components/messages/AsyncAPI-UserSignedUp" + } + } + } + }, + "operations": { + "AsyncAPI-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/AsyncAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "AsyncAPI-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/AsyncAPI-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + } + }, + "components": { + "messages": { + "AsyncAPI-UserSignedUp": { + "payload": { + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false + } + } + }, + "AsyncAPI-UserSignedUpV2": { + "payload": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false + } + }, + "AsyncAPI-UserSignedUpV3": { + "payload": { + "$ref": "external-schema.json" + } + } + } + } +} \ No newline at end of file diff --git a/test/docs/3.0.0/streetlights-avro.json b/test/docs/3.0.0/streetlights-avro.json index 34eed135..4396022b 100644 --- a/test/docs/3.0.0/streetlights-avro.json +++ b/test/docs/3.0.0/streetlights-avro.json @@ -6,20 +6,20 @@ "description": "This service is in charge of processing user signups" }, "channels": { - "UserSignedUpChannel": { + "Avro-UserSignedUpChannel": { "address": "user/signedup", "messages": { "UserSignedUp": { - "$ref": "#/components/messages/UserSignedUp" + "$ref": "#/components/messages/Avro-UserSignedUp" } } } }, "operations": { - "PublishUserSignedUp": { + "Avro-PublishUserSignedUp": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/Avro-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -37,10 +37,10 @@ } } }, - "PublishUserSignedUpDefaultBinding": { + "Avro-PublishUserSignedUpDefaultBinding": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/Avro-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -59,7 +59,7 @@ }, "components": { "schemas": { - "UserSignedUpHeaders": { + "Avro-UserSignedUpHeaders": { "schemaFormat": "application/vnd.apache.avro;version=1.9.0", "schema": { "fields": [ @@ -77,7 +77,7 @@ "type": "record" } }, - "ReferencedSchema" : { + "Avro-ReferencedSchema" : { "schemaFormat": "application/vnd.apache.avro;version=1.9.0", "schema": { "$ref": "reference-to-some-avro-file.avsc" @@ -85,9 +85,9 @@ } }, "messages": { - "UserSignedUp": { + "Avro-UserSignedUp": { "headers": { - "$ref": "#/components/schemas/UserSignedUpHeaders" + "$ref": "#/components/schemas/Avro-UserSignedUpHeaders" }, "payload": { "schemaFormat": "application/vnd.apache.avro;version=1.9.0", diff --git a/test/docs/3.0.0/streetlights-json.json b/test/docs/3.0.0/streetlights-json.json new file mode 100644 index 00000000..61b96152 --- /dev/null +++ b/test/docs/3.0.0/streetlights-json.json @@ -0,0 +1,225 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups" + }, + "channels": { + "Json-UserSignedUpChannel": { + "address": "user/signedup", + "messages": { + "UserSignedUp": { + "$ref": "#/components/messages/Json-UserSignedUp" + } + } + } + }, + "operations": { + "Json-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/Json-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Json-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/Json-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + } + }, + "components": { + "schemas": { + "Json-UserSignedUpHeaders": { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "type": "object", + "properties": { + "applicationInstanceId": { + "type": "string", + "description": "Application instance Id" + }, + "correlationId": { + "type": "string", + "description": "Correlation Id" + } + } + } + }, + "Json-ReferencedSchema" : { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$ref": "reference-to-some-json-schema-file.json" + } + } + }, + "messages": { + "Json-UserSignedUp": { + "headers": { + "$ref": "#/components/schemas/Json-UserSignedUpHeaders" + }, + "payload": { + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "type": "object", + "description": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!", + "properties": { + "id": { + "type": "integer", + "description": "System-assigned numeric user ID. Cannot be changed by the user." + }, + "username": { + "type": "string", + "description": "The username chosen by the user. Can be changed by the user." + }, + "passwordHash": { + "type": "string", + "description": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html)." + }, + "signupDate": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the user signed up" + }, + "emailAddresses": { + "type": "array", + "description": "All email addresses on the user's account", + "items": { + "type": "object", + "description": "Stores details about an email address that a user has associated with their account.", + "properties": { + "address": { + "type": "string", + "description": "The email address, e.g. `foo@example.com`" + }, + "verified": { + "type": "boolean", + "description": "true if the user has clicked the link in a confirmation email to this address.", + "default": false + }, + "dateAdded": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the email address was added to the account." + }, + "dateBounced": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces." + } + } + } + }, + "twitterAccounts": { + "type": "array", + "description": "All Twitter accounts that the user has OAuthed", + "items": { + "type": "object", + "description": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.", + "properties": { + "status": { + "type": "string", + "description": "Indicator of whether this authorization is currently active, or has been revoked", + "enum": [ + "PENDING", + "ACTIVE", + "DENIED", + "EXPIRED", + "REVOKED" + ] + }, + "userId": { + "type": "number", + "description": "Twitter's numeric ID for this user" + }, + "screenName": { + "type": "string", + "description": "The twitter username for this account (can be changed by the user)" + }, + "oauthToken": { + "type": "string", + "description": "The OAuth token for this Twitter account" + }, + "oauthTokenSecret": { + "type": "string", + "description": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete." + }, + "dateAuthorized": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account" + } + } + } + }, + "toDoItems": { + "type": "array", + "items": { + "type": "object", + "description": "A record is one node in a To-Do item tree (every record can contain nested sub-records).", + "properties": { + "status": { + "type": "string", + "description": "User-selected state for this item (e.g. whether or not it is marked as done)", + "enum": [ + "HIDDEN", + "ACTIONABLE", + "DONE", + "ARCHIVED", + "DELETED" + ] + }, + "title": { + "type": "string", + "description": "One-line summary of the item" + }, + "description": { + "type": "string", + "description": "Detailed description (may contain HTML markup)" + }, + "snoozeDate": { + "type": "number", + "description": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status" + }, + "subItems": { + "type": "array", + "doc": "List of children of this to-do tree node", + "items": { + "$ref": "#/components/messages/UserSignedUp/payload/schema/properties/toDoItems" + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/test/docs/3.0.0/streetlights-openapi.json b/test/docs/3.0.0/streetlights-openapi.json index 08f25ae4..2d99bcb3 100644 --- a/test/docs/3.0.0/streetlights-openapi.json +++ b/test/docs/3.0.0/streetlights-openapi.json @@ -6,20 +6,20 @@ "description": "This service is in charge of processing user signups" }, "channels": { - "UserSignedUpChannel": { + "OpenAPI-UserSignedUpChannel": { "address": "user/signedup", "messages": { "UserSignedUp": { - "$ref": "#/components/messages/UserSignedUp" + "$ref": "#/components/messages/OpenAPI-UserSignedUp" } } } }, "operations": { - "PublishUserSignedUp": { + "OpenAPI-PublishUserSignedUp": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/OpenAPI-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -37,10 +37,10 @@ } } }, - "PublishUserSignedUpDefaultBinding": { + "OpenAPI-PublishUserSignedUpDefaultBinding": { "action": "send", "channel": { - "$ref": "#/channels/UserSignedUpChannel" + "$ref": "#/channels/OpenAPI-UserSignedUpChannel" }, "bindings": { "mqtt": { @@ -59,7 +59,7 @@ }, "components": { "schemas": { - "ReferencedSchema" : { + "OpenAPI-ReferencedSchema" : { "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", "schema": { "$ref": "reference-to-some-openapi-file.json" @@ -67,7 +67,7 @@ } }, "messages": { - "UserSignedUp": { + "OpenAPI-UserSignedUp": { "payload": { "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", "schema": { diff --git a/test/docs/3.0.0/streetlights-unknown.json b/test/docs/3.0.0/streetlights-unknown.json new file mode 100644 index 00000000..cca2c654 --- /dev/null +++ b/test/docs/3.0.0/streetlights-unknown.json @@ -0,0 +1,106 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups" + }, + "channels": { + "Unknown-UserSignedUpChannel": { + "address": "user/signedup/{test_param}", + "parameters": { + "test_param": { + "enum": [ + "test" + ], + "default": "test", + "description": "Just a test description", + "examples": [ + "test" + ], + "location": "$message.payload#", + "x-custom-extension": "test" + } + }, + "messages": { + "UserSignedUp": { + "$ref": "#/components/messages/Unknown-UserSignedUp" + } + } + } + }, + "operations": { + "Unknown-PublishUserSignedUp": { + "action": "send", + "channel": { + "$ref": "#/channels/Unknown-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "bindingVersion": "0.2.0", + "qos": 1 + }, + "kafka": { + "bindingVersion": "0.3.0", + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + }, + "Unknown-PublishUserSignedUpDefaultBinding": { + "action": "send", + "channel": { + "$ref": "#/channels/Unknown-UserSignedUpChannel" + }, + "bindings": { + "mqtt": { + "qos": 1 + }, + "kafka": { + "clientId": { + "type": "string", + "enum": [ + "my-app-id" + ] + } + } + } + } + }, + "components": { + "messages": { + "Unknown-UserSignedUp": { + "payload": { + "schemaFormat": "unknown-schema-format", + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + }, + "externalDocs": { + "url": "https://account-service/docs/UserSignedUp" + }, + "deprecated": false + } + } + }, + "Unknown-UserSignedUpV2": { + "payload": { + "$ref": "external-schema.json" + } + } + } + } +} \ No newline at end of file From acfb26e9554ec5400d24023c97ef0af9bfdf74c9 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 25 Mar 2024 22:24:11 +0400 Subject: [PATCH 12/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/anySchema.json | 17 +---------------- schemas/3.0.0-without-$id.json | 29 +---------------------------- schemas/3.0.0.json | 29 +---------------------------- 3 files changed, 3 insertions(+), 72 deletions(-) diff --git a/definitions/3.0.0/anySchema.json b/definitions/3.0.0/anySchema.json index cc60af06..db910599 100644 --- a/definitions/3.0.0/anySchema.json +++ b/definitions/3.0.0/anySchema.json @@ -17,26 +17,11 @@ "description": "Reference to schema" } }, - "minProperties": 1, "oneOf": [ { "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", "not": {"required": ["schemaFormat", "schema"]}, - "anyOf": [ - { - "type": "object", - "required": ["$ref"], - "not": {"required": ["schemaFormat", "schema"]}, - "minProperties": 1, - "maxProperties": 1, - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "type": "object", - "not": {"required": ["schemaFormat", "schema"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { "type": "object", diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 574c75ed..cbd96cae 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2702,7 +2702,6 @@ "description": "Reference to schema" } }, - "minProperties": 1, "oneOf": [ { "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", @@ -2712,33 +2711,7 @@ "schema" ] }, - "anyOf": [ - { - "type": "object", - "required": [ - "$ref" - ], - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "minProperties": 1, - "maxProperties": 1, - "$ref": "#/definitions/Reference" - }, - { - "type": "object", - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "$ref": "#/definitions/schema" - } - ] + "$ref": "#/definitions/schema" }, { "type": "object", diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index f6da964a..97ae09ab 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2752,7 +2752,6 @@ "description": "Reference to schema" } }, - "minProperties": 1, "oneOf": [ { "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", @@ -2762,33 +2761,7 @@ "schema" ] }, - "anyOf": [ - { - "type": "object", - "required": [ - "$ref" - ], - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "minProperties": 1, - "maxProperties": 1, - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - }, - { - "type": "object", - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }, { "type": "object", From 469431cbb4c1213de384f7f83297413786e0b73a Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Thu, 28 Mar 2024 18:01:10 +0400 Subject: [PATCH 13/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/multiFormatSchema.json | 384 +++++---- schemas/3.0.0-without-$id.json | 945 +++++++++++------------ 2 files changed, 624 insertions(+), 705 deletions(-) diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json index dd03f474..077cdcf6 100644 --- a/definitions/3.0.0/multiFormatSchema.json +++ b/definitions/3.0.0/multiFormatSchema.json @@ -1,217 +1,41 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", - "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", "type": "object", - "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, - "required": ["schemaFormat", "schema"], - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema formats" - }, - "schema": { - "type": "object", - "description": "Schema definition" + "if": { + "not": { + "type": "object" } }, - "minProperties": 2, - "maxProperties": 2, - "oneOf": [ - { - "type": "object", - "description": "Multi Format Schema: Avro Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] - }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "Avro Schema", - "not": {"required": ["$ref"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - }, - { - "type": "object", - "description": "Reference to Avro Schema", - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] - } - } - }, - { - "type": "object", - "description": "Multi Format Schema: OpenAPI Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] - }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "OpenAPI Schema", - "not": {"required": ["$ref"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - }, - { - "type": "object", - "description": "Reference to OpenAPI Schema", - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] - } - } - }, - { - "type": "object", - "description": "Multi Format Schema: Json Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - }, - "schema": { - "description": "Because of $ref collision in Reference and Json Schema", - "anyOf": [ - { - "type": "object", - "description": "Json Schema", - "not": {"required": ["$ref"]}, - "$ref": "http://json-schema.org/draft-07/schema" - }, - { - "type": "object", - "description": "Reference to Json Schema", - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] - } - } - }, - { - "type": "object", - "description": "Multi Format Schema: AsyncAPI Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "description": "Because of $ref collision in Reference and AsyncAPI Schema", - "anyOf": [ - { - "type": "object", - "description": "AsyncAPI Schema", - "not": {"required": ["$ref"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "type": "object", - "description": "Reference to AsyncAPI Schema", - "required": ["$ref"], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] - } - } - }, - { - "type": "object", - "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", - "properties": { - "schemaFormat": { - "type": "string", - "not": { + "then": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + "else": { + "properties": { + "schemaFormat": { + "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", + "anyOf": [ + { + "type": "string" + }, + { + "description": "All the schema formats tooling MUST support", "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07", "application/vnd.aai.asyncapi;version=3.0.0", "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0", - + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + { + "description": "All the schema formats tools are RECOMMENDED to support", + "enum": [ "application/vnd.oai.openapi;version=3.0.0", "application/vnd.oai.openapi+json;version=3.0.0", "application/vnd.oai.openapi+yaml;version=3.0.0", @@ -220,17 +44,159 @@ "application/vnd.apache.avro+json;version=1.9.0", "application/vnd.apache.avro+yaml;version=1.9.0", - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" + "application/raml+yaml;version=1.0" + ] + } + ] + } + }, + "allOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", + "required": [ + "schemaFormat" ] } }, - "schema": { - "type": "object", - "description": "AsyncAPI Schema", - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + }, + { + "if": { + "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" + } + ] + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" + } + ] + } + } } } - } - ] + ] + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" } \ No newline at end of file diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index cbd96cae..19f9eef9 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2731,250 +2731,489 @@ ] }, "multiFormatSchema": { - "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", "type": "object", - "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema formats" - }, - "schema": { - "type": "object", - "description": "Schema definition" + "if": { + "not": { + "type": "object" } }, - "minProperties": 2, - "maxProperties": 2, - "oneOf": [ - { - "type": "object", - "description": "Multi Format Schema: Avro Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] + "then": { + "$ref": "#/definitions/schema" + }, + "else": { + "properties": { + "schemaFormat": { + "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", + "anyOf": [ + { + "type": "string" + }, + { + "description": "All the schema formats tooling MUST support", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + { + "description": "All the schema formats tools are RECOMMENDED to support", + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0", + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + "application/raml+yaml;version=1.0" + ] + } + ] + } + }, + "allOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", + "required": [ + "schemaFormat" + ] + } }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "Avro Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "#/definitions/avroSchema_v1" - }, - { - "type": "object", - "description": "Reference to Avro Schema", - "required": [ - "$ref" - ], - "$ref": "#/definitions/Reference" + "then": { + "properties": { + "schema": { + "$ref": "#/definitions/schema" } - ] + } + } + }, + { + "if": { + "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "#/definitions/schema" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "#/definitions/json-schema-draft-07-schema" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "#/definitions/Reference" + }, + { + "$ref": "#/definitions/openapiSchema_3_0" + } + ] + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "#/definitions/Reference" + }, + { + "$ref": "#/definitions/avroSchema_v1" + } + ] + } + } } } - }, - { + ] + } + }, + "openapiSchema_3_0": { + "type": "object", + "definitions": { + "ExternalDocumentation": { "type": "object", - "description": "Multi Format Schema: OpenAPI Schema or Reference", + "required": [ + "url" + ], "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] + "description": { + "type": "string" }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "OpenAPI Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "type": "object", - "description": "Reference to OpenAPI Schema", - "required": [ - "$ref" - ], - "$ref": "#/definitions/Reference" - } - ] + "url": { + "type": "string", + "format": "uri-reference" } - } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false }, - { + "Discriminator": { "type": "object", - "description": "Multi Format Schema: Json Schema or Reference", + "required": [ + "propertyName" + ], "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] + "propertyName": { + "type": "string" }, - "schema": { - "description": "Because of $ref collision in Reference and Json Schema", - "anyOf": [ - { - "type": "object", - "description": "Json Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "#/definitions/json-schema-draft-07-schema" - }, - { - "type": "object", - "description": "Reference to Json Schema", - "required": [ - "$ref" - ], - "$ref": "#/definitions/Reference" - } - ] + "mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, - { + "Reference": { "type": "object", - "description": "Multi Format Schema: AsyncAPI Schema or Reference", - "properties": { - "schemaFormat": { + "required": [ + "$ref" + ], + "patternProperties": { + "^\\$ref$": { "type": "string", - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "description": "Because of $ref collision in Reference and AsyncAPI Schema", - "anyOf": [ - { - "type": "object", - "description": "AsyncAPI Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "#/definitions/schema" - }, - { - "type": "object", - "description": "Reference to AsyncAPI Schema", - "required": [ - "$ref" - ], - "$ref": "#/definitions/Reference" - } - ] + "format": "uri-reference" } } }, - { + "XML": { "type": "object", - "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", "properties": { - "schemaFormat": { + "name": { + "type": "string" + }, + "namespace": { "type": "string", - "not": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0", - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0", - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0", - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - } + "format": "uri" }, - "schema": { - "type": "object", - "description": "AsyncAPI Schema", - "$ref": "#/definitions/schema" + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false } - } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false } - ] - }, - "avroSchema_v1": { + }, + "properties": { + "title": { + "type": "string" + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { + "type": "integer", + "minimum": 0 + }, + "minLength": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { + "type": "integer", + "minimum": 0 + }, + "minItems": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { + "type": "integer", + "minimum": 0 + }, + "minProperties": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "required": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": false + }, + "type": { + "type": "string", + "enum": [ + "array", + "boolean", + "integer", + "number", + "object", + "string" + ] + }, + "not": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + }, + "allOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "oneOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "anyOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + }, + "properties": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + } + ] + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/openapiSchema_3_0" + }, + { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" + }, + { + "type": "boolean" + } + ], + "default": true + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "default": true, + "nullable": { + "type": "boolean", + "default": false + }, + "discriminator": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/Discriminator" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "example": true, + "externalDocs": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/ExternalDocumentation" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/openapiSchema_3_0/definitions/XML" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + }, + "avroSchema_v1": { "definitions": { "avroSchema": { "title": "Avro Schema", @@ -3296,292 +3535,6 @@ ], "title": "Avro Schema Definition" }, - "openapiSchema_3_0": { - "type": "object", - "definitions": { - "ExternalDocumentation": { - "type": "object", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri-reference" - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - }, - "Discriminator": { - "type": "object", - "required": [ - "propertyName" - ], - "properties": { - "propertyName": { - "type": "string" - }, - "mapping": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "Reference": { - "type": "object", - "required": [ - "$ref" - ], - "patternProperties": { - "^\\$ref$": { - "type": "string", - "format": "uri-reference" - } - } - }, - "XML": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string", - "format": "uri" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - } - }, - "properties": { - "title": { - "type": "string" - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { - "type": "integer", - "minimum": 0 - }, - "minLength": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": { - "type": "integer", - "minimum": 0 - }, - "minItems": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { - "type": "integer", - "minimum": 0 - }, - "minProperties": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "uniqueItems": true - }, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": false - }, - "type": { - "type": "string", - "enum": [ - "array", - "boolean", - "integer", - "number", - "object", - "string" - ] - }, - "not": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - }, - "allOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "oneOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "anyOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - } - ] - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/openapiSchema_3_0" - }, - { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Reference" - }, - { - "type": "boolean" - } - ], - "default": true - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - }, - "default": true, - "nullable": { - "type": "boolean", - "default": false - }, - "discriminator": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/Discriminator" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "example": true, - "externalDocs": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/ExternalDocumentation" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/openapiSchema_3_0/definitions/XML" - } - }, - "patternProperties": { - "^x-": true - }, - "additionalProperties": false - }, "correlationId": { "type": "object", "description": "An object that specifies an identifier at design time that can used for message tracing and correlation.", From b45e610b22d5db5c107c7b061f6ae80c5171d996 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Thu, 28 Mar 2024 18:46:46 +0400 Subject: [PATCH 14/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- schemas/3.0.0.json | 945 +++++++++++++++++++++------------------------ 1 file changed, 449 insertions(+), 496 deletions(-) diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 97ae09ab..210b3427 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2782,249 +2782,489 @@ }, "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json": { "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", - "description": "An object representing Multi Format Schema. You can use it to attach Schemas different to AsyncAPI, like Avro or OpenAPI", + "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", "type": "object", - "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, - "required": [ - "schemaFormat", - "schema" - ], - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema formats" - }, - "schema": { - "type": "object", - "description": "Schema definition" + "if": { + "not": { + "type": "object" } }, - "minProperties": 2, - "maxProperties": 2, - "oneOf": [ - { - "type": "object", - "description": "Multi Format Schema: Avro Schema or Reference", - "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0" - ] + "then": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + "else": { + "properties": { + "schemaFormat": { + "description": "A string containing the name of the schema format that is used to define the information. If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} where {{asyncapi}} matches the AsyncAPI Version String. In such a case, this would make the Multi Format Schema Object equivalent to the Schema Object. When using Reference Object within the schema, the schemaFormat of the resource being referenced MUST match the schemaFormat of the schema that contains the initial reference. For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match.", + "anyOf": [ + { + "type": "string" + }, + { + "description": "All the schema formats tooling MUST support", + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + }, + { + "description": "All the schema formats tools are RECOMMENDED to support", + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0", + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + "application/raml+yaml;version=1.0" + ] + } + ] + } + }, + "allOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", + "required": [ + "schemaFormat" + ] + } }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "Avro Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" - }, - { - "type": "object", - "description": "Reference to Avro Schema", - "required": [ - "$ref" - ], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } - ] + } + } + }, + { + "if": { + "description": "If schemaFormat has been defined check if it's one of the AsyncAPI Schema Object formats", + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "$ref": "http://json-schema.org/draft-07/schema" + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" + } + ] + } + } + } + }, + { + "if": { + "required": [ + "schemaFormat" + ], + "properties": { + "schemaFormat": { + "enum": [ + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0" + ] + } + } + }, + "then": { + "properties": { + "schema": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json" + } + ] + } + } } } - }, - { + ] + } + }, + "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json", + "type": "object", + "definitions": { + "ExternalDocumentation": { "type": "object", - "description": "Multi Format Schema: OpenAPI Schema or Reference", + "required": [ + "url" + ], "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" - ] + "description": { + "type": "string" }, - "schema": { - "oneOf": [ - { - "type": "object", - "description": "OpenAPI Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" - }, - { - "type": "object", - "description": "Reference to OpenAPI Schema", - "required": [ - "$ref" - ], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] + "url": { + "type": "string", + "format": "uri-reference" } - } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false }, - { + "Discriminator": { "type": "object", - "description": "Multi Format Schema: Json Schema or Reference", + "required": [ + "propertyName" + ], "properties": { - "schemaFormat": { - "type": "string", - "enum": [ - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] + "propertyName": { + "type": "string" }, - "schema": { - "description": "Because of $ref collision in Reference and Json Schema", - "anyOf": [ - { - "type": "object", - "description": "Json Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "http://json-schema.org/draft-07/schema" - }, - { - "type": "object", - "description": "Reference to Json Schema", - "required": [ - "$ref" - ], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] + "mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, - { + "Reference": { "type": "object", - "description": "Multi Format Schema: AsyncAPI Schema or Reference", - "properties": { - "schemaFormat": { + "required": [ + "$ref" + ], + "patternProperties": { + "^\\$ref$": { "type": "string", - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0" - ] - }, - "schema": { - "description": "Because of $ref collision in Reference and AsyncAPI Schema", - "anyOf": [ - { - "type": "object", - "description": "AsyncAPI Schema", - "not": { - "required": [ - "$ref" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "type": "object", - "description": "Reference to AsyncAPI Schema", - "required": [ - "$ref" - ], - "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" - } - ] + "format": "uri-reference" } } }, - { + "XML": { "type": "object", - "description": "Multi Format Schema: Unknown Schema is AsyncAPI Schema", "properties": { - "schemaFormat": { + "name": { + "type": "string" + }, + "namespace": { "type": "string", - "not": { - "enum": [ - "application/vnd.aai.asyncapi;version=2.0.0", - "application/vnd.aai.asyncapi+json;version=2.0.0", - "application/vnd.aai.asyncapi+yaml;version=2.0.0", - "application/vnd.aai.asyncapi;version=2.1.0", - "application/vnd.aai.asyncapi+json;version=2.1.0", - "application/vnd.aai.asyncapi+yaml;version=2.1.0", - "application/vnd.aai.asyncapi;version=2.2.0", - "application/vnd.aai.asyncapi+json;version=2.2.0", - "application/vnd.aai.asyncapi+yaml;version=2.2.0", - "application/vnd.aai.asyncapi;version=2.3.0", - "application/vnd.aai.asyncapi+json;version=2.3.0", - "application/vnd.aai.asyncapi+yaml;version=2.3.0", - "application/vnd.aai.asyncapi;version=2.4.0", - "application/vnd.aai.asyncapi+json;version=2.4.0", - "application/vnd.aai.asyncapi+yaml;version=2.4.0", - "application/vnd.aai.asyncapi;version=2.5.0", - "application/vnd.aai.asyncapi+json;version=2.5.0", - "application/vnd.aai.asyncapi+yaml;version=2.5.0", - "application/vnd.aai.asyncapi;version=2.6.0", - "application/vnd.aai.asyncapi+json;version=2.6.0", - "application/vnd.aai.asyncapi+yaml;version=2.6.0", - "application/vnd.aai.asyncapi;version=3.0.0", - "application/vnd.aai.asyncapi+json;version=3.0.0", - "application/vnd.aai.asyncapi+yaml;version=3.0.0", - "application/vnd.oai.openapi;version=3.0.0", - "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0", - "application/vnd.apache.avro;version=1.9.0", - "application/vnd.apache.avro+json;version=1.9.0", - "application/vnd.apache.avro+yaml;version=1.9.0", - "application/schema+json;version=draft-07", - "application/schema+yaml;version=draft-07" - ] - } + "format": "uri" }, - "schema": { - "type": "object", - "description": "AsyncAPI Schema", - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false } - } + }, + "patternProperties": { + "^x-": {} + }, + "additionalProperties": false } - ] - }, + }, + "properties": { + "title": { + "type": "string" + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { + "type": "integer", + "minimum": 0 + }, + "minLength": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { + "type": "integer", + "minimum": 0 + }, + "minItems": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { + "type": "integer", + "minimum": 0 + }, + "minProperties": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "required": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": false + }, + "type": { + "type": "string", + "enum": [ + "array", + "boolean", + "integer", + "number", + "object", + "string" + ] + }, + "not": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + }, + "allOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "oneOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "anyOf": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "items": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + }, + "properties": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + } + ] + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#" + }, + { + "$ref": "#/definitions/Reference" + }, + { + "type": "boolean" + } + ], + "default": true + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "default": true, + "nullable": { + "type": "boolean", + "default": false + }, + "discriminator": { + "$ref": "#/definitions/Discriminator" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "example": true, + "externalDocs": { + "$ref": "#/definitions/ExternalDocumentation" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/XML" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + }, "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json": { "$id": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json", "definitions": { @@ -3348,293 +3588,6 @@ ], "title": "Avro Schema Definition" }, - "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json": { - "$id": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json", - "type": "object", - "definitions": { - "ExternalDocumentation": { - "type": "object", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri-reference" - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - }, - "Discriminator": { - "type": "object", - "required": [ - "propertyName" - ], - "properties": { - "propertyName": { - "type": "string" - }, - "mapping": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "Reference": { - "type": "object", - "required": [ - "$ref" - ], - "patternProperties": { - "^\\$ref$": { - "type": "string", - "format": "uri-reference" - } - } - }, - "XML": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string", - "format": "uri" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": {} - }, - "additionalProperties": false - } - }, - "properties": { - "title": { - "type": "string" - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { - "type": "integer", - "minimum": 0 - }, - "minLength": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": { - "type": "integer", - "minimum": 0 - }, - "minItems": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { - "type": "integer", - "minimum": 0 - }, - "minProperties": { - "type": "integer", - "minimum": 0, - "default": 0 - }, - "required": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "uniqueItems": true - }, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": false - }, - "type": { - "type": "string", - "enum": [ - "array", - "boolean", - "integer", - "number", - "object", - "string" - ] - }, - "not": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - }, - "allOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "oneOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "anyOf": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "items": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - } - ] - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/Reference" - }, - { - "type": "boolean" - } - ], - "default": true - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - }, - "default": true, - "nullable": { - "type": "boolean", - "default": false - }, - "discriminator": { - "$ref": "#/definitions/Discriminator" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "example": true, - "externalDocs": { - "$ref": "#/definitions/ExternalDocumentation" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/XML" - } - }, - "patternProperties": { - "^x-": true - }, - "additionalProperties": false - }, "http://asyncapi.com/definitions/3.0.0/correlationId.json": { "$id": "http://asyncapi.com/definitions/3.0.0/correlationId.json", "type": "object", From 52b06c513088a041764f42a8712979be664c8a79 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 14:11:32 +0400 Subject: [PATCH 15/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema New multiFormatSchema validation rules https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- definitions/3.0.0/anySchema.json | 14 -------------- schemas/3.0.0-without-$id.json | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/definitions/3.0.0/anySchema.json b/definitions/3.0.0/anySchema.json index db910599..d9b5bc5b 100644 --- a/definitions/3.0.0/anySchema.json +++ b/definitions/3.0.0/anySchema.json @@ -3,20 +3,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "description": "An object representing either a Reference, a Schema or a Multi Format Schema", - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema format" - }, - "schema": { - "type": "object", - "description": "Schema definition" - }, - "$ref": { - "type": "string", - "description": "Reference to schema" - } - }, "oneOf": [ { "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 19f9eef9..ce69d7bc 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2688,20 +2688,6 @@ "anySchema": { "type": "object", "description": "An object representing either a Reference, a Schema or a Multi Format Schema", - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema format" - }, - "schema": { - "type": "object", - "description": "Schema definition" - }, - "$ref": { - "type": "string", - "description": "Reference to schema" - } - }, "oneOf": [ { "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", From d34130d11549fde6b8c24d9557c1b7e588c7b426 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 2 Apr 2024 22:31:23 +0400 Subject: [PATCH 16/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema Rollback AnySchema and AvroSchema https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- common/avroSchema_v1.json | 21 +++------ definitions/3.0.0/anySchema.json | 31 ++++++------- schemas/3.0.0.json | 74 ++++++++------------------------ 3 files changed, 38 insertions(+), 88 deletions(-) diff --git a/common/avroSchema_v1.json b/common/avroSchema_v1.json index 72bc4dae..d3448f10 100644 --- a/common/avroSchema_v1.json +++ b/common/avroSchema_v1.json @@ -70,8 +70,7 @@ }, "required": [ "type" - ], - "additionalProperties": false + ] }, "customTypeReference": { "title": "Custom Type", @@ -123,8 +122,7 @@ "required": [ "name", "type" - ], - "additionalProperties": false + ] }, "avroRecord": { "title": "Record", @@ -161,8 +159,7 @@ "type", "name", "fields" - ], - "additionalProperties": false + ] }, "avroEnum": { "title": "Enum", @@ -199,8 +196,7 @@ "type", "name", "symbols" - ], - "additionalProperties": false + ] }, "avroArray": { "title": "Array", @@ -233,8 +229,7 @@ "required": [ "type", "items" - ], - "additionalProperties": false + ] }, "avroMap": { "title": "Map", @@ -267,8 +262,7 @@ "required": [ "type", "values" - ], - "additionalProperties": false + ] }, "avroFixed": { "title": "Fixed", @@ -302,8 +296,7 @@ "type", "name", "size" - ], - "additionalProperties": false + ] }, "name": { "type": "string", diff --git a/definitions/3.0.0/anySchema.json b/definitions/3.0.0/anySchema.json index d9b5bc5b..4a0bf239 100644 --- a/definitions/3.0.0/anySchema.json +++ b/definitions/3.0.0/anySchema.json @@ -1,21 +1,16 @@ { - "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json", + "if": { + "required": [ + "schema" + ] + }, + "then": { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" + }, + "else": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.", "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "description": "An object representing either a Reference, a Schema or a Multi Format Schema", - "oneOf": [ - { - "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", - "not": {"required": ["schemaFormat", "schema"]}, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "type": "object", - "required": ["schemaFormat", "schema"], - "not": {"required": ["$ref"]}, - "minProperties": 2, - "maxProperties": 2, - "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" - } - ] + "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json" } diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 210b3427..17dc5d36 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2736,49 +2736,18 @@ }, "http://asyncapi.com/definitions/3.0.0/anySchema.json": { "$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json", - "type": "object", - "description": "An object representing either a Reference, a Schema or a Multi Format Schema", - "properties": { - "schemaFormat": { - "type": "string", - "description": "Supported Schema format" - }, - "schema": { - "type": "object", - "description": "Schema definition" - }, - "$ref": { - "type": "string", - "description": "Reference to schema" - } + "if": { + "required": [ + "schema" + ] }, - "oneOf": [ - { - "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "minProperties": 2, - "maxProperties": 2, - "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" - } - ] + "then": { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json" + }, + "else": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + }, + "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise." }, "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json": { "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json", @@ -3336,8 +3305,7 @@ }, "required": [ "type" - ], - "additionalProperties": false + ] }, "customTypeReference": { "title": "Custom Type", @@ -3389,8 +3357,7 @@ "required": [ "name", "type" - ], - "additionalProperties": false + ] }, "avroRecord": { "title": "Record", @@ -3427,8 +3394,7 @@ "type", "name", "fields" - ], - "additionalProperties": false + ] }, "avroEnum": { "title": "Enum", @@ -3465,8 +3431,7 @@ "type", "name", "symbols" - ], - "additionalProperties": false + ] }, "avroArray": { "title": "Array", @@ -3499,8 +3464,7 @@ "required": [ "type", "items" - ], - "additionalProperties": false + ] }, "avroMap": { "title": "Map", @@ -3533,8 +3497,7 @@ "required": [ "type", "values" - ], - "additionalProperties": false + ] }, "avroFixed": { "title": "Fixed", @@ -3568,8 +3531,7 @@ "type", "name", "size" - ], - "additionalProperties": false + ] }, "name": { "type": "string", From a9a7d471e41dca58fc55a48a6b1b5b28e932b280 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 2 Apr 2024 22:31:34 +0400 Subject: [PATCH 17/17] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema Rollback AnySchema and AvroSchema https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- schemas/3.0.0-without-$id.json | 62 +++++++++++----------------------- 1 file changed, 19 insertions(+), 43 deletions(-) diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index ce69d7bc..4812c70b 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2686,35 +2686,18 @@ ] }, "anySchema": { - "type": "object", - "description": "An object representing either a Reference, a Schema or a Multi Format Schema", - "oneOf": [ - { - "description": "Because of $ref collision in Reference and AsyncAPI Schema(includes $ref from Json Schema)", - "not": { - "required": [ - "schemaFormat", - "schema" - ] - }, - "$ref": "#/definitions/schema" - }, - { - "type": "object", - "required": [ - "schemaFormat", - "schema" - ], - "not": { - "required": [ - "$ref" - ] - }, - "minProperties": 2, - "maxProperties": 2, - "$ref": "#/definitions/multiFormatSchema" - } - ] + "if": { + "required": [ + "schema" + ] + }, + "then": { + "$ref": "#/definitions/multiFormatSchema" + }, + "else": { + "$ref": "#/definitions/schema" + }, + "description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise." }, "multiFormatSchema": { "description": "The Multi Format Schema Object represents a schema definition. It differs from the Schema Object in that it supports multiple schema formats or languages (e.g., JSON Schema, Avro, etc.).", @@ -3269,8 +3252,7 @@ }, "required": [ "type" - ], - "additionalProperties": false + ] }, "customTypeReference": { "title": "Custom Type", @@ -3322,8 +3304,7 @@ "required": [ "name", "type" - ], - "additionalProperties": false + ] }, "avroRecord": { "title": "Record", @@ -3360,8 +3341,7 @@ "type", "name", "fields" - ], - "additionalProperties": false + ] }, "avroEnum": { "title": "Enum", @@ -3398,8 +3378,7 @@ "type", "name", "symbols" - ], - "additionalProperties": false + ] }, "avroArray": { "title": "Array", @@ -3432,8 +3411,7 @@ "required": [ "type", "items" - ], - "additionalProperties": false + ] }, "avroMap": { "title": "Map", @@ -3466,8 +3444,7 @@ "required": [ "type", "values" - ], - "additionalProperties": false + ] }, "avroFixed": { "title": "Fixed", @@ -3501,8 +3478,7 @@ "type", "name", "size" - ], - "additionalProperties": false + ] }, "name": { "type": "string",