From 90a2d26fe6b843c927f9b564edff9abaacd38d80 Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Mon, 13 May 2024 11:42:23 +0200 Subject: [PATCH] update multi format messages --- definitions/3.0.0/multiFormatSchema.json | 235 ++++----------- schemas/3.0.0-without-$id.json | 352 +++++++++++----------- schemas/3.0.0.json | 356 ++++++++++++----------- 3 files changed, 413 insertions(+), 530 deletions(-) diff --git a/definitions/3.0.0/multiFormatSchema.json b/definitions/3.0.0/multiFormatSchema.json index 077cdcf6..b29ee2f0 100644 --- a/definitions/3.0.0/multiFormatSchema.json +++ b/definitions/3.0.0/multiFormatSchema.json @@ -6,197 +6,72 @@ "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" } }, - "if": { - "not": { - "type": "object" - } - }, - "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", + "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.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/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" - ] - } - }, - "then": { - "properties": { - "schema": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - } - } + "application/raml+yaml;version=1.0" + ] } - }, - { - "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": { + ] + } + }, + "anyOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", "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" - } - ] - } + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" } } } - ] - }, + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatAsyncAPISchemaMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatOpenAPIMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatJsonSchemaMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatAvroMessage.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 3a8ce1ef..a58792df 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2744,193 +2744,143 @@ "$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" + ] + } + ] + } + }, + "anyOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", + "required": [ + "schemaFormat" + ] + } + }, + "then": { + "properties": { + "schema": { + "$ref": "#/definitions/schema" + } + } + } + }, + { + "$ref": "#/definitions/multiFormatAsyncAPISchemaMessage" + }, + { + "$ref": "#/definitions/multiFormatOpenAPIMessage" + }, + { + "$ref": "#/definitions/multiFormatJsonSchemaMessage" + }, + { + "$ref": "#/definitions/multiFormatAvroMessage" + } + ] + }, + "multiFormatAsyncAPISchemaMessage": { "if": { - "not": { - "type": "object" + "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": { - "$ref": "#/definitions/schema" - }, - "else": { + "properties": { + "schema": { + "$ref": "#/definitions/schema" + } + } + } + }, + "multiFormatOpenAPIMessage": { + "if": { + "required": [ + "schemaFormat" + ], "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" - }, + "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": [ { - "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" - ] + "$ref": "#/definitions/Reference" }, { - "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" - ] + "$ref": "#/definitions/openapiSchema_3_0" } ] } - }, - "allOf": [ - { - "if": { - "not": { - "description": "If no schemaFormat has been defined, default to schema or reference", - "required": [ - "schemaFormat" - ] - } - }, - "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": { @@ -3219,6 +3169,58 @@ }, "additionalProperties": false }, + "multiFormatJsonSchemaMessage": { + "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" + } + } + } + }, + "multiFormatAvroMessage": { + "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" + } + ] + } + } + } + }, "avroSchema_v1": { "definitions": { "avroSchema": { diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 889d975f..860c18d9 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2798,193 +2798,145 @@ "$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" + ] + } + ] + } + }, + "anyOf": [ + { + "if": { + "not": { + "description": "If no schemaFormat has been defined, default to schema or reference", + "required": [ + "schemaFormat" + ] + } + }, + "then": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatAsyncAPISchemaMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatOpenAPIMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatJsonSchemaMessage.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatAvroMessage.json" + } + ] + }, + "http://asyncapi.com/definitions/3.0.0/multiFormatAsyncAPISchemaMessage.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatAsyncAPISchemaMessage.json", "if": { - "not": { - "type": "object" + "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": { - "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" - }, - "else": { + "properties": { + "schema": { + "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" + } + } + } + }, + "http://asyncapi.com/definitions/3.0.0/multiFormatOpenAPIMessage.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatOpenAPIMessage.json", + "if": { + "required": [ + "schemaFormat" + ], "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" - }, + "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": [ { - "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" - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" }, { - "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" - ] + "$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json" } ] } - }, - "allOf": [ - { - "if": { - "not": { - "description": "If no schemaFormat has been defined, default to schema or reference", - "required": [ - "schemaFormat" - ] - } - }, - "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": { @@ -3274,6 +3226,60 @@ }, "additionalProperties": false }, + "http://asyncapi.com/definitions/3.0.0/multiFormatJsonSchemaMessage.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatJsonSchemaMessage.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" + } + } + } + }, + "http://asyncapi.com/definitions/3.0.0/multiFormatAvroMessage.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/multiFormatAvroMessage.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/avroSchema_v1.json": { "$id": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json", "definitions": {