diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100755 index 00000000..9eea85b6 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b8903129..eabdd65d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.0-RC] - 2024-04-20 + +### Added + +- OpenAPI Schema: 3.0.0, 3.0.1, 3.0.2, 3.0.3 +- Avro Schema: 1.9.0, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.11.1 +- JsonSchema: Draft-07 + +### Changed + +- MultiFormatSchema can hold AsyncAPI, OpenAPI, Avro and Json Schemas +- Schema was divided to AsyncAPISchema and JsonSchema + ## [1.0.0-EAP-3] - 2024-03-10 Kudos to: diff --git a/README.md b/README.md index 97d13f95..90105287 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ > ⚠️ This project doesn't support AsyncAPI 1.x --- -[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-EAP-3) +[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-RC) ## Overview JVM-friendly bindings for AsyncAPI. It allows you to read or write specifications for your asynchronous API through code diff --git a/asyncapi-core/pom.xml b/asyncapi-core/pom.xml index ad3d103a..c9292752 100644 --- a/asyncapi-core/pom.xml +++ b/asyncapi-core/pom.xml @@ -6,7 +6,7 @@ asyncapi com.asyncapi - 1.0.0-EAP-3 + 1.0.0-RC 4.0.0 diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java index 6bcb98c0..34d85cdc 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java @@ -1,8 +1,8 @@ package com.asyncapi.v3._0_0.jackson.model.channel.message; import com.asyncapi.v3.Reference; -import com.asyncapi.v3.schema.Schema; -import com.asyncapi.v3.schema.MultiFormatSchema; +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -56,14 +56,14 @@ private Object chooseKnownPojo(JsonNode jsonNode, ObjectCodec objectCodec) throw if (ref != null) { return jsonParser.readValueAs(Reference.class); } else { - return jsonParser.readValueAs(Schema.class); + return jsonParser.readValueAs(AsyncAPISchema.class); } } } private Object readAsObject(JsonNode jsonNode, ObjectCodec objectCodec) throws IOException { try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { - return jsonParser.readValueAs(Schema.class); + return jsonParser.readValueAs(AsyncAPISchema.class); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java index dcf51156..2de3a298 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java @@ -1,8 +1,8 @@ package com.asyncapi.v3._0_0.jackson.model.channel.message; import com.asyncapi.v3.Reference; -import com.asyncapi.v3.schema.MultiFormatSchema; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -56,14 +56,14 @@ private Object chooseKnownPojo(JsonNode jsonNode, ObjectCodec objectCodec) throw if (ref != null) { return jsonParser.readValueAs(Reference.class); } else { - return jsonParser.readValueAs(Schema.class); + return jsonParser.readValueAs(AsyncAPISchema.class); } } } private Object readAsObject(JsonNode jsonNode, ObjectCodec objectCodec) throws IOException { try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { - return jsonParser.readValueAs(Schema.class); + return jsonParser.readValueAs(AsyncAPISchema.class); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java index 713d49b5..675174bc 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java @@ -1,8 +1,8 @@ package com.asyncapi.v3._0_0.jackson.model.component; import com.asyncapi.v3.Reference; -import com.asyncapi.v3.schema.MultiFormatSchema; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -17,8 +17,8 @@ public class ComponentsSchemasDeserializer extends JsonDeserializer { - public Class objectTypeClass() { - return Schema.class; + public Class objectTypeClass() { + return AsyncAPISchema.class; } public Class referenceClass() { diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java index a25dcb8c..e739eece 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java @@ -11,6 +11,7 @@ import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.asyncapi.v3._0_0.model.Tag; import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -39,14 +40,14 @@ public class Message extends ExtendableObject { *

* It MUST NOT define the protocol headers. *

- * If this is a {@link com.asyncapi.v3.schema.Schema}, then the schemaFormat will be assumed to + * If this is a {@link com.asyncapi.v3.schema.AsyncAPISchema}, 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. *

* MUST BE: *

    - *
  • {@link com.asyncapi.v3.schema.Schema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ @@ -57,13 +58,13 @@ public class Message extends ExtendableObject { /** * Definition of the message payload. *

- * If this is a {@link com.asyncapi.v3.schema.Schema}, then the schemaFormat will be assumed to be + * If this is a {@link com.asyncapi.v3.schema.AsyncAPISchema}, 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. *

* MUST BE: *

    - *
  • {@link com.asyncapi.v3.schema.Schema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java index fc0fad74..a9199d62 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java @@ -9,6 +9,7 @@ import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.asyncapi.v3._0_0.model.Tag; import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -39,14 +40,14 @@ public class MessageTrait extends ExtendableObject { *

* It MUST NOT define the protocol headers. *

- * If this is a {@link com.asyncapi.v3.schema.Schema}, then the schemaFormat will be assumed to + * If this is a {@link com.asyncapi.v3.schema.AsyncAPISchema}, 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. *

* MUST BE: *

    - *
  • {@link com.asyncapi.v3.schema.Schema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java index 263425fa..9f56b473 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java @@ -23,8 +23,8 @@ import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; import com.asyncapi.v3.jackson.binding.operation.OperationBindingsDeserializer; import com.asyncapi.v3.jackson.binding.server.ServerBindingsDeserializer; -import com.asyncapi.v3.schema.MultiFormatSchema; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.security_scheme.SecurityScheme; import com.asyncapi.v3.ExtendableObject; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -52,12 +52,12 @@ public class Components extends ExtendableObject { /** * An object to hold reusable Schema Object. *

- * If this is a {@link Schema}, then the schemaFormat will be assumed to be "application/vnd.aai.asyncapi+json;version=asyncapi" + * If this is a {@link AsyncAPISchema}, 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. *

* MUST BE: *

    - *
  • {@link Schema}
  • + *
  • {@link AsyncAPISchema}
  • *
  • {@link MultiFormatSchema}
  • *
  • {@link Reference}
  • *
diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBinding.java index d1255317..f701f3e9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.channel.ws; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.channel.ChannelBinding; import com.fasterxml.jackson.annotation.JsonClassDescription; import com.fasterxml.jackson.annotation.JsonProperty; @@ -43,7 +43,7 @@ public class WebSocketsChannelBinding extends ChannelBinding { @Nullable @JsonProperty("query") @JsonPropertyDescription("A Schema object containing the definitions for each query parameter. This schema MUST be of type object and have a properties key.") - private Schema query; + private AsyncAPISchema query; /** * A Schema object containing the definitions of the HTTP headers to use when establishing the connection. @@ -52,7 +52,7 @@ public class WebSocketsChannelBinding extends ChannelBinding { @Nullable @JsonProperty("headers") @JsonPropertyDescription("A Schema object containing the definitions of the HTTP headers to use when establishing the connection. This schema MUST be of type object and have a properties key.") - private Schema headers; + private AsyncAPISchema headers; /** * The version of this binding. If omitted, "latest" MUST be assumed. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBinding.java index 07f8b497..202a7529 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.message.anypointmq; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.message.MessageBinding; import com.fasterxml.jackson.annotation.JsonClassDescription; import com.fasterxml.jackson.annotation.JsonProperty; @@ -31,7 +31,7 @@ public class AnypointMQMessageBinding extends MessageBinding { @Nullable @JsonProperty("headers") @JsonPropertyDescription("A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type object and have a properties key. Examples of Anypoint MQ protocol headers are messageId and messageGroupId.") - private Schema headers; + private AsyncAPISchema headers; /** * The version of this binding. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/http/HTTPMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/http/HTTPMessageBinding.java index 664f1e40..b96aa576 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/http/HTTPMessageBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/http/HTTPMessageBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.message.http; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.message.MessageBinding; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; @@ -30,7 +30,7 @@ public class HTTPMessageBinding extends MessageBinding { @Nullable @JsonProperty("headers") @JsonPropertyDescription("A Schema object containing the definitions for each query parameter. This schema MUST be of type object and have a properties key.") - private Schema headers; + private AsyncAPISchema headers; /** * The version of this binding. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/kafka/KafkaMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/kafka/KafkaMessageBinding.java index 52070204..d7a06825 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/kafka/KafkaMessageBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/message/kafka/KafkaMessageBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.message.kafka; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.message.MessageBinding; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; @@ -29,7 +29,7 @@ public class KafkaMessageBinding extends MessageBinding { @Nullable @JsonProperty("key") @JsonPropertyDescription("The message key.") - private Schema key; + private AsyncAPISchema key; /** * If a Schema Registry is used when performing this operation, tells where the id of schema is stored (e.g. header or payload). diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/http/HTTPOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/http/HTTPOperationBinding.java index 50a6c961..0e272299 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/http/HTTPOperationBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/http/HTTPOperationBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.operation.http; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.operation.OperationBinding; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; @@ -52,7 +52,7 @@ public class HTTPOperationBinding extends OperationBinding { @Nullable @JsonProperty("query") @JsonPropertyDescription("A Schema object containing the definitions for each query parameter. This schema MUST be of type object and have a properties key.") - private Schema query; + private AsyncAPISchema query; /** * The version of this binding. If omitted, "latest" MUST be assumed. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBinding.java index c0558d01..5ec025d1 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBinding.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBinding.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.binding.operation.kafka; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.binding.operation.OperationBinding; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; @@ -29,7 +29,7 @@ public class KafkaOperationBinding extends OperationBinding { @Nullable @JsonProperty("groupId") @JsonPropertyDescription("Id of the consumer group.") - private Schema groupId; + private AsyncAPISchema groupId; /** * Id of the consumer inside a consumer group. @@ -37,7 +37,7 @@ public class KafkaOperationBinding extends OperationBinding { @Nullable @JsonProperty("clientId") @JsonPropertyDescription("Id of the consumer inside a consumer group.") - private Schema clientId; + private AsyncAPISchema clientId; /** * The version of this binding. If omitted, "latest" MUST be assumed. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/SchemaItemsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/SchemaItemsDeserializer.java index c2186164..7307e5c4 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/SchemaItemsDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/SchemaItemsDeserializer.java @@ -1,6 +1,5 @@ package com.asyncapi.v3.jackson; -import com.asyncapi.v3.schema.Schema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.ObjectCodec; import com.fasterxml.jackson.databind.DeserializationContext; @@ -13,7 +12,9 @@ import java.util.ArrayList; import java.util.List; -public class SchemaItemsDeserializer extends JsonDeserializer { +public abstract class SchemaItemsDeserializer extends JsonDeserializer { + + abstract public Class schemaClass(); @Override public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { @@ -39,7 +40,7 @@ private List readAsListOfSchemas(ArrayNode arrayNode, ObjectCodec object private Schema readAsSchema(JsonNode jsonNode, ObjectCodec objectCodec) throws IOException { try (JsonParser parser = jsonNode.traverse(objectCodec)) { - return parser.readValueAs(Schema.class); + return parser.readValueAs(schemaClass()); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAdditionalPropertiesDeserializer.java new file mode 100644 index 00000000..0e751265 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAdditionalPropertiesDeserializer.java @@ -0,0 +1,36 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; + +/** + * @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) + * @author GraviteeSource Team + */ +public class AsyncAPISchemaAdditionalPropertiesDeserializer extends JsonDeserializer { + + @Override + public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + if (jsonNode.isBoolean()) { + return jsonNode.asBoolean(); + } else { + return jsonParser.readValueAs(AsyncAPISchema.class); + } + } + } +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java new file mode 100644 index 00000000..6934993a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java @@ -0,0 +1,15 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.AsyncAPISchema; + +/** + * @author Pavel Bodiachevskii + */ +public class AsyncAPISchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { + + @Override + public Class schemaClass() { + return AsyncAPISchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaItemsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaItemsDeserializer.java new file mode 100644 index 00000000..8b1f4fcd --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaItemsDeserializer.java @@ -0,0 +1,23 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.jackson.SchemaItemsDeserializer; +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class AsyncAPISchemaItemsDeserializer extends SchemaItemsDeserializer { + + public Class schemaClass() { + return AsyncAPISchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java new file mode 100644 index 00000000..cd25811b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java @@ -0,0 +1,15 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.JsonSchema; + +/** + * @author Pavel Bodiachevskii + */ +public class JsonSchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { + + @Override + public Class schemaClass() { + return JsonSchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaItemsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaItemsDeserializer.java new file mode 100644 index 00000000..bd097e7c --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaItemsDeserializer.java @@ -0,0 +1,12 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.jackson.SchemaItemsDeserializer; +import com.asyncapi.v3.schema.JsonSchema; + +public class JsonSchemaItemsDeserializer extends SchemaItemsDeserializer { + + public Class schemaClass() { + return JsonSchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemasAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java similarity index 85% rename from asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemasAdditionalPropertiesDeserializer.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java index 659d70fe..71402943 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemasAdditionalPropertiesDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.jackson.schema; -import com.asyncapi.v3.schema.Schema; +import com.asyncapi.v3.schema.JsonSchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -14,7 +14,7 @@ * @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) * @author GraviteeSource Team */ -public class SchemasAdditionalPropertiesDeserializer extends JsonDeserializer { +public class JsonSchemaPropertiesDeserializer extends JsonDeserializer { @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { @@ -29,7 +29,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) if (jsonNode.isBoolean()) { return jsonNode.asBoolean(); } else { - return jsonParser.readValueAs(Schema.class); + return jsonParser.readValueAs(JsonSchema.class); } } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java new file mode 100644 index 00000000..09ca14d0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java @@ -0,0 +1,66 @@ +package com.asyncapi.v3.jackson.schema; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Pavel Bodiachevskii + */ +public abstract class SchemaAnyValueDeserializer extends JsonDeserializer { + + abstract public Class schemaClass(); + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsList((ArrayNode) jsonNode, objectCodec); + case BOOLEAN: + return jsonNode.asBoolean(); + case NUMBER: + return jsonParser.readValueAs(Number.class); + case OBJECT: + return jsonParser.readValueAs(schemaClass()); + case STRING: + return jsonParser.readValueAs(String.class); + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + List list = new ArrayList<>(); + for (JsonNode childNode : arrayNode) { + list.add(chooseKnownPojo(childNode, objectCodec)); + } + + return list; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java new file mode 100644 index 00000000..faa5c83b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java @@ -0,0 +1,36 @@ +package com.asyncapi.v3.jackson.schema.openapi; + +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; + +/** + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +public class OpenAPISchemaAdditionalPropertiesDeserializer extends JsonDeserializer { + + @Override + public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + if (jsonNode.isBoolean()) { + return jsonNode.asBoolean(); + } else { + return jsonParser.readValueAs(OpenAPISchema.class); + } + } + } +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java new file mode 100644 index 00000000..1dd7a133 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java @@ -0,0 +1,16 @@ +package com.asyncapi.v3.jackson.schema.openapi; + +import com.asyncapi.v3.jackson.schema.SchemaAnyValueDeserializer; +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; + +/** + * @author Pavel Bodiachevskii + */ +public class OpenAPISchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { + + @Override + public Class schemaClass() { + return OpenAPISchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java new file mode 100644 index 00000000..888b5994 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java @@ -0,0 +1,870 @@ +package com.asyncapi.v3.schema; + +import com.asyncapi.v3.ExtendableObject; +import com.asyncapi.v3._0_0.jackson.model.ExternalDocumentationDeserializer; +import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAdditionalPropertiesDeserializer; +import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAnyValueDeserializer; +import com.asyncapi.v3.jackson.schema.AsyncAPISchemaItemsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.*; +import org.jetbrains.annotations.Nullable; + +import javax.validation.constraints.Min; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * The Schema Object allows the definition of input and output data types. + *

+ * These types can be objects, but also primitives and arrays. + *

+ * This object is a superset of the JSON Schema Specification Draft 07. + *

+ * The empty schema (which allows any instance to validate) MAY be represented by the boolean value true + * and a schema which allows no instance to validate MAY be represented by the boolean value false. + *
+ *
+ * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. + *

+ * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. + *

+ * For other formats (e.g., Avro, RAML, etc) see {@link MultiFormatSchema}. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Schema Object + * @see Multi Format Schema Object + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AsyncAPISchema extends ExtendableObject { + + /** + * JSON Schema ID. + *

+ * format: uri-reference + */ + @Nullable + @JsonProperty("$id") + @JsonPropertyDescription("JSON Schema ID.") + public String id; + + /** + * JSON Schema to use for validation. + *

+ * format: uri + */ + @Nullable + @JsonProperty("$schema") + @JsonPropertyDescription("JSON Schema to use for validation.") + public String schema; + + /** + * Reference to JSON Schema definition. + *

+ * format: uri-reference + */ + @Nullable + @JsonProperty("$ref") + @JsonPropertyDescription("Reference to JSON Schema definition.") + private String ref; + + /** + * JSON Schema comment. + */ + @Nullable + @JsonProperty("$comment") + @JsonPropertyDescription("JSON Schema comment.") + private String comment; + + /* + Validation Keywords for Any Instance Type + */ + + /** + * The value of this keyword MUST be either a string or an array. + *

+ * If it is an array, elements of the array MUST be strings and MUST be unique. + *

+ * String values MUST be one of the six primitive types: + *

    + *
  • null
  • + *
  • boolean
  • + *
  • object
  • + *
  • array
  • + *
  • number
  • + *
  • string
  • + *
+ *

+ * or "integer" which matches any number with a zero fractional part. + *

+ * An instance validates if and only if the instance is in any of the sets listed for this keyword. + * + * @see type + */ + @Nullable + @JsonProperty("type") + @JsonPropertyDescription("JSON Schema type.") + public Object type; + + /** + * The value of this keyword MUST be an array. + *

+ * This array SHOULD have at least one element. Elements in the array SHOULD be unique. + *

+ * An instance validates successfully against this keyword if its value + * is equal to one of the elements in this keyword's array value. + *
+ * Elements in the array might be of any value, including null. + * + * @see enum + */ + @Nullable + @JsonProperty("enum") + @JsonPropertyDescription("JSON Schema enum values.") + public List enumValue; + + /** + * The value of this keyword MAY be of any type, including null. + *

+ * An instance validates successfully against this keyword if its value is equal to the value of the keyword. + * + * @see const + */ + @Nullable + @JsonProperty("const") + @JsonPropertyDescription("JSON Schema const value") + @JsonDeserialize(using = AsyncAPISchemaAnyValueDeserializer.class) + public Object constValue; + + /* + Validation Keywords for Numeric Instances (number and integer) + */ + + /** + * The value of "multipleOf" MUST be a number, strictly greater than 0. + *

+ * A numeric instance is valid only if division by this keyword's value results in an integer. + * + * @see multipleOf + */ + @Nullable + @Min( + value = 1, + message = "The value of \"multipleOf\" MUST be a number, strictly greater than 0." + ) + @JsonProperty("multipleOf") + public Number multipleOf; + + /** + * The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. + *

+ * If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". + * + * @see maximum + */ + @Nullable + @JsonProperty("maximum") + public BigDecimal maximum; + + /** + * The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance. + *
+ * If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". + * + * @see exclusiveMaximum + */ + @Nullable + @JsonProperty("exclusiveMaximum") + public BigDecimal exclusiveMaximum; + + /** + * The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. + *
+ * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". + * + * @see minimum + */ + @Nullable + @JsonProperty("minimum") + public BigDecimal minimum; + + /** + * The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. + *
+ * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". + * + * @see exclusiveMinimum + */ + @Nullable + @JsonProperty("exclusiveMinimum") + public BigDecimal exclusiveMinimum; + + /* + Validation Keywords for Strings + */ + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. + *

+ * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. + * + * @see maxLength + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxLength\" MUST be a non-negative integer." + ) + @JsonProperty("maxLength") + public Integer maxLength; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. + *

+ * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minLength + */ + @Nullable + @Min( + value = 0, + message = "The value of \"minLength\" MUST be a non-negative integer." + ) + @JsonProperty("minLength") + public Integer minLength; + + /** + * The value of this keyword MUST be a string. + *

+ * This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. + *

+ * A string instance is considered valid if the regular expression matches the instance successfully. + * Recall: regular expressions are not implicitly anchored. + * + * @see pattern + */ + @Nullable + @JsonProperty("pattern") + public String pattern; + + /* + Validation Keywords for Arrays + */ + + /** + * The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. + *

+ * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + *

+ * If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. + *

+ * If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same + * position, if any. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see items + */ + @Nullable + @JsonProperty("items") + @JsonDeserialize(using = AsyncAPISchemaItemsDeserializer.class) + public Object items; + + /** + * The value of "additionalItems" MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + *

+ * If "items" is an array of schemas, validation succeeds if every instance element at a position greater than the size of "items" + * validates against "additionalItems". + *

+ * Otherwise, "additionalItems" MUST be ignored, as the "items" schema (possibly the default value of an empty schema) is applied + * to all elements. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see additionalItems + */ + @Nullable + @JsonProperty("additionalItems") + public AsyncAPISchema additionalItems; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. + * + * @see maxItems + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxItems\" MUST be a non-negative integer." + ) + @JsonProperty("maxItems") + public Integer maxItems; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minItems + */ + @Nullable + @JsonProperty("minItems") + public Integer minItems; + + /** + * The value of this keyword MUST be a boolean. + *

+ * If this keyword has boolean value false, the instance validates successfully. + *

+ * If it has boolean value true, the instance validates successfully if all of its elements are unique. + *

+ * Omitting this keyword has the same behavior as a value of false. + * + * @see uniqueItems + */ + @Nullable + @JsonProperty("uniqueItems") + public Boolean uniqueItems; + + /** + * The value of this keyword MUST be a valid JSON Schema. + *
+ * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. + * + * @see contains + */ + @Nullable + @JsonProperty("contains") + public AsyncAPISchema contains; + + /* + Validation Keywords for Objects + */ + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, + * the value of this keyword. + * + * @see maxProperties + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxProperties\" MUST be a non-negative integer." + ) + @JsonProperty("maxProperties") + public Integer maxProperties; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, + * the value of this keyword. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minProperties + */ + @Nullable + @Min( + value = 0, + message = "The value of \"minProperties\" MUST be a non-negative integer." + ) + @JsonProperty("minProperties") + public Integer minProperties; + + /** + * The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique. + *

+ * An object instance is valid against this keyword if every item in the array is the name of a property in the instance. + *

+ * Omitting this keyword has the same behavior as an empty array. + * + * @see required + */ + @Nullable + @JsonProperty("required") + public List required; + + /** + * The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. + *

+ * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, + * the child instance for that name successfully validates against the corresponding schema. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see properties + */ + @Nullable + @JsonProperty("properties") + @JsonDeserialize(contentUsing = AsyncAPISchemaAdditionalPropertiesDeserializer.class) + public Map properties; + + /** + * The value of "patternProperties" MUST be an object. + *

+ * Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. + *

+ * Each property value of this object MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. Validation of the primitive instance type against this keyword always succeeds. + *

+ * Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name + * in this keyword's value, the child instance for that name successfully validates against each schema that corresponds + * to a matching regular expression. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see patternProperties + */ + @Nullable + @JsonProperty("patternProperties") + public Map patternProperties; + + /** + * The value of "additionalProperties" MUST be a valid JSON Schema or boolean + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. + *

+ * Validation with "additionalProperties" applies only to the child values of instance names that do not match any + * names in "properties", and do not match any regular expression in "patternProperties". + *

+ * For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see additionalProperties + */ + @Nullable + @JsonProperty("additionalProperties") + @JsonDeserialize(using = AsyncAPISchemaAdditionalPropertiesDeserializer.class) + public Object additionalProperties; + + /** + * [CREF1] - This keyword may be split into two, with the variation that uses an array of property names rather than a + * subschema getting a new name. The dual behavior is confusing and relatively difficult to implement. In the previous + * draft, we proposed dropping the keyword altogether, or dropping one of its forms, but we received feedback in support of + * keeping it. See issues #442 and #528 at https://github.com/json-schema-org/json-schema-spec/issues for further discussion. + * Further feedback is encouraged. + *
+ *
+ *
+ * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. + *

+ * This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array + * or a valid JSON Schema. + *

+ * If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate + * against the dependency value. + *

+ * If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. + *

+ * If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see dependencies + */ + @Nullable + @JsonProperty("dependencies") + public Object dependencies; + + /** + * The value of "propertyNames" MUST be a valid JSON Schema. + *

+ * If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema. + *

+ * Note the property name that the schema is testing will always be a string. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see propertyNames + */ + @Nullable + @JsonProperty("propertyNames") + public AsyncAPISchema propertyNames; + + /* + Keywords for Applying Subschemas Conditionally + */ + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * This validation outcome of this keyword's subschema has no direct effect on the overall validation result. + * Rather, it controls which of the "then" or "else" keywords are evaluated. + *

+ * Instances that successfully validate against this keyword's subschema MUST also be valid against the subschema + * value of the "then" keyword, if present. + *

+ * Instances that fail to validate against this keyword's subschema MUST also be valid against the subschema value of + * the "else" keyword, if present. + *

+ * If annotations (Section 3.3) are being collected, they are collected from this keyword's subschema in the usual way, + * including when the keyword is present without either "then" or "else". + */ + @Nullable + @JsonProperty("if") + public AsyncAPISchema ifValue; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * When "if" is present, and the instance successfully validates against its subschema, then valiation succeeds against + * this keyword if the instance also successfully validates against this keyword's subschema. + *

+ * This keyword has no effect when "if" is absent, or when the instance fails to validate against its subschema. + * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection + * purposes, in such cases. + */ + @Nullable + @JsonProperty("then") + public AsyncAPISchema thenValue; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * When "if" is present, and the instance fails to validate against its subschema, then valiation succeeds against this + * keyword if the instance successfully validates against this keyword's subschema. + *

+ * This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. + * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection + * purposes, in such cases. + */ + @Nullable + @JsonProperty("else") + public AsyncAPISchema elseValue; + + /* + Keywords for Applying Subschemas With Boolean Logic + */ + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against all schemas defined + * by this keyword's value. + * + * @see allOf + */ + @Nullable + @JsonProperty("allOf") + public List allOf; + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against at least one schema + * defined by this keyword's value. + * + * @see anyOf + */ + @Nullable + @JsonProperty("anyOf") + public List anyOf; + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against exactly one schema + * defined by this keyword's value. + * + * @see oneOf + */ + @Nullable + @JsonProperty("oneOf") + public List oneOf; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. + * + * @see not + */ + @Nullable + @JsonProperty("not") + public AsyncAPISchema not; + + /* + Semantic Validation With "format" + */ + + /** + * The "format" keyword functions as both an annotation (Section 3.3) and as an assertion (Section 3.2). + *

+ * While no special effort is required to implement it as an annotation conveying semantic meaning, + * implementing validation is non-trivial. + * + * @see Semantic Validation With "format" + */ + @Nullable + @JsonProperty("format") + public String format; + + /* + String-Encoding Non-JSON Data + */ + + /** + * If the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and + * decoded using the encoding named by this property. RFC 2045, + * Sec 6.1 [RFC2045] lists the possible values for this property. + *

+ * The value of this property MUST be a string. + *

+ * The value of this property SHOULD be ignored if the instance described is not a string. + * + * @see contentEncoding + */ + @Nullable + @JsonProperty("contentEncoding") + private String contentEncoding; + + /** + * The value of this property must be a media type, as defined by RFC 2046 [RFC2046]. + * This property defines the media type of instances which this schema defines. + *

+ * The value of this property MUST be a string. + *

+ * The value of this property SHOULD be ignored if the instance described is not a string. + *

+ * If the "contentEncoding" property is not present, but the instance value is a string, then the value of this property SHOULD specify a + * text document type, and the character set SHOULD be the character set into which the JSON string value was decoded (for which the default + * is Unicode). + * + * @see contentMediaType + */ + @Nullable + @JsonProperty("contentMediaType") + private String contentMediaType; + + /* + Schema Re-Use With "definitions" + */ + + /** + * The "definitions" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas + * into a more general schema. + *

+ * The keyword does not directly affect the validation result. + *

+ * This keyword's value MUST be an object. Each member value of this object MUST be a valid JSON Schema. + *

+ * Example: + *

+     * {
+     *   "type": "array",
+     *   "items": {
+     *     "$ref": "#/definitions/positiveInteger"
+     *   },
+     *   "definitions": {
+     *     "positiveInteger": {
+     *       "type": "integer",
+     *       "exclusiveMinimum": 0
+     *     }
+     *   }
+     * }
+     * 
+ * + * @see Schema Re-Use With "definitions" + */ + @Nullable + @JsonProperty("definitions") + private Map definitions; + + /* + Schema Annotations + */ + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A title will preferably be short + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("title") + public String title; + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A description will provide explanation about the purpose of the instance described by this schema. + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("description") + public String description; + + /** + * There are no restrictions placed on the value of this keyword. + * When multiple occurrences of this keyword are applicable to a single sub-instance, + * implementations SHOULD remove duplicates. + *

+ * This keyword can be used to supply a default JSON value associated with a particular schema. + *

+ * It is RECOMMENDED that a default value be valid against the associated schema. + * + * @see "default" + */ + @Nullable + @JsonProperty("default") + @JsonDeserialize(using = AsyncAPISchemaAnyValueDeserializer.class) + public Object defaultValue; + + /** + * The value of this keyword MUST be a boolean. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, + * the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. + *

+ * If "readOnly" has a value of boolean true, it indicates that the value of the instance is managed exclusively by the owning authority, + * and attempts by an application to modify the value of this property are expected to be ignored or rejected by that owning authority. + *

+ * An instance document that is marked as "readOnly for the entire document MAY be ignored if sent to the owning authority, or MAY + * result in an error, at the authority's discretion. + *

+ * For example, "readOnly" would be used to mark a database-generated serial number as read-only, while "writeOnly" would be used to mark a + * password input field. + *

+ * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget + * that hides input values as they are typed for write-only fields. + *

+ * Omitting this keyword has the same behavior as values of false. + * + * @see "readOnly" and "writeOnly" + */ + @Nullable + @JsonProperty("readOnly") + public Boolean readOnly; + + /** + * The value of this keyword MUST be a boolean. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, + * the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. + *

+ * If "writeOnly" has a value of boolean true, it indicates that the value is never present when the instance is retrieved from the owning + * authority. It can be present when sent to the owning authority to update or create the document (or the resource it represents), but it + * will not be included in any updated or newly created version of the instance. + *

+ * An instance document that is marked as "writeOnly" for the entire document MAY be returned as a blank document of some sort, + * or MAY produce an error upon retrieval, or have the retrieval request ignored, at the authority's discretion. + *

+ * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget + * that hides input values as they are typed for write-only fields. + *

+ * Omitting this keyword has the same behavior as values of false. + * + * @see "readOnly" and "writeOnly" + */ + @Nullable + @JsonProperty("writeOnly") + public Boolean writeOnly; + + /** + * The value of this keyword MUST be an array. + *

+ * There are no restrictions placed on the values within the array. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, implementations MUST provide + * a flat array of all values rather than an array of arrays. + *

+ * This keyword can be used to provide sample JSON values associated with a particular schema, for the purpose of + * illustrating usage. + *

+ * It is RECOMMENDED that these values be valid against the associated schema. + *

+ * Implementations MAY use the value(s) of "default", if present, as an additional example. + *

+ * If "examples" is absent, "default" MAY still be used in this manner. + * + * @see "examples" + */ + @Nullable + @JsonProperty("examples") + @JsonDeserialize(contentUsing = AsyncAPISchemaAnyValueDeserializer.class) + public List examples; + + /* + AsyncAPI related properties + */ + + /** + * Adds support for polymorphism. + *

+ * The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. + *

+ * The property name used MUST be defined at this schema and it MUST be in the required property list. + *

+ * When used, the value MUST be the name of this schema or any schema that inherits it. + *

+ * See Composition and Inheritance for more details. + * + * @see Schema Composition + */ + @Nullable + @JsonProperty("discriminator") + private String discriminator; + + /** + * Additional external documentation for this schema. + */ + @Nullable + @JsonProperty("externalDocs") + @JsonDeserialize(using = ExternalDocumentationDeserializer.class) + private Object externalDocs; + + /** + * Specifies that a schema is deprecated and SHOULD be transitioned out of usage. + *

+ * Default value is false. + */ + @Nullable + @JsonProperty("deprecated") + private Boolean deprecated; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java new file mode 100644 index 00000000..71eba2b0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java @@ -0,0 +1,815 @@ +package com.asyncapi.v3.schema; + +import com.asyncapi.v3.jackson.schema.JsonSchemaAnyValueDeserializer; +import com.asyncapi.v3.jackson.schema.JsonSchemaItemsDeserializer; +import com.asyncapi.v3.jackson.schema.JsonSchemaPropertiesDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +import javax.validation.constraints.Min; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * JSON Schema Draft 07 + * + * @see Draft 07 JSON Schema + * @see Draft 07 JSON Schema Validation + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class JsonSchema { + + /** + * JSON Schema ID. + *

+ * format: uri-reference + */ + @Nullable + @JsonProperty("$id") + @JsonPropertyDescription("JSON Schema ID.") + public String id; + + /** + * JSON Schema to use for validation. + *

+ * format: uri + */ + @Nullable + @JsonProperty("$schema") + @JsonPropertyDescription("JSON Schema to use for validation.") + public String schema; + + /** + * Reference to JSON Schema definition. + *

+ * format: uri-reference + */ + @Nullable + @JsonProperty("$ref") + @JsonPropertyDescription("Reference to JSON Schema definition.") + private String ref; + + /** + * JSON Schema comment. + */ + @Nullable + @JsonProperty("$comment") + @JsonPropertyDescription("JSON Schema comment.") + private String comment; + + /* + Validation Keywords for Any Instance Type + */ + + /** + * The value of this keyword MUST be either a string or an array. + *

+ * If it is an array, elements of the array MUST be strings and MUST be unique. + *

+ * String values MUST be one of the six primitive types: + *

    + *
  • null
  • + *
  • boolean
  • + *
  • object
  • + *
  • array
  • + *
  • number
  • + *
  • string
  • + *
+ *

+ * or "integer" which matches any number with a zero fractional part. + *

+ * An instance validates if and only if the instance is in any of the sets listed for this keyword. + * + * @see type + */ + @Nullable + @JsonProperty("type") + @JsonPropertyDescription("JSON Schema type.") + public Object type; + + /** + * The value of this keyword MUST be an array. + *

+ * This array SHOULD have at least one element. Elements in the array SHOULD be unique. + *

+ * An instance validates successfully against this keyword if its value + * is equal to one of the elements in this keyword's array value. + *
+ * Elements in the array might be of any value, including null. + * + * @see enum + */ + @Nullable + @JsonProperty("enum") + @JsonPropertyDescription("JSON Schema enum values.") + public List enumValue; + + /** + * The value of this keyword MAY be of any type, including null. + *

+ * An instance validates successfully against this keyword if its value is equal to the value of the keyword. + * + * @see const + */ + @Nullable + @JsonProperty("const") + @JsonPropertyDescription("JSON Schema const value") + @JsonDeserialize(using = JsonSchemaAnyValueDeserializer.class) + public Object constValue; + + /* + Validation Keywords for Numeric Instances (number and integer) + */ + + /** + * The value of "multipleOf" MUST be a number, strictly greater than 0. + *

+ * A numeric instance is valid only if division by this keyword's value results in an integer. + * + * @see multipleOf + */ + @Nullable + @Min( + value = 1, + message = "The value of \"multipleOf\" MUST be a number, strictly greater than 0." + ) + @JsonProperty("multipleOf") + public Number multipleOf; + + /** + * The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. + *

+ * If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". + * + * @see maximum + */ + @Nullable + @JsonProperty("maximum") + public BigDecimal maximum; + + /** + * The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance. + *
+ * If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". + * + * @see exclusiveMaximum + */ + @Nullable + @JsonProperty("exclusiveMaximum") + public BigDecimal exclusiveMaximum; + + /** + * The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. + *
+ * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". + * + * @see minimum + */ + @Nullable + @JsonProperty("minimum") + public BigDecimal minimum; + + /** + * The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. + *
+ * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". + * + * @see exclusiveMinimum + */ + @Nullable + @JsonProperty("exclusiveMinimum") + public BigDecimal exclusiveMinimum; + + /* + Validation Keywords for Strings + */ + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. + *

+ * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. + * + * @see maxLength + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxLength\" MUST be a non-negative integer." + ) + @JsonProperty("maxLength") + public Integer maxLength; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. + *

+ * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minLength + */ + @Nullable + @Min( + value = 0, + message = "The value of \"minLength\" MUST be a non-negative integer." + ) + @JsonProperty("minLength") + public Integer minLength; + + /** + * The value of this keyword MUST be a string. + *

+ * This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. + *

+ * A string instance is considered valid if the regular expression matches the instance successfully. + * Recall: regular expressions are not implicitly anchored. + * + * @see pattern + */ + @Nullable + @JsonProperty("pattern") + public String pattern; + + /* + Validation Keywords for Arrays + */ + + /** + * The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. + *

+ * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + *

+ * If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. + *

+ * If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same + * position, if any. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see items + */ + @Nullable + @JsonProperty("items") + @JsonDeserialize(using = JsonSchemaItemsDeserializer.class) + public Object items; + + /** + * The value of "additionalItems" MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + *

+ * If "items" is an array of schemas, validation succeeds if every instance element at a position greater than the size of "items" + * validates against "additionalItems". + *

+ * Otherwise, "additionalItems" MUST be ignored, as the "items" schema (possibly the default value of an empty schema) is applied + * to all elements. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see additionalItems + */ + @Nullable + @JsonProperty("additionalItems") + public JsonSchema additionalItems; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. + * + * @see maxItems + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxItems\" MUST be a non-negative integer." + ) + @JsonProperty("maxItems") + public Integer maxItems; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minItems + */ + @Nullable + @JsonProperty("minItems") + public Integer minItems; + + /** + * The value of this keyword MUST be a boolean. + *

+ * If this keyword has boolean value false, the instance validates successfully. + *

+ * If it has boolean value true, the instance validates successfully if all of its elements are unique. + *

+ * Omitting this keyword has the same behavior as a value of false. + * + * @see uniqueItems + */ + @Nullable + @JsonProperty("uniqueItems") + public Boolean uniqueItems; + + /** + * The value of this keyword MUST be a valid JSON Schema. + *
+ * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. + * + * @see contains + */ + @Nullable + @JsonProperty("contains") + public JsonSchema contains; + + /* + Validation Keywords for Objects + */ + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, + * the value of this keyword. + * + * @see maxProperties + */ + @Nullable + @Min( + value = 0, + message = "The value of \"maxProperties\" MUST be a non-negative integer." + ) + @JsonProperty("maxProperties") + public Integer maxProperties; + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, + * the value of this keyword. + *

+ * Omitting this keyword has the same behavior as a value of 0. + * + * @see minProperties + */ + @Nullable + @Min( + value = 0, + message = "The value of \"minProperties\" MUST be a non-negative integer." + ) + @JsonProperty("minProperties") + public Integer minProperties; + + /** + * The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique. + *

+ * An object instance is valid against this keyword if every item in the array is the name of a property in the instance. + *

+ * Omitting this keyword has the same behavior as an empty array. + * + * @see required + */ + @Nullable + @JsonProperty("required") + public List required; + + /** + * The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. + *

+ * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, + * the child instance for that name successfully validates against the corresponding schema. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see properties + */ + @Nullable + @JsonProperty("properties") + @JsonDeserialize(contentUsing = JsonSchemaPropertiesDeserializer.class) + public Map properties; + + /** + * The value of "patternProperties" MUST be an object. + *

+ * Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. + *

+ * Each property value of this object MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. Validation of the primitive instance type against this keyword always succeeds. + *

+ * Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name + * in this keyword's value, the child instance for that name successfully validates against each schema that corresponds + * to a matching regular expression. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see patternProperties + */ + @Nullable + @JsonProperty("patternProperties") + public Map patternProperties; + + /** + * The value of "additionalProperties" MUST be a valid JSON Schema. + *

+ * This keyword determines how child instances validate for objects, and does not directly validate the immediate + * instance itself. + *

+ * Validation with "additionalProperties" applies only to the child values of instance names that do not match any + * names in "properties", and do not match any regular expression in "patternProperties". + *

+ * For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see additionalProperties + */ + @Nullable + @JsonProperty("additionalProperties") + public JsonSchema additionalProperties; + + /** + * [CREF1] - This keyword may be split into two, with the variation that uses an array of property names rather than a + * subschema getting a new name. The dual behavior is confusing and relatively difficult to implement. In the previous + * draft, we proposed dropping the keyword altogether, or dropping one of its forms, but we received feedback in support of + * keeping it. See issues #442 and #528 at https://github.com/json-schema-org/json-schema-spec/issues for further discussion. + * Further feedback is encouraged. + *
+ *
+ *
+ * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. + *

+ * This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array + * or a valid JSON Schema. + *

+ * If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate + * against the dependency value. + *

+ * If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. + *

+ * If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance. + *

+ * Omitting this keyword has the same behavior as an empty object. + * + * @see dependencies + */ + @Nullable + @JsonProperty("dependencies") + public Object dependencies; + + /** + * The value of "propertyNames" MUST be a valid JSON Schema. + *

+ * If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema. + *

+ * Note the property name that the schema is testing will always be a string. + *

+ * Omitting this keyword has the same behavior as an empty schema. + * + * @see propertyNames + */ + @Nullable + @JsonProperty("propertyNames") + public JsonSchema propertyNames; + + /* + Keywords for Applying Subschemas Conditionally + */ + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * This validation outcome of this keyword's subschema has no direct effect on the overall validation result. + * Rather, it controls which of the "then" or "else" keywords are evaluated. + *

+ * Instances that successfully validate against this keyword's subschema MUST also be valid against the subschema + * value of the "then" keyword, if present. + *

+ * Instances that fail to validate against this keyword's subschema MUST also be valid against the subschema value of + * the "else" keyword, if present. + *

+ * If annotations (Section 3.3) are being collected, they are collected from this keyword's subschema in the usual way, + * including when the keyword is present without either "then" or "else". + */ + @Nullable + @JsonProperty("if") + public JsonSchema ifValue; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * When "if" is present, and the instance successfully validates against its subschema, then valiation succeeds against + * this keyword if the instance also successfully validates against this keyword's subschema. + *

+ * This keyword has no effect when "if" is absent, or when the instance fails to validate against its subschema. + * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection + * purposes, in such cases. + */ + @Nullable + @JsonProperty("then") + public JsonSchema thenValue; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * When "if" is present, and the instance fails to validate against its subschema, then valiation succeeds against this + * keyword if the instance successfully validates against this keyword's subschema. + *

+ * This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. + * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection + * purposes, in such cases. + */ + @Nullable + @JsonProperty("else") + public JsonSchema elseValue; + + /* + Keywords for Applying Subschemas With Boolean Logic + */ + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against all schemas defined + * by this keyword's value. + * + * @see allOf + */ + @Nullable + @JsonProperty("allOf") + public List allOf; + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against at least one schema + * defined by this keyword's value. + * + * @see anyOf + */ + @Nullable + @JsonProperty("anyOf") + public List anyOf; + + /** + * This keyword's value MUST be a non-empty array. + *

+ * Each item of the array MUST be a valid JSON Schema. + *

+ * An instance validates successfully against this keyword if it validates successfully against exactly one schema + * defined by this keyword's value. + * + * @see oneOf + */ + @Nullable + @JsonProperty("oneOf") + public List oneOf; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

+ * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. + * + * @see not + */ + @Nullable + @JsonProperty("not") + public JsonSchema not; + + /* + Semantic Validation With "format" + */ + + /** + * The "format" keyword functions as both an annotation (Section 3.3) and as an assertion (Section 3.2). + *

+ * While no special effort is required to implement it as an annotation conveying semantic meaning, + * implementing validation is non-trivial. + * + * @see Semantic Validation With "format" + */ + @Nullable + @JsonProperty("format") + public String format; + + /* + String-Encoding Non-JSON Data + */ + + /** + * If the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and + * decoded using the encoding named by this property. RFC 2045, + * Sec 6.1 [RFC2045] lists the possible values for this property. + *

+ * The value of this property MUST be a string. + *

+ * The value of this property SHOULD be ignored if the instance described is not a string. + * + * @see contentEncoding + */ + @Nullable + @JsonProperty("contentEncoding") + private String contentEncoding; + + /** + * The value of this property must be a media type, as defined by RFC 2046 [RFC2046]. + * This property defines the media type of instances which this schema defines. + *

+ * The value of this property MUST be a string. + *

+ * The value of this property SHOULD be ignored if the instance described is not a string. + *

+ * If the "contentEncoding" property is not present, but the instance value is a string, then the value of this property SHOULD specify a + * text document type, and the character set SHOULD be the character set into which the JSON string value was decoded (for which the default + * is Unicode). + * + * @see contentMediaType + */ + @Nullable + @JsonProperty("contentMediaType") + private String contentMediaType; + + /* + Schema Re-Use With "definitions" + */ + + /** + * The "definitions" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas + * into a more general schema. + *

+ * The keyword does not directly affect the validation result. + *

+ * This keyword's value MUST be an object. Each member value of this object MUST be a valid JSON Schema. + *

+ * Example: + *

+     * {
+     *   "type": "array",
+     *   "items": {
+     *     "$ref": "#/definitions/positiveInteger"
+     *   },
+     *   "definitions": {
+     *     "positiveInteger": {
+     *       "type": "integer",
+     *       "exclusiveMinimum": 0
+     *     }
+     *   }
+     * }
+     * 
+ * + * @see Schema Re-Use With "definitions" + */ + @Nullable + @JsonProperty("definitions") + private Map definitions; + + /* + Schema Annotations + */ + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A title will preferably be short + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("title") + public String title; + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A description will provide explanation about the purpose of the instance described by this schema. + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("description") + public String description; + + /** + * There are no restrictions placed on the value of this keyword. + * When multiple occurrences of this keyword are applicable to a single sub-instance, + * implementations SHOULD remove duplicates. + *

+ * This keyword can be used to supply a default JSON value associated with a particular schema. + *

+ * It is RECOMMENDED that a default value be valid against the associated schema. + * + * @see "default" + */ + @Nullable + @JsonProperty("default") + @JsonDeserialize(using = JsonSchemaAnyValueDeserializer.class) + public Object defaultValue; + + /** + * The value of this keyword MUST be a boolean. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, + * the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. + *

+ * If "readOnly" has a value of boolean true, it indicates that the value of the instance is managed exclusively by the owning authority, + * and attempts by an application to modify the value of this property are expected to be ignored or rejected by that owning authority. + *

+ * An instance document that is marked as "readOnly for the entire document MAY be ignored if sent to the owning authority, or MAY + * result in an error, at the authority's discretion. + *

+ * For example, "readOnly" would be used to mark a database-generated serial number as read-only, while "writeOnly" would be used to mark a + * password input field. + *

+ * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget + * that hides input values as they are typed for write-only fields. + *

+ * Omitting this keyword has the same behavior as values of false. + * + * @see "readOnly" and "writeOnly" + */ + @Nullable + @JsonProperty("readOnly") + public Boolean readOnly; + + /** + * The value of this keyword MUST be a boolean. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, + * the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. + *

+ * If "writeOnly" has a value of boolean true, it indicates that the value is never present when the instance is retrieved from the owning + * authority. It can be present when sent to the owning authority to update or create the document (or the resource it represents), but it + * will not be included in any updated or newly created version of the instance. + *

+ * An instance document that is marked as "writeOnly" for the entire document MAY be returned as a blank document of some sort, + * or MAY produce an error upon retrieval, or have the retrieval request ignored, at the authority's discretion. + *

+ * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget + * that hides input values as they are typed for write-only fields. + *

+ * Omitting this keyword has the same behavior as values of false. + * + * @see "readOnly" and "writeOnly" + */ + @Nullable + @JsonProperty("writeOnly") + public Boolean writeOnly; + + /** + * The value of this keyword MUST be an array. + *

+ * There are no restrictions placed on the values within the array. + *

+ * When multiple occurrences of this keyword are applicable to a single sub-instance, implementations MUST provide + * a flat array of all values rather than an array of arrays. + *

+ * This keyword can be used to provide sample JSON values associated with a particular schema, for the purpose of + * illustrating usage. + *

+ * It is RECOMMENDED that these values be valid against the associated schema. + *

+ * Implementations MAY use the value(s) of "default", if present, as an additional example. + *

+ * If "examples" is absent, "default" MAY still be used in this manner. + * + * @see "examples" + */ + @Nullable + @JsonProperty("examples") + @JsonDeserialize(contentUsing = JsonSchemaAnyValueDeserializer.class) + public List examples; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java deleted file mode 100644 index 62dc3d8a..00000000 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.asyncapi.v3.schema; - -import com.asyncapi.v3.ExtendableObject; -import lombok.*; -import org.jetbrains.annotations.NotNull; - -/** - * The Multi Format Schema Object represents a schema definition. It differs from the {@link Schema} in that it supports - * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). - * - * @see Multi Format Schema - * @see Schema - * @author Pavel Bodiachevskii - * @version 3.0.0 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class MultiFormatSchema extends ExtendableObject { - - /** - * Required. - *

- * 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 {@link com.asyncapi.v3._0_0.model.AsyncAPI#getAsyncapi()} version string. - *

- * In such a case, this would make the Multi Format Schema Object equivalent to the {@link Schema}. - *

- * When using {@link com.asyncapi.v3.Reference} within the {@link #getSchema()}, the schemaFormat of the resource being referenced MUST match - * the schemaFormat of the {@link #getSchema()} that contains the initial reference. - *

- * For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match. - *

- *

- * Check out the supported schema formats table for more information. - * Custom values are allowed but their implementation is OPTIONAL. - * A custom value MUST NOT refer to one of the schema formats listed in the table. - *

- *

- * When using {@link com.asyncapi.v3.Reference} within the {@link #getSchema()}, the schemaFormat of the referenced resource MUST - * match the schemaFormat of the schema containing the reference. - * - * @see Schema formats table - */ - @NotNull - private String schemaFormat; - - /** - * Required. - *

- * Definition of the message payload. - *

- * It can be of any type but defaults to {@link Schema}. - *

- * It MUST match the schema format defined in {@link #getSchemaFormat()}, 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. - */ - @NotNull - private Object schema; - -} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java deleted file mode 100644 index f71302ac..00000000 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ /dev/null @@ -1,692 +0,0 @@ -package com.asyncapi.v3.schema; - -import com.asyncapi.v3.jackson.SchemaItemsDeserializer; -import com.asyncapi.v3.ExtendableObject; -import com.asyncapi.v3.jackson.schema.SchemasAdditionalPropertiesDeserializer; -import com.asyncapi.v3._0_0.model.ExternalDocumentation; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.*; -import org.jetbrains.annotations.Nullable; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -// TODO: Finish. Not all properties are present. -// TODO: Write tests - -/** - * The Schema Object allows the definition of input and output data types. These types can be objects, - * but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 07. - *
- * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. - * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. - *

- * The AsyncAPI Schema Object is a JSON Schema vocabulary which extends JSON Schema Core and Validation vocabularies. - * As such, any keyword available for those vocabularies is by definition available in AsyncAPI, and will work the - * exact same way, including but not limited to defined properties. - *

- * New properties may appear in this class after community requests. - * - * @see AnyncAPI Schema Object - * @author Pavel Bodiachevskii - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class Schema extends ExtendableObject { - - /* - Schema Annotations - - Schema validation is a useful mechanism for annotating instance data - with additional information. The rules for determining when and how - annotations are associated with an instance are outlined in section - 3.3. - - These general-purpose annotation keywords provide commonly used - information for documentation and user interface display purposes. - They are not intended to form a comprehensive set of features. - Rather, additional vocabularies can be defined for more complex - annotation-based applications. - */ - - /** - * The value of these keyword MUST be a string. - *

- * This keywords can be used to decorate a user interface with information about the data produced by this user - * interface. - *

- * A title will preferably be short - */ - @Nullable - @JsonProperty - public String title; - - /** - * The value of these keyword MUST be a string. - *

- * This property definition was adjusted to the AsyncAPI Specification. - * CommonMark syntax can be used for rich text representation. - *

- * This keywords can be used to decorate a user interface with information about the data produced by this user - * interface. - *

- * A description will provide explanation about the purpose of the instance described by this schema. - */ - @Nullable - @JsonProperty - public String description; - - /** - * There are no restrictions placed on the value of this keyword. When multiple occurrences of this keyword are - * applicable to a single sub-instance, implementations SHOULD remove duplicates. - *

- * This keyword can be used to supply a default JSON value associated with a particular schema. - * It is RECOMMENDED that a default value be valid against the associated schema. - *

- * This property definition was adjusted to the AsyncAPI Specification. - * The default value represents what would be assumed by the consumer of the input as the value of the schema if one - * is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at - * the same level. For example, of type is string, then default can be "foo" but cannot be 1. - */ - @Nullable - @JsonProperty("default") - public Object defaultValue; - - /** - * The value of this keyword MUST be a boolean. When multiple occurrences of this keyword are applicable to a - * single sub-instance, the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. - *

- * If "readOnly" has a value of boolean true, it indicates that the value of the instance is managed exclusively by the owning authority, - * and attempts by an application to modify the value of this property are expected to be ignored or rejected by that owning authority. - *

- * An instance document that is marked as "readOnly for the entire document MAY be ignored if sent to the owning authority, or MAY - * result in an error, at the authority's discretion. - *

- * For example, "readOnly" would be used to mark a database-generated serial number as read-only, while "writeOnly" would be used to mark a - * password input field. - *

- * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget - * that hides input values as they are typed for write-only fields. - *

- * Omitting this keyword has the same behavior as values of false. - */ - @Nullable - @JsonProperty - public Boolean readOnly; - - /** - * The value of this keyword MUST be a boolean. When multiple occurrences of this keyword are applicable to a - * single sub-instance, the resulting value MUST be true if any occurrence specifies a true value, and MUST be false otherwise. - *

- * If "writeOnly" has a value of boolean true, it indicates that the value is never present when the instance is retrieved from the owning - * authority. It can be present when sent to the owning authority to update or create the document (or the resource it represents), but it - * will not be included in any updated or newly created version of the instance. - *

- * An instance document that is marked as "writeOnly" for the entire document MAY be returned as a blank document of some sort, or MAY - * produce an error upon retrieval, or have the retrieval request ignored, at the authority's discretion. - *

- * This keyword can be used to assist in user interface instance generation. In particular, an application MAY choose to use a widget - * that hides input values as they are typed for write-only fields. - *

- * Omitting this keyword has the same behavior as values of false. - */ - @Nullable - @JsonProperty - public Boolean writeOnly; - - /** - * The value of this keyword MUST be an array. There are no restrictions placed on the values within the array. - * When multiple occurrences of this keyword are applicable to a single sub-instance, implementations MUST provide - * a flat array of all values rather than an array of arrays. - *

- * This keyword can be used to provide sample JSON values associated with a particular schema, for the purpose of - * illustrating usage. It is RECOMMENDED that these values be valid against the associated schema. - *

- * Implementations MAY use the value(s) of "default", if present, as an additional example. If "examples" is absent, - * "default" MAY still be used in this manner. - */ - @Nullable - @JsonProperty - public List examples; - - @Nullable - @JsonProperty("$ref") - private String ref; - - /* - String-Encoding Non-JSON Data - - Foreword - - Properties defined in this section indicate that an instance contains - non-JSON data encoded in a JSON string. They describe the type of - content and how it is encoded. - - These properties provide additional information required to interpret - JSON data as rich multimedia documents. - - Implementation Requirements - - The content keywords function as both annotations (Section 3.3) and - as assertions (Section 3.2). While no special effort is required to - implement them as annotations conveying how applications can - interpret the data in the string, implementing validation of - conformance to the media type and encoding is non-trivial. - - Implementations MAY support the "contentMediaType" and - "contentEncoding" keywords as validation assertions. Should they - choose to do so, they SHOULD offer an option to disable validation - for these keywords. - */ - - /** - * If the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and - * decoded using the encoding named by this property. RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property. - *

- * The value of this property MUST be a string. - *

- * The value of this property SHOULD be ignored if the instance described is not a string. - */ - @Nullable - @JsonProperty - private String contentEncoding; - - /** - * The value of this property must be a media type, as defined by RFC 2046 [RFC2046]. This property defines the media - * type of instances which this schema defines. - *

- * The value of this property MUST be a string. - *

- * The value of this property SHOULD be ignored if the instance described is not a string. - *

- * If the "contentEncoding" property is not present, but the instance value is a string, then the value of this property SHOULD specify a - * text document type, and the character set SHOULD be the character set into which the JSON string value was decoded (for which the default - * is Unicode). - */ - @Nullable - @JsonProperty - private String contentMediaType; - - /* - Validation. - */ - - /* - Validation Keywords for Any Instance Type - */ - - /** - * The value of this keyword MUST be either a string or an array. If it is an array, elements of the array MUST - * be strings and MUST be unique. - *
- * String values MUST be one of the six primitive types ("null", "boolean", "object", "array", "number", or "string"), - * or "integer" which matches any number with a zero fractional part. - *
- * An instance validates if and only if the instance is in any of the sets listed for this keyword. - * - */ - @Nullable - @JsonProperty - public Object type; - - /** - * The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique. - *
- * An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value. - *
- * Elements in the array might be of any value, including null. - */ - @Nullable - @JsonProperty("enum") - public List enumValue; - - /** - * The value of this keyword MAY be of any type, including null. - *
- * An instance validates successfully against this keyword if its value is equal to the value of the keyword. - */ - @Nullable - @JsonProperty("const") - public Object constValue; - - /* - Validation Keywords for Numeric Instances (number and integer) - */ - - /** - * The value of "multipleOf" MUST be a number, strictly greater than 0. - *
- * A numeric instance is valid only if division by this keyword's value results in an integer. - */ - @Nullable - @JsonProperty - public Number multipleOf; - - /** - * The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. - *
- * If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". - */ - @Nullable - @JsonProperty - public BigDecimal maximum; - - /** - * The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance. - *
- * If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". - */ - @Nullable - @JsonProperty - public BigDecimal exclusiveMaximum; - - /** - * The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. - *
- * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". - */ - @Nullable - @JsonProperty - public BigDecimal minimum; - - /** - * The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. - *
- * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". - */ - @Nullable - @JsonProperty - public BigDecimal exclusiveMinimum; - - /* - Validation Keywords for Strings - */ - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. - *
- * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. - */ - @Nullable - @JsonProperty - public Integer maxLength; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. - *
- * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. - *
- * Omitting this keyword has the same behavior as a value of 0. - */ - @Nullable - @JsonProperty - public Integer minLength; - - /** - * The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according - * to the ECMA 262 regular expression dialect. - *
- * A string instance is considered valid if the regular expression matches the instance successfully. - * Recall: regular expressions are not implicitly anchored. - */ - @Nullable - @JsonProperty - public String pattern; - - /* - Validation Keywords for Arrays - */ - - /** - * The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. - *
- * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - *
- * If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. - *
- * If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same - * position, if any. - *
- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - @JsonDeserialize(using = SchemaItemsDeserializer.class) - public Object items; - - /** - * The value of "additionalItems" MUST be a valid JSON Schema. - *
- * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - *
- * If "items" is an array of schemas, validation succeeds if every instance element at a position greater than the size of "items" - * validates against "additionalItems". - *
- * Otherwise, "additionalItems" MUST be ignored, as the "items" schema (possibly the default value of an empty schema) is applied - * to all elements. - *
- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - public Schema additionalItems; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. - */ - @Nullable - @JsonProperty - public Integer maxItems; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. - *
- * Omitting this keyword has the same behavior as a value of 0. - */ - @Nullable - @JsonProperty - public Integer minItems; - - /** - * The value of this keyword MUST be a boolean. - *
- * If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, - * the instance validates successfully if all of its elements are unique. - *
- * Omitting this keyword has the same behavior as a value of false. - */ - @Nullable - @JsonProperty - public Boolean uniqueItems; - - /** - * The value of this keyword MUST be a valid JSON Schema. - *
- * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. - */ - @Nullable - @JsonProperty - public Schema contains; - - /* - Validation Keywords for Objects - */ - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, - * the value of this keyword. - */ - @Nullable - @JsonProperty - public Integer maxProperties; - - /** - * The value of this keyword MUST be a non-negative integer. - *

- * An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, - * the value of this keyword. - *

- * Omitting this keyword has the same behavior as a value of 0. - */ - @Nullable - @JsonProperty - public Integer minProperties; - - /** - * The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique. - *

- * An object instance is valid against this keyword if every item in the array is the name of a property in the instance. - *

- * Omitting this keyword has the same behavior as an empty array. - */ - @Nullable - @JsonProperty - public List required; - - /** - * The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema. - *

- * This keyword determines how child instances validate for objects, and does not directly validate the immediate - * instance itself. - *

- * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, - * the child instance for that name successfully validates against the corresponding schema. - *

- * Omitting this keyword has the same behavior as an empty object. - */ - @Nullable - @JsonProperty - public Map properties; - - /** - * The value of "patternProperties" MUST be an object. Each property name of this object SHOULD be a valid regular - * expression, according to the ECMA 262 regular expression dialect. Each property value of this object MUST be a - * valid JSON Schema. - *

- * This keyword determines how child instances validate for objects, and does not directly validate the immediate - * instance itself. Validation of the primitive instance type against this keyword always succeeds. - *

- * Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name - * in this keyword's value, the child instance for that name successfully validates against each schema that corresponds - * to a matching regular expression. - *

- * Omitting this keyword has the same behavior as an empty object. - */ - @Nullable - @JsonProperty - public Map patternProperties; - - /** - * The value of "additionalProperties" MUST be a valid JSON Schema. - *

- * This keyword determines how child instances validate for objects, and does not directly validate the immediate - * instance itself. - *

- * Validation with "additionalProperties" applies only to the child values of instance names that do not match any - * names in "properties", and do not match any regular expression in "patternProperties". - *

- * For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema. - *

- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - @JsonProperty - @JsonDeserialize(using = SchemasAdditionalPropertiesDeserializer.class) - public Object additionalProperties; - - /** - * [[CREF1: This keyword may be split into two, with the variation that uses an array of property names rather than a - * subschema getting a new name. The dual behavior is confusing and relatively difficult to implement. In the previous - * draft, we proposed dropping the keyword altogether, or dropping one of its forms, but we received feedback in support of - * keeping it. See issues #442 and #528 at https://github.com/json-schema-org/json-schema-spec/issues for further discussion. - * Further feedback is encouraged.]] - *

- * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. - *

- * This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array - * or a valid JSON Schema. - *

- * If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate - * against the dependency value. - *

- * If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. If the dependency - * key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance. - *

- * Omitting this keyword has the same behavior as an empty object. - */ - @Nullable - @JsonProperty - public Object dependencies; - - /** - * The value of "propertyNames" MUST be a valid JSON Schema. - *

- * If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema. - * Note the property name that the schema is testing will always be a string. - *

- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - @JsonProperty - public Schema propertyNames; - - /* - Keywords for Applying Subschemas Conditionally - - These keywords work together to implement conditional application of - a subschema based on the outcome of another subschema. - - These keywords MUST NOT interact with each other across subschema - boundaries. In other words, an "if" in one branch of an "allOf" MUST - NOT have an impact on a "then" or "else" in another branch. - - There is no default behavior for any of these keywords when they are - not present. In particular, they MUST NOT be treated as if present - with an empty schema, and when "if" is not present, both "then" and - "else" MUST be entirely ignored. - */ - - /** - * This keyword's value MUST be a valid JSON Schema. - *

- * This validation outcome of this keyword's subschema has no direct effect on the overall validation result. - * Rather, it controls which of the "then" or "else" keywords are evaluated. - *

- * Instances that successfully validate against this keyword's subschema MUST also be valid against the subschema - * value of the "then" keyword, if present. - *

- * Instances that fail to validate against this keyword's subschema MUST also be valid against the subschema value of - * the "else" keyword, if present. - *

- * If annotations (Section 3.3) are being collected, they are collected from this keyword's subschema in the usual way, - * including when the keyword is present without either "then" or "else". - */ - @JsonProperty("if") - @Nullable - public Schema ifValue; - - /** - * This keyword's value MUST be a valid JSON Schema. - *

- * When "if" is present, and the instance successfully validates against its subschema, then valiation succeeds against - * this keyword if the instance also successfully validates against this keyword's subschema. - *

- * This keyword has no effect when "if" is absent, or when the instance fails to validate against its subschema. - * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection - * purposes, in such cases. - */ - @JsonProperty("then") - @Nullable - public Schema thenValue; - - /** - * This keyword's value MUST be a valid JSON Schema. - *

- * When "if" is present, and the instance fails to validate against its subschema, then valiation succeeds against this - * keyword if the instance successfully validates against this keyword's subschema. - *

- * This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. - * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection - * purposes, in such cases. - */ - @JsonProperty("else") - @Nullable - public Schema elseValue; - - /* - Keywords for Applying Subschemas With Boolean Logic - */ - - /** - * This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. - *

- * An instance validates successfully against this keyword if it validates successfully against all schemas defined - * by this keyword's value. - */ - @Nullable - @JsonProperty - public List allOf; - - /** - * This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. - *

- * An instance validates successfully against this keyword if it validates successfully against at least one schema - * defined by this keyword's value. - */ - @Nullable - @JsonProperty - public List anyOf; - - /** - * This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. - *

- * An instance validates successfully against this keyword if it validates successfully against exactly one schema - * defined by this keyword's value. - */ - @Nullable - @JsonProperty - public List oneOf; - - /** - * This keyword's value MUST be a valid JSON Schema. - *

- * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. - */ - @Nullable - @JsonProperty - public Schema not; - - // Fields defined in AsyncAPI below - - /* - The following properties are taken from the JSON Schema definition but their definitions were adjusted to the AsyncAPI Specification. - */ - /** - * See Data Type Formats for further details. - * While relying on JSON Schema's defined formats, the AsyncAPI Specification offers a few additional predefined formats. - */ - @Nullable - @JsonProperty - public Object format; - - /* - In addition to the JSON Schema fields, the following AsyncAPI vocabulary fields MAY be used for further schema documentation: - */ - /** - * Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between - * other schema that inherit this schema. - *

- * The property name used MUST be defined at this schema and it MUST be in the required property list. - * When used, the value MUST be the name of this schema or any schema that inherits it. See Composition and Inheritance for more details. - */ - @Nullable - @JsonProperty - public String discriminator; - /** - * Additional external documentation for this schema. - */ - @Nullable - @JsonProperty - public ExternalDocumentation externalDocs; - - /** - * Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. - */ - @Nullable - @JsonProperty - public Boolean deprecated; - -} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java new file mode 100644 index 00000000..df2d7734 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java @@ -0,0 +1,182 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +/** + * Apache Avro Schema. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Specification + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "type", + defaultImpl = AvroSchemaUnion.class, + visible = true +) +@JsonSubTypes({ + @JsonSubTypes.Type(value = AvroSchema.class, names = { + AvroSchemaType.NULL, AvroSchemaType.BOOLEAN, AvroSchemaType.INT, AvroSchemaType.LONG, + AvroSchemaType.FLOAT, AvroSchemaType.DOUBLE, AvroSchemaType.BYTES, AvroSchemaType.STRING + }), + @JsonSubTypes.Type(value = AvroSchemaRecord.class, names = {AvroSchemaType.RECORD, AvroSchemaType.ERROR}), + @JsonSubTypes.Type(value = AvroSchemaArray.class, name = AvroSchemaType.ARRAY), + @JsonSubTypes.Type(value = AvroSchemaMap.class, name = AvroSchemaType.MAP), + @JsonSubTypes.Type(value = AvroSchemaEnum.class, name = AvroSchemaType.ENUM), + @JsonSubTypes.Type(value = AvroSchemaFixed.class, name = AvroSchemaType.FIXED), +}) +public class AvroSchema extends AvroSchemaMetadata { + + public AvroSchema() { + this.type = AvroSchemaType.NULL; + } + + public AvroSchema(@NotNull String avroType) { + this.type = avroType; + } + + public AvroSchema(@NotNull Builder builder) { + this.type = builder.type; + this.scale = builder.scale; + this.precision = builder.precision; + this.logicalType = builder.logicalType; + super.metadata = builder.metadata; + } + + /** + * Avro Schema type. + */ + @NotNull + @JsonProperty("type") + private String type; + + /** + * A JSON integer representing the scale (optional). + *

+ * If not specified the scale is 0. + */ + @Nullable + @JsonProperty("scale") + private Integer scale; + + /* + Type: bytes, fixed, decimal + */ + + /** + * A JSON integer representing the (maximum) precision of decimals stored in this type (required). + */ + @Nullable + @JsonProperty("precision") + private Integer precision; + + /** + * A logical type is an Avro primitive or complex type with extra attributes to represent a derived type. + *

+ * The attribute logicalType must always be present for a logical type, and is a string with the name of one + * of the logical types listed later in this section. Other attributes may be defined for particular logical types. + *

+ *

+ * A logical type is always serialized using its underlying Avro type so that values are encoded in exactly the same + * way as the equivalent Avro type that does not have a logicalType attribute. Language implementations may choose to + * represent logical types with an appropriate native type, although this is not required. + *

+ * Language implementations must ignore unknown logical types when reading, and should use the underlying Avro type. + *

+ * If a logical type is invalid, for example a decimal with scale greater than its precision, then implementations + * should ignore the logical type and use the underlying Avro type. + * + * @see Logical Types + */ + @Nullable + @JsonProperty("logicalType") + private String logicalType; + + public static Builder builder() { + + return new Builder() { + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroSchema build() { + return new AvroSchema(this); + } + + }; + + } + + public static abstract class Builder> { + + @NotNull + protected String type = AvroSchemaType.NULL; + + @Nullable + private Integer scale; + + @Nullable + private Integer precision; + + @Nullable + private String logicalType; + + @Nullable + protected Map metadata; + + @NotNull + public BuilderVariant type(@NotNull String type) { + this.type = type; + return getThis(); + } + + @NotNull + public BuilderVariant scale(@Nullable Integer scale) { + this.scale = scale; + return getThis(); + } + + @NotNull + public BuilderVariant precision(@Nullable Integer precision) { + this.precision = precision; + return getThis(); + } + + @NotNull + public BuilderVariant logicalType(@Nullable String logicalType) { + this.logicalType = logicalType; + return getThis(); + } + + @NotNull + public BuilderVariant metadata(@Nullable Map metadata) { + this.metadata = metadata; + return getThis(); + } + + @NotNull + protected abstract BuilderVariant getThis(); + + @NotNull + public abstract AvroSchemaVariant build(); + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java new file mode 100644 index 00000000..a51a1c4e --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java @@ -0,0 +1,110 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * @see Arrays + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaArray extends AvroSchema { + + public AvroSchemaArray() { + super(AvroSchemaType.ARRAY); + } + + public AvroSchemaArray(@NotNull Object items) { + super(AvroSchemaType.ARRAY); + this.items = items; + } + + public AvroSchemaArray( + @NotNull Object items, + @Nullable List defaultValue, + @Nullable Map metadata + ) { + super(AvroSchemaType.ARRAY); + this.items = items; + this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroSchemaArray(@NotNull Builder builder) { + super(AvroSchemaType.ARRAY); + + this.items = builder.items; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + + /** + * The schema of the array's items. + */ + @NotNull + @JsonProperty("items") + @JsonDeserialize(using = AvroTypeDeserializer.class) + private Object items; + + @Nullable + @JsonProperty("default") + private List defaultValue; + + @NotNull + @Override + public String getType() { + return AvroSchemaType.ARRAY; + } + + public void setType(@NotNull String type) { + super.setType(AvroSchemaType.ARRAY); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends AvroSchema.Builder { + + @NotNull + private Object items = Collections.emptyList(); + + @Nullable + private List defaultValue; + + @NotNull + public Builder items(@NotNull Object items) { + this.items = items; + return this; + } + + @NotNull + public Builder defaultValue(@NotNull List defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroSchemaArray build() { + return new AvroSchemaArray(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java new file mode 100644 index 00000000..965239d8 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java @@ -0,0 +1,190 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Avro Enum Schema + * + * @see Enums + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaEnum extends AvroSchema { + + public AvroSchemaEnum() { + super(AvroSchemaType.ENUM); + } + + public AvroSchemaEnum( + @NotNull String name, + @Nullable String namespace, + @Nullable String doc, + @NotNull List<@NotNull String> symbols, + @Nullable List<@NotNull String> aliases, + @Nullable Object defaultValue, + @Nullable Map metadata + ) { + super(AvroSchemaType.ENUM); + + this.name = name; + this.namespace = namespace; + this.doc = doc; + this.symbols = symbols; + this.aliases = aliases; + this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroSchemaEnum(@NotNull Builder builder) { + super(AvroSchemaType.ENUM); + + this.name = builder.name; + this.namespace = builder.namespace; + this.doc = builder.doc; + this.symbols = builder.symbols; + this.aliases = builder.aliases; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + + @NotNull + @JsonProperty("name") + private String name = ""; + + @Nullable + @JsonProperty("namespace") + private String namespace; + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + @JsonProperty("doc") + private String doc; + + /** + * A JSON array, listing symbols, as JSON strings (required). + *

+ * All symbols in an enum must be unique; duplicates are prohibited. + *

+ * Every symbol must match the regular expression [A-Za-z_][A-Za-z0-9_]* (the same requirement as for names). + */ + @NotNull + @JsonProperty("symbols") + private List<@NotNull String> symbols = Collections.emptyList(); + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + @JsonProperty("aliases") + private List<@NotNull String> aliases; + + /** + * A default value for this enumeration, used during resolution when the reader encounters a symbol + * from the writer that isn't defined in the reader's schema (optional). + *

+ * The value provided here must be a JSON string that's a member of the symbols array. + *

+ * See documentation on schema resolution for how this gets used. + */ + @Nullable + @JsonProperty("default") + @JsonDeserialize(using = AvroTypeDeserializer.class) + private Object defaultValue; + + @NotNull + @Override + public String getType() { + return AvroSchemaType.ENUM; + } + + public void setType(@NotNull String type) { + super.setType(AvroSchemaType.ENUM); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends AvroSchema.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private String doc; + + @NotNull + private List<@NotNull String> symbols = Collections.emptyList(); + + @Nullable + private List<@NotNull String> aliases; + + @Nullable + private Object defaultValue; + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder symbols(@NotNull List<@NotNull String> symbols) { + this.symbols = symbols; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroSchemaEnum build() { + return new AvroSchemaEnum(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java new file mode 100644 index 00000000..18e8abc9 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java @@ -0,0 +1,140 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Map; + +/** + * @see Arrays + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaFixed extends AvroSchema { + + public AvroSchemaFixed() { + super(AvroSchemaType.FIXED); + } + + public AvroSchemaFixed( + @NotNull String name, + @Nullable String namespace, + @Nullable List<@NotNull String> aliases, + @NotNull Integer size, + @Nullable Map metadata + ) { + super(AvroSchemaType.FIXED); + + this.name = name; + this.namespace = namespace; + this.aliases = aliases; + this.size = size; + this.metadata = metadata; + } + + public AvroSchemaFixed(@NotNull Builder builder) { + super(AvroSchemaType.FIXED); + + this.name = builder.name; + this.namespace = builder.namespace; + this.aliases = builder.aliases; + this.size = builder.size; + this.metadata = builder.metadata; + } + + @NotNull + @JsonProperty("name") + private String name; + + /** + * A JSON string that qualifies the name. + */ + @Nullable + @JsonProperty("namespace") + private String namespace; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + @JsonProperty("aliases") + private List<@NotNull String> aliases; + + /** + * An integer, specifying the number of bytes per value (required). + */ + @NotNull + @JsonProperty("size") + private Integer size; + + @NotNull + @Override + public String getType() { + return AvroSchemaType.FIXED; + } + + public void setType(@NotNull String type) { + super.setType(AvroSchemaType.FIXED); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends AvroSchema.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private List<@NotNull String> aliases; + + @NotNull + private Integer size = 0; + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder size(@NotNull Integer size) { + this.size = size; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroSchemaFixed build() { + return new AvroSchemaFixed(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java new file mode 100644 index 00000000..98f4dd8f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java @@ -0,0 +1,34 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AvroSchemaLogicalType { + + @JsonProperty("decimal") + public static final String DECIMAL = "decimal"; + + @JsonProperty("big-decimal") + public static final String BIG_DECIMAL = "big-decimal"; + + @JsonProperty("uuid") + public static final String UUID = "uuid"; + + @JsonProperty("date") + public static final String DATE = "date"; + + @JsonProperty("time-millis") + public static final String TIME_MILLIS = "time-millis"; + + @JsonProperty("time-micros") + public static final String TIME_MICROS = "time-micros"; + + @JsonProperty("timestamp-millis") + public static final String TIMESTAMP_MILLIS = "timestamp-millis"; + + @JsonProperty("timestamp-micros") + public static final String TIMESTAMP_MICROS = "timestamp-micros"; + + @JsonProperty("duration") + public static final String DURATION = "duration"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java new file mode 100644 index 00000000..1ab2667f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java @@ -0,0 +1,108 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.Map; + +/** + * @see Maps + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaMap extends AvroSchema { + + public AvroSchemaMap() { + super(AvroSchemaType.MAP); + } + + public AvroSchemaMap(@NotNull Object values) { + super(AvroSchemaType.MAP); + + this.values = values; + } + + public AvroSchemaMap( + @NotNull Object values, + @Nullable Map defaultValue, + @Nullable Map metadata + ) { + super(AvroSchemaType.MAP); + + this.values = values; + this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroSchemaMap(@NotNull Builder builder) { + super(AvroSchemaType.MAP); + + this.values = builder.values; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + + @NotNull + @JsonProperty("values") + @JsonDeserialize(using = AvroTypeDeserializer.class) + private Object values; + + @Nullable + @JsonProperty("default") + private Map defaultValue; + + @NotNull + @Override + public String getType() { + return AvroSchemaType.MAP; + } + + public void setType(@NotNull String type) { + super.setType(AvroSchemaType.MAP); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends AvroSchema.Builder { + + @NotNull + private Object values = Collections.emptyMap(); + + @Nullable + private Map defaultValue; + + @NotNull + public Builder values(@NotNull Object values) { + this.values = values; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Map defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroSchemaMap build() { + return new AvroSchemaMap(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java new file mode 100644 index 00000000..0299cf7c --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java @@ -0,0 +1,35 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; + +@Data +@JsonIgnoreProperties({"metadata"}) +public class AvroSchemaMetadata { + + public AvroSchemaMetadata() {} + + public AvroSchemaMetadata(@Nullable Map metadata) { + this.metadata = metadata; + } + + @Nullable + @JsonAnyGetter + protected Map metadata; + + @JsonAnySetter + protected final void readMetadata(String name, Object value) { + if (metadata == null) { + metadata = new HashMap<>(); + } + + metadata.put(name, value); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java new file mode 100644 index 00000000..684742e6 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java @@ -0,0 +1,172 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +/** + * Avro Record. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Record + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaRecord extends AvroSchema { + + public AvroSchemaRecord() { + super(AvroSchemaType.RECORD); + } + + public AvroSchemaRecord( + @Nullable String type, + @NotNull String name, + @Nullable String namespace, + @Nullable String doc, + @Nullable List<@NotNull String> aliases, + @NotNull List<@NotNull AvroSchemaRecordField> fields + ) { + super(AvroSchemaType.RECORD); + + if (AvroSchemaType.ERROR.equals(type)) { + super.setType(AvroSchemaType.RECORD); + } + + this.name = name; + this.namespace = namespace; + this.doc = doc; + this.aliases = aliases; + this.fields = fields; + } + + public AvroSchemaRecord(@NotNull Builder builder) { + super(AvroSchemaType.RECORD); + + if (AvroSchemaType.ERROR.equals(builder.type)) { + super.setType(AvroSchemaType.RECORD); + } + + this.name = builder.name; + this.namespace = builder.namespace; + this.doc = builder.doc; + this.aliases = builder.aliases; + this.fields = builder.fields; + } + + /** + * A JSON string providing the name of the record (required). + */ + @NotNull + @JsonProperty("name") + private String name = ""; + + /** + * A JSON string that qualifies the name. + */ + @Nullable + @JsonProperty("namespace") + private String namespace; + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + @JsonProperty("doc") + private String doc; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + @JsonProperty("aliases") + private List<@NotNull String> aliases; + + /** + * A JSON array, listing fields (required). + */ + @NotNull + @JsonProperty("fields") + private List<@NotNull AvroSchemaRecordField> fields = Collections.emptyList(); + + @NotNull + @Override + public String getType() { + return AvroSchemaType.RECORD; + } + + public void setType(@NotNull String type) { + super.setType(AvroSchemaType.RECORD); + } + + @NotNull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends AvroSchema.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private String doc; + + @Nullable + private List<@NotNull String> aliases; + + @NotNull + private List<@NotNull AvroSchemaRecordField> fields = Collections.emptyList(); + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder fields(@NotNull List<@NotNull AvroSchemaRecordField> fields) { + this.fields = fields; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @Override + public @NotNull AvroSchemaRecord build() { + return new AvroSchemaRecord(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java new file mode 100644 index 00000000..c07d97e0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java @@ -0,0 +1,281 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Map; + +/** + * Avro Record Field. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Record + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroSchemaRecordField extends AvroSchemaMetadata { + + public AvroSchemaRecordField() { + this.type = AvroSchemaType.RECORD; + } + + public AvroSchemaRecordField( + @NotNull Object type, + @NotNull String name, + @Nullable Order order, + @Nullable String doc, + @Nullable List<@NotNull String> aliases, + @Nullable Object defaultValue, + @Nullable Map metadata + ) { + this.type = type; + this.name = name; + this.order = order == null ? Order.ASCENDING : order ; + this.doc = doc; + this.aliases = aliases; + this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroSchemaRecordField(@NotNull Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.order = builder.order ; + this.doc = builder.doc; + this.aliases = builder.aliases; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + + /** + * Field type. + */ + @NotNull + @JsonProperty("type") + @JsonDeserialize(using = AvroTypeDeserializer.class) + private Object type; + + /** + * A JSON string providing the name of the record (required). + */ + @NotNull + @JsonProperty("name") + private String name = ""; + + /** + * Specifies how this field impacts sort ordering of this record (optional). + */ + @Nullable + @JsonProperty("order") + private Order order = Order.ASCENDING; + + @NotNull + public Order getOrder() { + if (order == null) { + setOrder(Order.ASCENDING); + } + + return order; + } + + public void setOrder(@NotNull Order order) { + this.order = order; + } + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + @JsonProperty("doc") + private String doc; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + @JsonProperty("aliases") + private List<@NotNull String> aliases; + + /** + * A default value for this field, used when reading instances that lack this field (optional). + *

+ * Permitted values depend on the field's schema type, according to the table below. + *

+ * Default values for union fields correspond to the first schema in the union. + *

+ * Default values for bytes and fixed fields are JSON strings, where Unicode code points 0-255 are mapped to unsigned 8-bit byte values 0-255. + * + *

+     * 
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     *   
+     *     
+     *     
+     *     
+     *   
+     * 
avro typejson typeexample
nullnullnull
booleanbooleantrue
int, longinteger1
float, doublenumber1.1
bytesstring"\u00FF"
stringstring"foo"
recordobject{"a": 1}
enumstring"FOO"
arrayarray[1]
mapobject{"a": 1}
fixedstring"\u00ff"
+ *
+ */ + @Nullable + @JsonProperty("default") + private Object defaultValue; + + /** + * Specifies how this field impacts sort ordering of this record. + *

+ * Valid values are "ascending" (the default), "descending", or "ignore". + *

+ * For more details on how this is used, see the the sort order section. + * + * @see Order + */ + public enum Order { + + @JsonProperty("ascending") + ASCENDING, + + @JsonProperty("descending") + DESCENDING, + + @JsonProperty("ignore") + IGNORE + + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + @NotNull + private Object type = AvroSchemaType.RECORD; + + @NotNull + private String name = ""; + + @Nullable + private Order order = Order.ASCENDING; + + @Nullable + private String doc; + + @Nullable + private List<@NotNull String> aliases; + + @Nullable + private Object defaultValue; + + @Nullable + private Map metadata; + + @NotNull + public Builder type(@NotNull Object type) { + this.type = type; + return this; + } + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder order(@Nullable Order order) { + this.order = order == null ? Order.ASCENDING : order; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder aliases(@Nullable List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + public Builder metadata(@Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public AvroSchemaRecordField build() { + return new AvroSchemaRecordField(this); + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java new file mode 100644 index 00000000..4b0f77a3 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java @@ -0,0 +1,77 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; + +/** + * Apache Avro Schema types. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Schema Primitive Types + * @see Avro Schema Complex Types + */ +public class AvroSchemaType { + + /* + Primitive Types. + */ + + @JsonProperty("null") + @JsonPropertyDescription("no value") + public static final String NULL = "null"; + + @JsonProperty("boolean") + @JsonPropertyDescription("a binary value") + public static final String BOOLEAN = "boolean"; + + @JsonProperty("int") + @JsonPropertyDescription("32-bit signed integer") + public static final String INT = "int"; + + @JsonProperty("long") + @JsonPropertyDescription("64-bit signed integer") + public static final String LONG = "long"; + + @JsonProperty("float") + @JsonPropertyDescription("single precision (32-bit) IEEE 754 floating-point number") + public static final String FLOAT = "float"; + + @JsonProperty("double") + @JsonPropertyDescription("double precision (64-bit) IEEE 754 floating-point number") + public static final String DOUBLE = "double"; + + @JsonProperty("bytes") + @JsonPropertyDescription("sequence of 8-bit unsigned bytes") + public static final String BYTES = "bytes"; + + @JsonProperty("string") + @JsonPropertyDescription("unicode character sequence") + public static final String STRING = "string"; + + /* + Complex Types. + */ + + @JsonProperty("record") + public static final String RECORD = "record"; + + @JsonProperty("error") + public static final String ERROR = "error"; + + @JsonProperty("enum") + public static final String ENUM = "enum"; + + @JsonProperty("array") + public static final String ARRAY = "array"; + + @JsonProperty("map") + public static final String MAP = "map"; + + @JsonProperty("unions") + public static final String UNIONS = "unions"; + + @JsonProperty("fixed") + public static final String FIXED = "fixed"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java new file mode 100644 index 00000000..671a4645 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java @@ -0,0 +1,54 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.jetbrains.annotations.NotNull; + +import java.util.Arrays; +import java.util.LinkedList; + +/** + * Avro Union. + *

+ * Unions, as mentioned above, are represented using JSON arrays. + *

+ * For example, ["null", "string"] declares a schema which may be either a null or string. + *
+ *
+ * Note that when a default value is specified for a record field whose type is a union, + * the type of the default value must match the first element of the union. + *

+ * Thus, for unions containing "null", the "null" is usually listed first, + * since the default value of such unions is typically null. + *
+ *
+ * Unions may not contain more than one schema with the same type, except for the named types record, fixed and enum. + *

+ * For example, unions containing two array types or two map types are not permitted, but two types with different names are permitted. + *

+ * (Names permit efficient resolution when reading and writing unions.) + *

+ * Unions may not immediately contain other unions. + * + * @see Unions + * @see Record + */ +@JsonDeserialize(contentUsing = AvroTypeDeserializer.class) +public class AvroSchemaUnion extends LinkedList { + + public AvroSchemaUnion() { + super(); + } + + public AvroSchemaUnion(@NotNull Object ...variant) { + super(); + addAll(Arrays.asList(variant)); + } + + public AvroSchemaUnion(@NotNull Object variantA, @NotNull Object variantB) { + super(); + add(0, variantA); + add(1, variantB); + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java new file mode 100644 index 00000000..40e94f64 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java @@ -0,0 +1,71 @@ +package com.asyncapi.v3.schema.avro.v1._9_0.jackson; + +import com.asyncapi.v3.Reference; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import java.io.IOException; + +public class AvroSchemaDeserializer extends JsonDeserializer { + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsUnion((ArrayNode) jsonNode, objectCodec); + case OBJECT: + return readAvroSchema((ObjectNode) jsonNode, objectCodec); + case STRING: + return jsonParser.readValueAs(String.class); + case BOOLEAN: + case NUMBER: + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private AvroSchemaUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroSchemaUnion avroSchemaUnion = new AvroSchemaUnion(); + for (JsonNode childNode : arrayNode) { + avroSchemaUnion.add(chooseKnownPojo(childNode, objectCodec)); + } + + return avroSchemaUnion; + } + + private Object readAvroSchema(ObjectNode objectNode, ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = objectNode.traverse(objectCodec)) { + if (objectNode.size() == 1 && objectNode.has("$ref")) { + return jsonParser.readValueAs(Reference.class); + } + + return jsonParser.readValueAs(AvroSchema.class); + } + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java new file mode 100644 index 00000000..0673d418 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java @@ -0,0 +1,61 @@ +package com.asyncapi.v3.schema.avro.v1._9_0.jackson; + +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; + +public class AvroTypeDeserializer extends JsonDeserializer { + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsUnion((ArrayNode) jsonNode, objectCodec); + case BOOLEAN: + return jsonNode.asBoolean(); + case NUMBER: + return jsonParser.readValueAs(Number.class); + case OBJECT: + return jsonParser.readValueAs(AvroSchema.class); + case STRING: + return jsonParser.readValueAs(String.class); + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private AvroSchemaUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroSchemaUnion avroSchemaUnion = new AvroSchemaUnion(); + for (JsonNode childNode : arrayNode) { + avroSchemaUnion.add(chooseKnownPojo(childNode, objectCodec)); + } + + return avroSchemaUnion; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java new file mode 100644 index 00000000..cb3fdb15 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java @@ -0,0 +1,53 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class AsyncAPIFormatSchema extends MultiFormatSchema { + + public AsyncAPIFormatSchema(@NotNull AsyncAPISchema schema) { + super(schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public AsyncAPIFormatSchema( + @JsonProperty("schemaFormat") @Nullable String schemaFormat, + @JsonProperty("schema") @NotNull AsyncAPISchema schema + ) { + super(schemaFormat(schemaFormat), schema); + } + + @Override + public void setSchema(@NotNull AsyncAPISchema schema) { + super.setSchema(schema); + } + + @NotNull + public AsyncAPISchema getSchema() { + return super.getSchema(); + } + + @NotNull + private static String schemaFormat(@Nullable String schemaFormat) { + if (schemaFormat == null || schemaFormat.isEmpty()) { + return "application/vnd.aai.asyncapi+json;version=3.0.0"; + } + + return schemaFormat; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java new file mode 100644 index 00000000..8ef1618c --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java @@ -0,0 +1,73 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroSchemaDeserializer; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class AvroFormatSchema extends MultiFormatSchema { + + public AvroFormatSchema(@NotNull @JsonDeserialize(using = AvroSchemaDeserializer.class) Object schema) { + super("application/vnd.apache.avro;version=1.9.0", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public AvroFormatSchema( + @JsonProperty("schemaFormat") @Nullable String schemaFormat, + @JsonProperty("schema") @NotNull @JsonDeserialize(using = AvroSchemaDeserializer.class) Object schema + ) { + super(schemaFormat(schemaFormat), schema); + } + + /** + * Schema MUST be one of: + *
    + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema}
  • + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion}
  • + *
  • {@link com.asyncapi.v3.Reference}
  • + *
+ * + * @param schema Avro Schema or Reference + */ + @Override + public void setSchema(@NotNull Object schema) { + super.setSchema(schema); + } + + /** + * Schema: + *
    + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema}
  • + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion}
  • + *
  • {@link com.asyncapi.v3.Reference}
  • + *
+ */ + @NotNull + public Object getSchema() { + return super.getSchema(); + } + + @NotNull + private static String schemaFormat(@Nullable String schemaFormat) { + if (schemaFormat == null || schemaFormat.isEmpty()) { + return "application/vnd.apache.avro;version=1.9.0"; + } + + return schemaFormat; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java new file mode 100644 index 00000000..8165167f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java @@ -0,0 +1,44 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.JsonSchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class JsonFormatSchema extends MultiFormatSchema { + + public JsonFormatSchema(@NotNull JsonSchema schema) { + super("application/schema+json;version=draft-07", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public JsonFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull JsonSchema schema + ) { + super(schemaFormat, schema); + } + + @Override + public void setSchema(@NotNull JsonSchema schema) { + super.setSchema(schema); + } + + @NotNull + public JsonSchema getSchema() { + return super.getSchema(); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java new file mode 100644 index 00000000..f8aab37b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java @@ -0,0 +1,180 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.ExtendableObject; +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + defaultImpl = AsyncAPIFormatSchema.class, + property = "schemaFormat", + visible = true +) +@JsonSubTypes({ + @JsonSubTypes.Type(value = JsonFormatSchema.class, names = { + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + }), + @JsonSubTypes.Type(value = OpenAPIFormatSchema.class, names = { + "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.oai.openapi;version=3.0.1", + "application/vnd.oai.openapi+json;version=3.0.1", + "application/vnd.oai.openapi+yaml;version=3.0.1", + "application/vnd.oai.openapi;version=3.0.2", + "application/vnd.oai.openapi+json;version=3.0.2", + "application/vnd.oai.openapi+yaml;version=3.0.2", + "application/vnd.oai.openapi;version=3.0.3", + "application/vnd.oai.openapi+json;version=3.0.3", + "application/vnd.oai.openapi+yaml;version=3.0.3" + }), + @JsonSubTypes.Type(value = AsyncAPIFormatSchema.class, names = { + "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" + }), + @JsonSubTypes.Type(value = AvroFormatSchema.class, names = { + "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.1", + "application/vnd.apache.avro+json;version=1.9.1", + "application/vnd.apache.avro+yaml;version=1.9.1", + "application/vnd.apache.avro;version=1.9.2", + "application/vnd.apache.avro+json;version=1.9.2", + "application/vnd.apache.avro+yaml;version=1.9.2", + "application/vnd.apache.avro;version=1.10.0", + "application/vnd.apache.avro+json;version=1.10.0", + "application/vnd.apache.avro+yaml;version=1.10.0", + "application/vnd.apache.avro;version=1.10.1", + "application/vnd.apache.avro+json;version=1.10.1", + "application/vnd.apache.avro+yaml;version=1.10.1", + "application/vnd.apache.avro;version=1.10.2", + "application/vnd.apache.avro+json;version=1.10.2", + "application/vnd.apache.avro+yaml;version=1.10.2", + "application/vnd.apache.avro;version=1.11.0", + "application/vnd.apache.avro+json;version=1.11.0", + "application/vnd.apache.avro+yaml;version=1.11.0", + "application/vnd.apache.avro;version=1.11.1", + "application/vnd.apache.avro+json;version=1.11.1", + "application/vnd.apache.avro+yaml;version=1.11.1" + }) +}) +@EqualsAndHashCode(callSuper = true) +public class MultiFormatSchema extends ExtendableObject { + + public MultiFormatSchema(@NotNull Schema schema) { + this.schemaFormat = "application/vnd.aai.asyncapi+json;version=3.0.0"; + this.schema = schema; + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public MultiFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull Schema schema + ) { + this.schemaFormat = schemaFormat; + this.schema = schema; + } + + /** + * Required. + *

+ * 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 {@link com.asyncapi.v3._0_0.model.AsyncAPI#getAsyncapi()} version string. + *

+ * In such a case, this would make the Multi Format Schema Object equivalent to the {@link AsyncAPISchema}. + *

+ * When using {@link com.asyncapi.v3.Reference} within the {@link #getSchema()}, the schemaFormat of the resource being referenced MUST match + * the schemaFormat of the {@link #getSchema()} that contains the initial reference. + *

+ * For example, if you reference Avro schema, then schemaFormat of referencing resource and the resource being reference MUST match. + *

+ *

+ * Check out the supported schema formats table for more information. + * Custom values are allowed but their implementation is OPTIONAL. + * A custom value MUST NOT refer to one of the schema formats listed in the table. + *

+ *

+ * When using {@link com.asyncapi.v3.Reference} within the {@link #getSchema()}, the schemaFormat of the referenced resource MUST + * match the schemaFormat of the schema containing the reference. + * + * @see Schema formats table + */ + @NotNull + @JsonProperty("schemaFormat") + private String schemaFormat; + + public void setSchemaFormat(@NotNull String schemaFormat) { + this.schemaFormat = schemaFormat; + } + + @NotNull + public String getSchemaFormat() { + return schemaFormat; + } + + /** + * Required. + *

+ * Definition of the message payload. + *

+ * It can be of any type but defaults to {@link AsyncAPISchema}. + *

+ * It MUST match the schema format defined in {@link #getSchemaFormat()}, 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. + */ + @NotNull + @JsonProperty("schema") + private Schema schema; + + public void setSchema(@NotNull Schema schema) { + this.schema = schema; + } + + @NotNull + public Schema getSchema() { + return schema; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java new file mode 100644 index 00000000..3f1f4bc9 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java @@ -0,0 +1,44 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class OpenAPIFormatSchema extends MultiFormatSchema { + + public OpenAPIFormatSchema(@NotNull OpenAPISchema schema) { + super("application/vnd.oai.openapi+json;version=3.0.0", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public OpenAPIFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull OpenAPISchema schema + ) { + super(schemaFormat, schema); + } + + @Override + public void setSchema(@NotNull OpenAPISchema schema) { + super.setSchema(schema); + } + + @NotNull + public OpenAPISchema getSchema() { + return super.getSchema(); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java new file mode 100644 index 00000000..97f365d3 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java @@ -0,0 +1,918 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0; + +import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAdditionalPropertiesDeserializer; +import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAnyValueDeserializer; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Discriminator; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Extensions; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.ExternalDocumentation; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.XML; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.*; +import org.jetbrains.annotations.Nullable; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * The Schema Object allows the definition of input and output data types. + *

+ * These types can be objects, but also primitives and arrays. + *

+ * This object is an extended subset of the JSON Schema Specification Wright Draft 00. + *

+ * For more information about the properties, see JSON Schema Core and JSON Schema Validation. + * Unless stated otherwise, the property definitions follow the JSON Schema. + * + * @see Schema Object + * @see Schema + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class OpenAPISchema extends Extensions { + + /** + * Schema name. + */ + @JsonProperty("name") + public String name; + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A title will preferably be short + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("title") + public String title; + + /** + * Use the multipleOf keyword to specify that a number must be the multiple of another number: + *

{@code
+     * type: integer
+     * multipleOf: 10
+     * }
+ * + * The example above matches 10, 20, 30, 0, -10, -20, and so on. + *

+ * multipleOf may be used with floating-point numbers, but in practice this can be unreliable due to the limited precision or floating point math. + *

{@code
+     * type: number
+     * multipleOf: 2.5
+     * }
+ * + * The value of multipleOf MUST be a positive number, that is, you cannot use multipleOf: -5. + * + * @see multipleOf + */ + @Nullable + @JsonProperty("multipleOf") + public BigDecimal multipleOf; + + /** + * Use the {@link #minimum} and {@link #maximum} keywords to specify the range of possible values: + *
{@code
+     * type: integer
+     * minimum: 1
+     * maximum: 20
+     * }
+ * + * By default, the minimum and maximum values are included in the range, that is: + *
{@code
+     * minimum ≤ value ≤ maximum
+     * }
+ * + * To exclude the boundary values, specify {@link #exclusiveMinimum}: true and {@link #exclusiveMaximum}: true. + *
{@code
+     * exclusiveMinimum: true
+     * exclusiveMaximum: true
+     * }
+ * For example, you can define a floating-point number range as 0–50 and exclude the 0 value: + * + * @see range + */ + @Nullable + @JsonProperty("maximum") + public BigDecimal maximum; + + /** + * The word “exclusive” in {@link #exclusiveMinimum} and {@link #exclusiveMaximum} means the corresponding boundary is excluded: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
KeywordDescription
exclusiveMinimum: false or not includedvalue ≥ minimum
exclusiveMinimum: truevalue > minimum
exclusiveMaximum: false or not includedvalue ≤ maximum
exclusiveMaximum: truevalue < maximum
+ * + * @see range + */ + @Nullable + @JsonProperty("exclusiveMaximum") + public Boolean exclusiveMaximum; + + /** + * Use the {@link #minimum} and {@link #maximum} keywords to specify the range of possible values: + *
{@code
+     * type: integer
+     * minimum: 1
+     * maximum: 20
+     * }
+ * + * By default, the minimum and maximum values are included in the range, that is: + *
{@code
+     * minimum ≤ value ≤ maximum
+     * }
+ * + * To exclude the boundary values, specify {@link #exclusiveMinimum}: true and {@link #exclusiveMaximum}: true. + *
{@code
+     * exclusiveMinimum: true
+     * exclusiveMaximum: true
+     * }
+ * For example, you can define a floating-point number range as 0–50 and exclude the 0 value: + * + * @see range + */ + @Nullable + @JsonProperty("minimum") + public BigDecimal minimum; + + /** + * The word “exclusive” in {@link #exclusiveMinimum} and {@link #exclusiveMaximum} means the corresponding boundary is excluded: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
KeywordDescription
exclusiveMinimum: false or not includedvalue ≥ minimum
exclusiveMinimum: truevalue > minimum
exclusiveMaximum: false or not includedvalue ≤ maximum
exclusiveMaximum: truevalue < maximum
+ * + * @see range + */ + @Nullable + @JsonProperty("exclusiveMinimum") + public Boolean exclusiveMinimum; + + /** + * String length can be restricted using {@link #minLength} and {@link #maxLength}: + * + *
{@code
+     * type: string
+     * minLength: 3
+     * maxLength: 20
+     * }
+ * + * @see string + */ + @Nullable + @JsonProperty("maxLength") + public Integer maxLength; + + /** + * String length can be restricted using {@link #minLength} and {@link #maxLength}: + * + *
{@code
+     * type: string
+     * minLength: 3
+     * maxLength: 20
+     * }
+ * + * @see string + */ + @Nullable + @JsonProperty("minLength") + public Integer minLength; + + /** + * The pattern keyword lets you define a regular expression template for the string value. + *

+ * Only the values that match this template will be accepted. The regular expression syntax used is + * from JavaScript (more specifically, ECMA 262). + *

+ * Regular expressions are case-sensitive, that is, [a-z] and [A-Z] are different expressions. + *

+ * For example, the following pattern matches a Social Security Number (SSN) in the 123-45-6789 format: + * + * @see pattern + */ + @Nullable + @JsonProperty("pattern") + public String pattern; + + /** + * You can define the minimum and maximum length of an array like so: + *

{@code
+     * type: array
+     * items:
+     *   type: integer
+     * minItems: 1
+     * maxItems: 10
+     * }
+ * + * @see array length + */ + @Nullable + @JsonProperty("maxItems") + public Integer maxItems; + + /** + * You can define the minimum and maximum length of an array like so: + *
{@code
+     * type: array
+     * items:
+     *   type: integer
+     * minItems: 1
+     * maxItems: 10
+     * }
+ * + * @see array length + */ + @Nullable + @JsonProperty("minItems") + public Integer minItems; + + /** + * You can use uniqueItems: true to specify that all items in the array must be unique: + *
{@code
+     * type: array
+     * items:
+     *   type: integer
+     * uniqueItems: true
+     * # [1, 2, 3] – valid
+     * # [1, 1, 3] – not valid
+     * # [ ] – valid
+     * }
+ */ + @Nullable + @JsonProperty("uniqueItems") + public Boolean uniqueItems; + + /** + * The {@link #minProperties} and {@link #maxProperties} keywords let you restrict the number of properties allowed in an object. + * This can be useful when using {@link #additionalProperties} or free-form objects. + * + *
{@code
+     * type: object
+     * minProperties: 2
+     * maxProperties: 10
+     * }
+ * + * @see property count + */ + @Nullable + @JsonProperty("maxProperties") + public Integer maxProperties; + + /** + * The {@link #minProperties} and {@link #maxProperties} keywords let you restrict the number of properties allowed in an object. + * This can be useful when using {@link #additionalProperties} or free-form objects. + * + *
{@code
+     * type: object
+     * minProperties: 2
+     * maxProperties: 10
+     * }
+ * + * @see property count + */ + @Nullable + @JsonProperty("minProperties") + public Integer minProperties; + + /** + * By default, all object properties are optional. You can specify the required properties in the required list: + *
{@code
+     * type: object
+     * properties:
+     *   id:
+     *     type: integer
+     *   username:
+     *     type: string
+     *   name:
+     *     type: string
+     * required:
+     *   - id
+     *   - username
+     * }
+ * + * Note that required is an object-level attribute, not a property attribute: + *
{@code
+     * type: object
+     * properties:
+     *   id:
+     *     type: integer
+     *     required: true  # Wrong!
+     * required:           # Correct
+     *   - id
+     * }
+ * + * @see required + */ + @Nullable + @JsonProperty("required") + public List required; + + /** + * The data type of a schema is defined by the type keyword, for example, type: string. + *

+ * OpenAPI defines the following basic types: + *

    + *
  • string (this includes dates and files)
  • + *
  • number
  • + *
  • integer
  • + *
  • boolean
  • + *
  • array
  • + *
  • object
  • + *
+ * + * These types exist in most programming languages, though they may go by different names. + * Using these types, you can describe any data structures. + *

+ * Note that there is no null type; instead, the {@link #nullable} attribute is used as a modifier of the base type. + *

+ * Additional type-specific keywords can be used to refine the data type, for example, + * limit the string length or specify an enum of possible values. + * + * @see type + */ + @Nullable + @JsonProperty("type") + public String type; + + /** + * OpenAPI lets you combine and extend model definitions using the allOf keyword. + * allOf takes an array of object definitions that are used for independent validation but together compose a single object. + *

+ * Still, it does not imply a hierarchy between the models. For that purpose, you should include the {@link #discriminator}. + *

+ * To be valid against allOf, the data provided by the client must be valid against all of the given subschemas. + * In the following example, allOf acts as a tool for combining schemas used in specific cases with the general one. + *

+ * For more clearness, {@link #oneOf} is also used with a {@link #discriminator}. + * + *

{@code
+     * components:
+     *   schemas:
+     *     Pet:
+     *       type: object
+     *       required:
+     *         - pet_type
+     *       properties:
+     *         pet_type:
+     *           type: string
+     *       discriminator:
+     *         propertyName: pet_type
+     *     Dog:     # "Dog" is a value for the pet_type property (the discriminator value)
+     *       allOf: # Combines the main `Pet` schema with `Dog`-specific properties
+     *         - $ref: '#/components/schemas/Pet'
+     *         - type: object
+     *           # all other properties specific to a `Dog`
+     *           properties:
+     *             bark:
+     *               type: boolean
+     *             breed:
+     *               type: string
+     *               enum: [Dingo, Husky, Retriever, Shepherd]
+     *     Cat:     # "Cat" is a value for the pet_type property (the discriminator value)
+     *       allOf: # Combines the main `Pet` schema with `Cat`-specific properties
+     *         - $ref: '#/components/schemas/Pet'
+     *         - type: object
+     *           # all other properties specific to a `Cat`
+     *           properties:
+     *             hunts:
+     *               type: boolean
+     *             age:
+     *               type: integer
+     * }
+ * + * As you can see, this example validates the request body content to make sure it includes all the information + * needed to update a pet item with the PUT operation. + *

+ * It requires user to specify which type of the item should be updated, and validates against the specified schema according to their choice. + * Note the inline or referenced schema must be a schema object, not a standard JSON schema. + *

+ * For that example, all of the following request bodies are valid: + *

{@code
+     * {
+     *   "pet_type": "Cat",
+     *   "age": 3
+     * }
+     * }
+ *
{@code
+     * {
+     *   "pet_type": "Dog",
+     *   "bark": true
+     * }
+     * }
+ *
{@code
+     * {
+     *   "pet_type": "Dog",
+     *   "bark": false,
+     *   "breed": "Dingo"
+     * }
+     * }
+ * + * The following request bodies are not valid: + *
{@code
+     * {
+     *   "age": 3        # Does not include the pet_type property
+     * }
+     * }
+ *
{@code
+     * {
+     *   "pet_type": "Cat",
+     *   "bark": true    # The `Cat` schema does not have the `bark` property
+     * }
+     * }
+ * + * @see oneOf, anyOf, allOf, not + */ + @Nullable + @JsonProperty("allOf") + public List allOf; + + /** + * Use the anyOf keyword to validate the data against any amount of the given subschemas. + * That is, the data may be valid against one or more subschemas at the same time. + * + *
{@code
+     * paths:
+     *   /pets:
+     *     patch:
+     *       requestBody:
+     *         content:
+     *           application/json:
+     *             schema:
+     *               anyOf:
+     *                 - $ref: '#/components/schemas/PetByAge'
+     *                 - $ref: '#/components/schemas/PetByType'
+     *       responses:
+     *         '200':
+     *           description: Updated
+     * components:
+     *   schemas:
+     *     PetByAge:
+     *       type: object
+     *       properties:
+     *         age:
+     *           type: integer
+     *         nickname:
+     *           type: string
+     *       required:
+     *         - age
+     *
+     *     PetByType:
+     *       type: object
+     *       properties:
+     *         pet_type:
+     *           type: string
+     *           enum: [Cat, Dog]
+     *         hunts:
+     *           type: boolean
+     *       required:
+     *         - pet_type
+     * }
+ * + * Note the inline or referenced schema must be a schema object, not a standard JSON schema. With this example, + * the following JSON request bodies are valid: + *
{@code
+     * {
+     *   "age": 1
+     * }
+     * }
+ *
{@code
+     * {
+     *   "pet_type": "Cat",
+     *   "hunts": true
+     * }
+     * }
+ *
{@code
+     * {
+     *   "nickname": "Fido",
+     *   "pet_type": "Dog",
+     *   "age": 4
+     * }
+     * }
+ * + * The following example is not valid, because it does not contain any of the required properties for both of the schemas: + *
{@code
+     * {
+     *   "nickname": "Mr. Paws",
+     *   "hunts": false
+     * }
+     * }
+ * + * @see oneOf, anyOf, allOf, not + */ + @Nullable + @JsonProperty("anyOf") + public List anyOf; + + /** + * oneOf matches exactly one subschema, and {@link #anyOf} can match one or more subschemas. + *

+ * To better understand the difference, use the {@link #anyOf} example but replace anyOf with oneOf. + * When using oneOf, the following request body is not valid because it matches both schemas and not just one: + *

{@code
+     * {
+     *   "nickname": "Fido",
+     *   "pet_type": "Dog",
+     *   "age": 4
+     * }
+     * }
+ * + * @see oneOf, anyOf, allOf, not + */ + @Nullable + @JsonProperty("oneOf") + public List oneOf; + + /** + * The not keyword does not exactly combine schemas, but as all of the keywords mentioned above it + * helps you to modify your schemas and make them more specific. + * + *
{@code
+     * paths:
+     *   /pets:
+     *     patch:
+     *       requestBody:
+     *         content:
+     *           application/json:
+     *             schema:
+     *               $ref: '#/components/schemas/PetByType'
+     *       responses:
+     *         '200':
+     *           description: Updated
+     * components:
+     *   schemas:
+     *     PetByType:
+     *       type: object
+     *       properties:
+     *         pet_type:
+     *           not:
+     *             type: integer
+     *       required:
+     *         - pet_type
+     * }
+ * + * In this example, user should specify the pet_type value of any type except integer + * (that is, it should be an array, boolean, number, object, or string). The following request body is valid: + *
{@code
+     * {
+     *   "pet_type": "Cat"
+     * }
+     * }
+ * + * And the following is not valid: + *
{@code
+     * {
+     *   "pet_type": 11
+     * }
+     * }
+ * + * @see oneOf, anyOf, allOf, not + */ + @Nullable + @JsonProperty("not") + public OpenAPISchema not; + + /** + * The properties keyword is used to define the object properties – you need to list the property names and specify a schema for each property. + *
{@code
+     * type: object
+     * properties:
+     *   id:
+     *     type: integer
+     *   name:
+     *     type: string
+     * }
+ * + * @see Objects + */ + @Nullable + @JsonProperty("properties") + public Map properties; + + /** + * The value can be a boolean (true or false) or an {@link OpenAPISchema}. + *
{@code
+     * type: object
+     * additionalProperties: true
+     * }
+ *
{@code
+     * type: object
+     * additionalProperties: {}
+     * }
+ * + */ + @Nullable + @JsonProperty("additionalProperties") + @JsonDeserialize(using = OpenAPISchemaAdditionalPropertiesDeserializer.class) + public Object additionalProperties; + + /** + * The value of these keyword MUST be a string. + *

+ * This keywords can be used to decorate a user interface with information about the data produced by this user + * interface. + *

+ * A description will provide explanation about the purpose of the instance described by this schema. + * + * @see "title" and "description" + */ + @Nullable + @JsonProperty("description") + public String description; + + /** + * Format modifier serves as a hint at the contents and format of the string. + * + * @see string + */ + @Nullable + @JsonProperty("format") + public String format; + + /** + * Reference to OpenAPI Schema definition. + */ + @Nullable + @JsonProperty("$ref") + public String ref; + + /** + * OpenAPI 3.0 does not have an explicit null type as in JSON Schema, but you can use nullable: true to specify that the value may be null. + * Note that null is different from an empty string "". + *

{@code
+     * # Correct
+     * type: integer
+     * nullable: true
+     * # Incorrect
+     * type: null
+     * # Incorrect as well
+     * type:
+     *   - integer
+     *   - null
+     * }
+ * + * @see null + */ + @Nullable + @JsonProperty("nullable") + public Boolean nullable; + + /** + * You can use the {@link #readOnly} and {@link #writeOnly} keywords to mark specific properties as read-only or write-only. + *

+ * This is useful, for example, when GET returns more properties than used in POST – you can use the same schema in + * both GET and POST and mark the extra properties as readOnly. + *

+ * {@link #readOnly} properties are included in responses but not in requests, and {@link #writeOnly} properties may be sent in requests but not in responses. + *

{@code
+     * type: object
+     * properties:
+     *   id:
+     *     # Returned by GET, not used in POST/PUT/PATCH
+     *     type: integer
+     *     readOnly: true
+     *   username:
+     *     type: string
+     *   password:
+     *     # Used in POST/PUT/PATCH, not returned by GET
+     *     type: string
+     *     writeOnly: true
+     * }
+ * + * If a {@link #readOnly} or {@link #writeOnly} property is included in the required list, + * required affects just the relevant scope – responses only or requests only. + *

+ * That is, read-only required properties apply to responses only, and write-only required properties – to requests only. + * + * @see Read-Only and Write-Only Properties + */ + @Nullable + @JsonProperty("readOnly") + public Boolean readOnly; + + /** + * You can use the {@link #readOnly} and {@link #writeOnly} keywords to mark specific properties as read-only or write-only. + *

+ * This is useful, for example, when GET returns more properties than used in POST – you can use the same schema in + * both GET and POST and mark the extra properties as readOnly. + *

+ * {@link #readOnly} properties are included in responses but not in requests, and {@link #writeOnly} properties may be sent in requests but not in responses. + *

{@code
+     * type: object
+     * properties:
+     *   id:
+     *     # Returned by GET, not used in POST/PUT/PATCH
+     *     type: integer
+     *     readOnly: true
+     *   username:
+     *     type: string
+     *   password:
+     *     # Used in POST/PUT/PATCH, not returned by GET
+     *     type: string
+     *     writeOnly: true
+     * }
+ * + * If a {@link #readOnly} or {@link #writeOnly} property is included in the required list, + * required affects just the relevant scope – responses only or requests only. + *

+ * That is, read-only required properties apply to responses only, and write-only required properties – to requests only. + * + * @see Read-Only and Write-Only Properties + */ + @Nullable + @JsonProperty("writeOnly") + public Boolean writeOnly; + + /** + * You can add examples to parameters, properties and objects to make OpenAPI specification of your web service clearer. + * Examples can be read by tools and libraries that process your API in some way. + *

+ * For example, an API mocking tool can use sample values to generate mock requests. + * You can specify examples for objects, individual properties and operation parameters + *

{@code
+     * parameters:
+     *   - in: query
+     *     name: status
+     *     schema:
+     *       type: string
+     *       enum: [approved, pending, closed, new]
+     *       example: approved     # Example of a parameter value
+     * }
+ *
{@code
+     * parameters:
+     *   - in: query
+     *     name: limit
+     *     schema:
+     *       type: integer
+     *       maximum: 50
+     *     example:
+     *       zero:         # Distinct name
+     *         value: 0    # Example value
+     *         summary: A sample limit value  # Optional description
+     * }
+ */ + @Nullable + @JsonProperty("example") + @JsonDeserialize(using = OpenAPISchemaAnyValueDeserializer.class) + public Object example; + + /** + * External resource for extended documentation + */ + @Nullable + @JsonProperty("externalDocs") + public ExternalDocumentation externalDocs; + + /** + * You can mark OpenAPI Schema as deprecated, by setting deprecated: true + */ + @Nullable + @JsonProperty("deprecated") + public Boolean deprecated; + + /** + * In your API specification, you can describe data in both XML and JSON formats as they are easily interchangeable. + *

+ * For example, the following declaration — + *

{@code
+     * components:
+     *   schemas:
+     *     book:
+     *       type: object
+     *       properties:
+     *         id:
+     *           type: integer
+     *         title:
+     *           type: string
+     *         author:
+     *           type: string
+     * }
+ * + * — is represented in the following way in JSON and XML: + *
+ * JSON + *
{@code
+     * {
+     *   "id": 0,
+     *   "title": "string",
+     *   "author": "string"
+     * }
+     * }
+ * + * XML + *
{@code
+     * 
+     *   0
+     *   string
+     *   string
+     * 
+     * }
+ * + * As you can see, in XML representation, the object name serves as a parent element and properties are translated to child elements. + *

+ * The OpenAPI 3 format offers a special xml object to help you fine-tune representation of XML data. + * You can use this object to transform some properties to attributes rather than elements, to change element names, + * to add namespaces and to control transformations of array items. + * + * @see Representing XML + */ + @Nullable + @JsonProperty("xml") + public XML xml; + + /** + * You can use the enum keyword to specify possible values of a request parameter or a model property. + *

+ * For example, the sort parameter in GET /items?sort=[asc|desc] can be described as: + *

{@code
+     * paths:
+     *   /items:
+     *     get:
+     *       parameters:
+     *         - in: query
+     *           name: sort
+     *           description: Sort order
+     *           schema:
+     *             type: string
+     *             enum: [asc, desc]
+     * }
+ * + * A nullable enum can be defined as follows: + *
{@code
+     * type: string
+     * nullable: true  # <---
+     * enum:
+     *   - asc
+     *   - desc
+     *   - null        # <--- without quotes, i.e. null not "null"
+     * }
+ * + * @see Enums + */ + @Nullable + @JsonProperty("enum") + @JsonDeserialize(contentUsing = OpenAPISchemaAnyValueDeserializer.class) + public List enumValue; + + /** + * Default value. + */ + @Nullable + @JsonProperty("default") + @JsonDeserialize(using = OpenAPISchemaAnyValueDeserializer.class) + public Object defaultValue; + + /** + * {@link Discriminator} + */ + @Nullable + @JsonProperty("discriminator") + public Discriminator discriminator; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java new file mode 100644 index 00000000..fc12e2ae --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java @@ -0,0 +1,55 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +/** + * When request bodies or response payloads may be one of a number of different schemas, + * a discriminator object can be used to aid in serialization, deserialization, and validation. + *

+ * The discriminator is a specific object in a schema which is used to inform the consumer of the + * specification of an alternative schema based on the value associated with it. + *

+ * When using the discriminator, inline schemas will not be considered. + *

+ * The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf. + * + * @see Discriminator Object + * @see Discriminator + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class Discriminator { + + /** + * REQUIRED. + *

+ * The name of the property in the payload that will hold the discriminator value. + */ + @NotNull + @JsonProperty("propertyName") + @JsonPropertyDescription("The name of the property in the payload that will hold the discriminator value.") + public String propertyName; + + /** + * An object to hold mappings between payload values and schema names or references. + */ + @Nullable + @JsonProperty("mapping") + @JsonPropertyDescription("An object to hold mappings between payload values and schema names or references.") + public Map mapping; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java new file mode 100644 index 00000000..b243003f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java @@ -0,0 +1,46 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +/** + * @see Specification Extensions + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties({"extensions"}) +public class Extensions { + + private static final Pattern extensionPropertyNamePattern = Pattern.compile("^x-.*"); + + /** + * Extension fields in the form x-extension-field-name for the exposed API. + */ + @Nullable + @JsonAnyGetter + protected Map extensions; + + @JsonAnySetter + protected final void readExtensionProperty(String name, Object value) { + if (extensionPropertyNamePattern.matcher(name).matches()) { + if (extensions == null) { + extensions = new HashMap<>(); + } + + extensions.put(name, value); + } else { + throw new IllegalArgumentException(String.format("\"%s\" is not valid extension property", name)); + } + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java new file mode 100644 index 00000000..7289f546 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java @@ -0,0 +1,45 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Allows referencing an external resource for extended documentation. + * + * @see Schema Object + * @see ExternalDocumentation + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class ExternalDocumentation extends Extensions { + + /** + * A short description of the target documentation. + *

+ * CommonMark syntax MAY be used for rich text representation. + */ + @Nullable + @JsonProperty("description") + @JsonPropertyDescription("A short description of the target documentation.") + public String description; + + /** + * REQUIRED. + *

+ * The URL for the target documentation. Value MUST be in the format of a URL. + */ + @NotNull + @JsonProperty("url") + @JsonPropertyDescription("The URL for the target documentation.") + public String url; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java new file mode 100644 index 00000000..7739011f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java @@ -0,0 +1,88 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.*; +import org.jetbrains.annotations.Nullable; + +/** + * XML + * + * @see XML Object + * @see XML + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class XML extends Extensions { + + /** + * Replaces the name of the element/attribute used for the described schema property. + *

+ * When defined within items, it will affect the name of the individual XML elements within the list. + *

+ * When defined alongside type being array (outside the items), it will affect the wrapping element and only if wrapped is true. + * If wrapped is false, it will be ignored. + * + * @see XML Fixed Fields: name + */ + @Nullable + @JsonProperty("name") + @JsonPropertyDescription("Replaces the name of the element/attribute used for the described schema property.") + public String name; + + /** + * The URI of the namespace definition. + *

+ * Value MUST be in the form of an absolute URI. + * + * @see XML Fixed Fields: namespace + */ + public String namespace; + + /** + * The prefix to be used for the {@link #name}. + * + * @see XML Fixed Fields: prefix + */ + public String prefix; + + /** + * Declares whether the property definition translates to an attribute instead of an element. + *

+ * Default value is false. + * + * @see XML Fixed Fields: attribute + */ + public Boolean attribute; + + /** + * MAY be used only for an array definition. + *

+ * Signifies whether the array is wrapped: + *

{@code
+     * 
+     *     
+     * 
+     * }
+ * + * or unwrapped: + *
{@code
+     * 
+     * }
+ * + *

+ * Default value is false. + *

+ * The definition takes effect only when defined alongside type being array (outside the items). + * + * @see XML Fixed Fields: wrapped + */ + public Boolean wrapped; + +} diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt index f5e97ab7..c1e3b6a0 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt @@ -19,8 +19,8 @@ import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicCleanupPolicy import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicConfiguration import com.asyncapi.v3.binding.operation.kafka.KafkaOperationBinding import com.asyncapi.v3.binding.server.kafka.KafkaServerBinding -import com.asyncapi.v3.schema.MultiFormatSchema -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import com.asyncapi.v3.security_scheme.SecurityScheme class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { @@ -168,7 +168,7 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { override fun expectedOperations(): Map { val receiveACostingRequestKafkaBinding = KafkaOperationBinding.builder() - .groupId(Schema.builder() + .groupId(AsyncAPISchema.builder() .type("string") .description("The groupId must be prefixed by your `svc` account, deliver by the Adeo Kafka team. This `svc` must have the write access to the topic.\n") .build() @@ -238,22 +238,22 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { Tag.builder().name("costing").build() )) .correlationId(Reference("#/components/correlationIds/costingCorrelationId")) - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .required(listOf( "REQUESTER_ID", "REQUESTER_CODE", "REQUEST_ID", "REPLY_TOPIC" )) .properties(mapOf( - Pair("REQUEST_ID", Schema.builder().ref("#/components/schemas/RequestId").build()), - Pair("REPLY_TOPIC", Schema.builder().ref("#/components/schemas/ReplyTopic").build()), - Pair("REQUESTER_ID", Schema.builder().ref("#/components/schemas/RequesterId").build()), - Pair("REQUESTER_CODE", Schema.builder().ref("#/components/schemas/RequesterCode").build()), + Pair("REQUEST_ID", AsyncAPISchema.builder().ref("#/components/schemas/RequestId").build()), + Pair("REPLY_TOPIC", AsyncAPISchema.builder().ref("#/components/schemas/ReplyTopic").build()), + Pair("REQUESTER_ID", AsyncAPISchema.builder().ref("#/components/schemas/RequesterId").build()), + Pair("REQUESTER_CODE", AsyncAPISchema.builder().ref("#/components/schemas/RequesterCode").build()), )) .build() ) - .payload(MultiFormatSchema( + .payload(AvroFormatSchema( "application/vnd.apache.avro;version=1.9.0", - mapOf(Pair("\$ref", "https://www.asyncapi.com/resources/casestudies/adeo/CostingRequestPayload.avsc")) + Reference("https://www.asyncapi.com/resources/casestudies/adeo/CostingRequestPayload.avsc") )) .build() ), @@ -267,18 +267,18 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { Tag.builder().name("costing").build() )) .correlationId(Reference("#/components/correlationIds/costingCorrelationId")) - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("CALCULATION_ID", Schema.builder().ref("#/components/schemas/MessageId").build()), - Pair("CORRELATION_ID", Schema.builder().ref("#/components/schemas/CorrelationId").build()), - Pair("REQUEST_TIMESTAMP", Schema.builder() + Pair("CALCULATION_ID", AsyncAPISchema.builder().ref("#/components/schemas/MessageId").build()), + Pair("CORRELATION_ID", AsyncAPISchema.builder().ref("#/components/schemas/CorrelationId").build()), + Pair("REQUEST_TIMESTAMP", AsyncAPISchema.builder() .type("string") .format("date-time") .description("Timestamp of the costing request") .build() ), - Pair("CALCULATION_TIMESTAMP", Schema.builder() + Pair("CALCULATION_TIMESTAMP", AsyncAPISchema.builder() .type("string") .format("date-time") .description("Technical timestamp for the costing calculation") @@ -287,34 +287,34 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { )) .build() ) - .payload(MultiFormatSchema( + .payload(AvroFormatSchema( "application/vnd.apache.avro;version=1.9.0", - mapOf(Pair("\$ref", "https://www.asyncapi.com/resources/casestudies/adeo/CostingResponsePayload.avsc")) + Reference("https://www.asyncapi.com/resources/casestudies/adeo/CostingResponsePayload.avsc") )) .build() ) )) .schemas(mapOf( - Pair("RequesterId", Schema.builder() + Pair("RequesterId", AsyncAPISchema.builder() .type("string") .description("The Costing requester service account used to produce costing request.") .examples(listOf("svc-ecollect-app")) .build() ), - Pair("RequesterCode", Schema.builder() + Pair("RequesterCode", AsyncAPISchema.builder() .type("string") .description("The Costing requester code (generally the BU Code). The requester code is useful to get the dedicated context (tenant).") .examples(listOf(1)) .build() ), - Pair("MessageId", Schema.builder() + Pair("MessageId", AsyncAPISchema.builder() .type("string") .format("uuid") .description("A unique Message ID.") .examples(listOf("1fa6ef40-8f47-40a8-8cf6-f8607d0066ef")) .build() ), - Pair("RequestId", Schema.builder() + Pair("RequestId", AsyncAPISchema.builder() .type("string") .format("uuid") .description("A unique Request ID needed to define a `CORRELATION_ID` for exchanges, " + @@ -322,7 +322,7 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { .examples(listOf("1fa6ef40-8f47-40a8-8cf6-f8607d0066ef")) .build() ), - Pair("CorrelationId", Schema.builder() + Pair("CorrelationId", AsyncAPISchema.builder() .type("string") .format("uuid") .description("A unique Correlation ID defined from the `REQUEST_ID` or the " + @@ -330,13 +330,13 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { .examples(listOf("1fa6ef40-8f47-40a8-8cf6-f8607d0066ef")) .build() ), - Pair("BuCode", Schema.builder() + Pair("BuCode", AsyncAPISchema.builder() .type("string") .description("The Business Unit code for which data are applicable.") .examples(listOf(1)) .build() ), - Pair("ReplyTopic", Schema.builder() + Pair("ReplyTopic", AsyncAPISchema.builder() .type("string") .description("The Kafka topic where to send the Costing Response. This is required for " + "the [Return Address EIP " + @@ -345,19 +345,19 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { .examples(listOf("adeo-case-study-COSTING-RESPONSE-V1")) .build() ), - Pair("ErrorStep", Schema.builder() + Pair("ErrorStep", AsyncAPISchema.builder() .type("string") .description("The woker that has thrown the error.\n") .examples(listOf("EXPOSE_RESULT")) .build() ), - Pair("ErrorMessage", Schema.builder() + Pair("ErrorMessage", AsyncAPISchema.builder() .type("string") .description("The error message describing the error.\n") .examples(listOf("Error message")) .build() ), - Pair("ErrorCode", Schema.builder() + Pair("ErrorCode", AsyncAPISchema.builder() .type("string") .description("The error code.\n") .examples(listOf("CURRENCY_NOT_FOUND")) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AnyOfAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AnyOfAsyncAPI.kt index 1e1219b1..e5c12705 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AnyOfAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AnyOfAsyncAPI.kt @@ -7,7 +7,7 @@ import com.asyncapi.v3._0_0.model.component.Components import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class AnyOfAsyncAPI: AbstractExampleValidationTest() { override fun specificationLocation(): String = "/examples/v3.0.0/anyof-asyncapi.yml" @@ -51,10 +51,10 @@ class AnyOfAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("testMessages", Message.builder() - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .anyOf(listOf( - Schema.builder().ref("#/components/schemas/objectWithKey").build(), - Schema.builder().ref("#/components/schemas/objectWithKey2").build() + AsyncAPISchema.builder().ref("#/components/schemas/objectWithKey").build(), + AsyncAPISchema.builder().ref("#/components/schemas/objectWithKey2").build() )) .build() ) @@ -63,11 +63,11 @@ class AnyOfAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("objectWithKey", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("key", - Schema.builder() + AsyncAPISchema.builder() .type("string") .additionalProperties(false) .build() @@ -76,11 +76,11 @@ class AnyOfAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("objectWithKey2", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("key2", - Schema.builder() + AsyncAPISchema.builder() .type("string") .build() ) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/ApplicationHeadersAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/ApplicationHeadersAsyncAPI.kt index e5f37000..8c7e108d 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/ApplicationHeadersAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/ApplicationHeadersAsyncAPI.kt @@ -12,7 +12,7 @@ import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3._0_0.model.server.ServerVariable -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import java.math.BigDecimal class ApplicationHeadersAsyncAPI: AbstractExampleValidationTest() { @@ -95,13 +95,13 @@ class ApplicationHeadersAsyncAPI: AbstractExampleValidationTest() { .summary("Inform about environmental lighting conditions of a particular streetlight.") .correlationId(CorrelationId(null, "\$message.header#/MQMD/CorrelId")) .contentType("application/json") - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("MQMD", Schema.builder() + Pair("MQMD", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("CorrelId", Schema.builder() + Pair("CorrelId", AsyncAPISchema.builder() .type("string") .minLength(24) .maxLength(24) @@ -111,7 +111,7 @@ class ApplicationHeadersAsyncAPI: AbstractExampleValidationTest() { )) .build() ), - Pair("applicationInstanceId", Schema.builder().ref("#/components/schemas/applicationInstanceId").build()) + Pair("applicationInstanceId", AsyncAPISchema.builder().ref("#/components/schemas/applicationInstanceId").build()) )) .build() ) @@ -121,29 +121,29 @@ class ApplicationHeadersAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("lightMeasuredPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("lumens", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .description("Light intensity measured in lumens.") .build() ), - Pair("sentAt", Schema.builder().ref("#/components/schemas/sentAt").build()) + Pair("sentAt", AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build()) )) .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("date-time") .description("Date and time when the message was sent.") .build() ), Pair("applicationInstanceId", - Schema.builder() + AsyncAPISchema.builder() .type("string") .description("Unique identifier for a given instance of the publishing application") .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/CorrelationIdAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/CorrelationIdAsyncAPI.kt index 50249128..9a1a2f0c 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/CorrelationIdAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/CorrelationIdAsyncAPI.kt @@ -13,7 +13,7 @@ import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3._0_0.model.server.ServerVariable -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.OpenIdConnectSecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuth2SecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuthFlows @@ -187,18 +187,18 @@ class CorrelationIdAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("lightMeasuredPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("lumens", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .description("Light intensity measured in lumens.") .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .ref("#/components/schemas/sentAt") .build() ) @@ -206,11 +206,11 @@ class CorrelationIdAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("dimLightPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("percentage", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) @@ -218,7 +218,7 @@ class CorrelationIdAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .ref("#/components/schemas/sentAt") .build() ) @@ -226,7 +226,7 @@ class CorrelationIdAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("date-time") .description("Date and time when the message was sent.") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt index f460e9dc..c6880667 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt @@ -12,8 +12,9 @@ import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3.binding.operation.http.HTTPOperationBinding import com.asyncapi.v3.binding.operation.http.HTTPOperationMethod -import com.asyncapi.v3.schema.MultiFormatSchema -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema import com.asyncapi.v3.security_scheme.http.HttpSecurityScheme class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { @@ -102,141 +103,168 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("chatMessage", Message.builder() .summary("A message represents an individual chat message sent to a room. They are a sub-resource of a room.") - .payload(MultiFormatSchema( + .payload( + JsonFormatSchema( "application/schema+yaml;version=draft-07", - mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "string"), - Pair("description", "ID of the message."), - )), - Pair("text", mapOf( - Pair("type", "string"), - Pair("description", "Original message in plain-text/markdown."), - )), - Pair("html", mapOf( - Pair("type", "string"), - Pair("description", "HTML formatted message."), - )), - Pair("sent", mapOf( - Pair("type", "string"), - Pair("format", "date-time"), - Pair("description", "ISO formatted date of the message."), - )), - Pair("fromUser", mapOf( - Pair("type", "object"), - Pair("description", "User that sent the message."), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "string"), - Pair("description", "Gitter User ID."), - )), - Pair("username", mapOf( - Pair("type", "string"), - Pair("description", "Gitter/GitHub username."), - )), - Pair("displayName", mapOf( - Pair("type", "string"), - Pair("description", "Gitter/GitHub user real name."), - )), - Pair("url", mapOf( - Pair("type", "string"), - Pair("description", "Path to the user on Gitter."), - )), - Pair("avatarUrl", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI."), - )), - Pair("avatarUrlSmall", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI (small)."), - )), - Pair("avatarUrlMedium", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI (medium)."), - )), - Pair("v", mapOf( - Pair("type", "number"), - Pair("description", "Version."), - )), - Pair("gv", mapOf( - Pair("type", "string"), - Pair("description", "Stands for \"Gravatar version\" and is used for cache busting."), - )) - )), - )), - Pair("unread", mapOf( - Pair("type", "boolean"), - Pair("description", "Boolean that indicates if the current user has read the message."), - )), - Pair("readBy", mapOf( - Pair("type", "number"), - Pair("description", "Number of users that have read the message."), - )), - Pair("urls", mapOf( - Pair("type", "array"), - Pair("description", "List of URLs present in the message."), - Pair("items", mapOf( - Pair("type", "string"), - Pair("format", "uri") - )), - )), - Pair("mentions", mapOf( - Pair("type", "array"), - Pair("description", "List of @Mentions in the message."), - Pair("items", mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("screenName", mapOf(Pair("type", "string"))), - Pair("userId", mapOf(Pair("type", "string"))), - Pair("userIds", mapOf( - Pair("type", "array"), - Pair("items", mapOf(Pair("type", "string"))), - )), - )) - )), - )), - Pair("issues", mapOf( - Pair("type", "array"), - Pair("description", "List of #Issues referenced in the message."), - Pair("items", mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("number", mapOf(Pair("type", "string"))) - )) - )), - )), - Pair("meta", mapOf( - Pair("type", "array"), - Pair("description", "Metadata. This is currently not used for anything."), - Pair("items", emptyMap()), - )), - Pair("v", mapOf( - Pair("type", "number"), - Pair("description", "Version.") - )), - Pair("gv", mapOf( - Pair("type", "string"), - Pair("description", "Stands for \"Gravatar version\" and is used for cache busting.") + JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("string") + .description("ID of the message.") + .build() + ), + Pair("text", JsonSchema.builder() + .type("string") + .description("Original message in plain-text/markdown.") + .build() + ), + Pair("html", JsonSchema.builder() + .type("string") + .description("HTML formatted message.") + .build() + ), + Pair("sent", JsonSchema.builder() + .type("string") + .format("date-time") + .description("ISO formatted date of the message.") + .build() + ), + Pair("fromUser", JsonSchema.builder() + .type("object") + .description("User that sent the message.") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("string") + .description("Gitter User ID.") + .build() + ), + Pair("username", JsonSchema.builder() + .type("string") + .description("Gitter/GitHub username.") + .build() + ), + Pair("displayName", JsonSchema.builder() + .type("string") + .description("Gitter/GitHub user real name.") + .build() + ), + Pair("url", JsonSchema.builder() + .type("string") + .description("Path to the user on Gitter.") + .build() + ), + Pair("avatarUrl", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI.") + .build() + ), + Pair("avatarUrlSmall", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI (small).") + .build() + ), + Pair("avatarUrlMedium", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI (medium).") + .build() + ), + Pair("v", JsonSchema.builder() + .type("number") + .description("Version.") + .build() + ), + Pair("gv", JsonSchema.builder() + .type("string") + .description("Stands for \"Gravatar version\" and is used for cache busting.") + .build() + ), + )) + .build() + ), + Pair("unread", JsonSchema.builder() + .type("boolean") + .description("Boolean that indicates if the current user has read the message.") + .build() + ), + Pair("readBy", JsonSchema.builder() + .type("number") + .description("Number of users that have read the message.") + .build() + ), + Pair("urls", JsonSchema.builder() + .type("array") + .description("List of URLs present in the message.") + .items(JsonSchema.builder() + .type("string") + .format("uri") + .build() + ) + .build() + ), + Pair("mentions", JsonSchema.builder() + .type("array") + .description("List of @Mentions in the message.") + .items(JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("screenName", JsonSchema.builder().type("string").build()), + Pair("userId", JsonSchema.builder().type("string").build()), + Pair("userIds", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), )) - )), - ) + .build() + ) + .build() + ), + Pair("issues", JsonSchema.builder() + .type("array") + .description("List of #Issues referenced in the message.") + .items(JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("number", JsonSchema.builder().type("string").build()), + )) + .build() + ) + .build() + ), + Pair("meta", JsonSchema.builder() + .type("array") + .description("Metadata. This is currently not used for anything.") + .items(JsonSchema.builder().build()) + .build() + ), + Pair("v", JsonSchema.builder() + .type("number") + .description("Version.") + .build() + ), + Pair("gv", JsonSchema.builder() + .type("string") + .description("Stands for \"Gravatar version\" and is used for cache busting.") + .build() + ), + )) + .build() )) .bindings(mapOf( Pair("http", HTTPMessageBinding.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("Transfer-Encoding", Schema.builder() + Pair("Transfer-Encoding", AsyncAPISchema.builder() .type("string") .constValue("chunked") .build() ), - Pair("Trailer", Schema.builder() + Pair("Trailer", AsyncAPISchema.builder() .type("string") .constValue("\\r\\n") .build() @@ -249,24 +277,24 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { .build()), Pair("heartbeat", Message.builder() .summary("Its purpose is to keep the connection alive.") - .payload(MultiFormatSchema( - "application/schema+yaml;version=draft-07", - mapOf( - Pair("type", "string"), - Pair("enum", listOf("\r\n")), - ) + .payload(JsonFormatSchema( + "application/schema+yaml;version=draft-07", + JsonSchema.builder() + .type("string") + .enumValue(listOf("\r\n")) + .build() )) .bindings(mapOf( Pair("http", HTTPMessageBinding.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("Transfer-Encoding", Schema.builder() + Pair("Transfer-Encoding", AsyncAPISchema.builder() .type("string") .constValue("chunked") .build() ), - Pair("Trailer", Schema.builder() + Pair("Trailer", AsyncAPISchema.builder() .type("string") .constValue("\\r\\n") .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI.kt index 8af232da..073c1760 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI.kt @@ -10,7 +10,7 @@ import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.operation.reply.OperationReply -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleValidationTest() { @@ -120,19 +120,19 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa Pair("dummyCurrencyInfo", Message.builder() .summary("Dummy message with no real life details") .description("It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("currencyInfo") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("data", Schema.builder() + Pair("data", AsyncAPISchema.builder() .type("object") .build() ), @@ -214,15 +214,15 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa ), )) .schemas(mapOf( - Pair("ping", Schema.builder() + Pair("ping", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("ping") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ) @@ -230,10 +230,10 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa .required(listOf("event")) .build() ), - Pair("heartbeat", Schema.builder() + Pair("heartbeat", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("heartbeat") .build() @@ -241,92 +241,92 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa )) .build() ), - Pair("pong", Schema.builder() + Pair("pong", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("pong") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ) )) .build() ), - Pair("systemStatus", Schema.builder() + Pair("systemStatus", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("systemStatus") .build() ), - Pair("connectionID", Schema.builder() + Pair("connectionID", AsyncAPISchema.builder() .type("integer") .description("The ID of the connection") .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .ref("#/components/schemas/status") .build() ), - Pair("version", Schema.builder() + Pair("version", AsyncAPISchema.builder() .type("string") .build() ) )) .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .type("string") .enumValue(listOf( "online", "maintenance", "cancel_only", "limit_only", "post_only" )) .build() ), - Pair("subscribe", Schema.builder() + Pair("subscribe", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("subscribe") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .ref("#/components/schemas/depth") .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .ref("#/components/schemas/interval") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .ref("#/components/schemas/name") .build() ), - Pair("ratecounter", Schema.builder() + Pair("ratecounter", AsyncAPISchema.builder() .ref("#/components/schemas/ratecounter") .build() ), - Pair("snapshot", Schema.builder() + Pair("snapshot", AsyncAPISchema.builder() .ref("#/components/schemas/snapshot") .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .ref("#/components/schemas/token") .build() ) @@ -338,38 +338,38 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa .required(listOf("event")) .build() ), - Pair("unsubscribe", Schema.builder() + Pair("unsubscribe", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("unsubscribe") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .ref("#/components/schemas/depth") .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .ref("#/components/schemas/interval") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .ref("#/components/schemas/name") .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .ref("#/components/schemas/token") .build() ) @@ -381,36 +381,36 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa .required(listOf("event")) .build() ), - Pair("subscriptionStatus", Schema.builder() + Pair("subscriptionStatus", AsyncAPISchema.builder() .type("object") .oneOf(listOf( - Schema.builder().ref("#/components/schemas/subscriptionStatusError").build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusSuccess").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusError").build(), + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusSuccess").build() )) .build() ), - Pair("subscriptionStatusError", Schema.builder() + Pair("subscriptionStatusError", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("errorMessage", Schema.builder().type("string").build()) + Pair("errorMessage", AsyncAPISchema.builder().type("string").build()) )) .required(listOf("errorMessage")) .build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() )) .build() ), - Pair("subscriptionStatusSuccess", Schema.builder() + Pair("subscriptionStatusSuccess", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("channelID", Schema.builder() + Pair("channelID", AsyncAPISchema.builder() .type("integer") .description("ChannelID on successful subscription, applicable to public messages only.") .build() ), - Pair("channelName", Schema.builder() + Pair("channelName", AsyncAPISchema.builder() .type("string") .description("Channel Name on successful subscription. For payloads 'ohlc' and 'book', respective interval or depth will be added as suffix.") .build() @@ -418,47 +418,47 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa )) .required(listOf("channelID", "channelName")) .build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() )) .build() ), - Pair("subscriptionStatusCommon", Schema.builder() + Pair("subscriptionStatusCommon", AsyncAPISchema.builder() .type("object") .required(listOf("event")) .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("subscriptionStatus") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .ref("#/components/schemas/status") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .required(listOf("name")) .properties(mapOf( - Pair("depth", Schema.builder().ref("#/components/schemas/depth").build()), - Pair("interval", Schema.builder().ref("#/components/schemas/interval").build()), - Pair("maxratecount", Schema.builder().ref("#/components/schemas/maxratecount").build()), - Pair("name", Schema.builder().ref("#/components/schemas/name").build()), - Pair("token", Schema.builder().ref("#/components/schemas/token").build()), + Pair("depth", AsyncAPISchema.builder().ref("#/components/schemas/depth").build()), + Pair("interval", AsyncAPISchema.builder().ref("#/components/schemas/interval").build()), + Pair("maxratecount", AsyncAPISchema.builder().ref("#/components/schemas/maxratecount").build()), + Pair("name", AsyncAPISchema.builder().ref("#/components/schemas/name").build()), + Pair("token", AsyncAPISchema.builder().ref("#/components/schemas/token").build()), )) .build() ) )) .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .type("integer") .description("Time interval associated with ohlc subscription in minutes.") .defaultValue(1) @@ -467,7 +467,7 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa )) .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .description("The name of the channel you subscribe too.") .enumValue(listOf( @@ -475,12 +475,12 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa )) .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .type("string") .description("base64-encoded authentication token for private-data endpoints.") .build() ), - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .type("integer") .defaultValue(10) .description("Depth associated with book subscription in number of levels each side.") @@ -489,32 +489,32 @@ class KrakenWebsocketRequestReplyMessageFilterInReplyAsyncAPI: AbstractExampleVa )) .build() ), - Pair("maxratecount", Schema.builder() + Pair("maxratecount", AsyncAPISchema.builder() .type("integer") .description("Max rate-limit budget. Compare to the ratecounter field in the openOrders updates to check whether you are approaching the rate limit.") .build() ), - Pair("ratecounter", Schema.builder() + Pair("ratecounter", AsyncAPISchema.builder() .type("boolean") .defaultValue(false) .description("Whether to send rate-limit counter in updates (supported only for openOrders subscriptions)") .build() ), - Pair("snapshot", Schema.builder() + Pair("snapshot", AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Whether to send historical feed data snapshot upon subscription (supported only for ownTrades subscriptions)") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .type("integer") .description("client originated ID reflected in response message.") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .type("array") .description("Array of currency pairs.") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("string") .description("Format of each pair is \"A/B\", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized.") .pattern("[A-Z\\s]+\\/[A-Z\\s]+") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt index 72d8c433..54d41f9d 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt @@ -10,7 +10,7 @@ import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.operation.reply.OperationReply -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValidationTest() { @@ -152,19 +152,19 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida Pair("dummyCurrencyInfo", Message.builder() .summary("Dummy message with no real life details") .description("It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("currencyInfo") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("data", Schema.builder() + Pair("data", AsyncAPISchema.builder() .type("object") .build() ), @@ -246,15 +246,15 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida ), )) .schemas(mapOf( - Pair("ping", Schema.builder() + Pair("ping", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("ping") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ) @@ -262,10 +262,10 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida .required(listOf("event")) .build() ), - Pair("heartbeat", Schema.builder() + Pair("heartbeat", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("heartbeat") .build() @@ -273,92 +273,92 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida )) .build() ), - Pair("pong", Schema.builder() + Pair("pong", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("pong") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ) )) .build() ), - Pair("systemStatus", Schema.builder() + Pair("systemStatus", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("systemStatus") .build() ), - Pair("connectionID", Schema.builder() + Pair("connectionID", AsyncAPISchema.builder() .type("integer") .description("The ID of the connection") .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .ref("#/components/schemas/status") .build() ), - Pair("version", Schema.builder() + Pair("version", AsyncAPISchema.builder() .type("string") .build() ) )) .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .type("string") .enumValue(listOf( "online", "maintenance", "cancel_only", "limit_only", "post_only" )) .build() ), - Pair("subscribe", Schema.builder() + Pair("subscribe", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("subscribe") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .ref("#/components/schemas/depth") .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .ref("#/components/schemas/interval") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .ref("#/components/schemas/name") .build() ), - Pair("ratecounter", Schema.builder() + Pair("ratecounter", AsyncAPISchema.builder() .ref("#/components/schemas/ratecounter") .build() ), - Pair("snapshot", Schema.builder() + Pair("snapshot", AsyncAPISchema.builder() .ref("#/components/schemas/snapshot") .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .ref("#/components/schemas/token") .build() ) @@ -370,38 +370,38 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida .required(listOf("event")) .build() ), - Pair("unsubscribe", Schema.builder() + Pair("unsubscribe", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("unsubscribe") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .ref("#/components/schemas/depth") .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .ref("#/components/schemas/interval") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .ref("#/components/schemas/name") .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .ref("#/components/schemas/token") .build() ) @@ -413,36 +413,36 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida .required(listOf("event")) .build() ), - Pair("subscriptionStatus", Schema.builder() + Pair("subscriptionStatus", AsyncAPISchema.builder() .type("object") .oneOf(listOf( - Schema.builder().ref("#/components/schemas/subscriptionStatusError").build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusSuccess").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusError").build(), + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusSuccess").build() )) .build() ), - Pair("subscriptionStatusError", Schema.builder() + Pair("subscriptionStatusError", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("errorMessage", Schema.builder().type("string").build()) + Pair("errorMessage", AsyncAPISchema.builder().type("string").build()) )) .required(listOf("errorMessage")) .build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() )) .build() ), - Pair("subscriptionStatusSuccess", Schema.builder() + Pair("subscriptionStatusSuccess", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("channelID", Schema.builder() + Pair("channelID", AsyncAPISchema.builder() .type("integer") .description("ChannelID on successful subscription, applicable to public messages only.") .build() ), - Pair("channelName", Schema.builder() + Pair("channelName", AsyncAPISchema.builder() .type("string") .description("Channel Name on successful subscription. For payloads 'ohlc' and 'book', respective interval or depth will be added as suffix.") .build() @@ -450,47 +450,47 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida )) .required(listOf("channelID", "channelName")) .build(), - Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + AsyncAPISchema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() )) .build() ), - Pair("subscriptionStatusCommon", Schema.builder() + Pair("subscriptionStatusCommon", AsyncAPISchema.builder() .type("object") .required(listOf("event")) .properties(mapOf( - Pair("event", Schema.builder() + Pair("event", AsyncAPISchema.builder() .type("string") .constValue("subscriptionStatus") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .ref("#/components/schemas/reqid") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .ref("#/components/schemas/pair") .build() ), - Pair("status", Schema.builder() + Pair("status", AsyncAPISchema.builder() .ref("#/components/schemas/status") .build() ), - Pair("subscription", Schema.builder() + Pair("subscription", AsyncAPISchema.builder() .type("object") .required(listOf("name")) .properties(mapOf( - Pair("depth", Schema.builder().ref("#/components/schemas/depth").build()), - Pair("interval", Schema.builder().ref("#/components/schemas/interval").build()), - Pair("maxratecount", Schema.builder().ref("#/components/schemas/maxratecount").build()), - Pair("name", Schema.builder().ref("#/components/schemas/name").build()), - Pair("token", Schema.builder().ref("#/components/schemas/token").build()), + Pair("depth", AsyncAPISchema.builder().ref("#/components/schemas/depth").build()), + Pair("interval", AsyncAPISchema.builder().ref("#/components/schemas/interval").build()), + Pair("maxratecount", AsyncAPISchema.builder().ref("#/components/schemas/maxratecount").build()), + Pair("name", AsyncAPISchema.builder().ref("#/components/schemas/name").build()), + Pair("token", AsyncAPISchema.builder().ref("#/components/schemas/token").build()), )) .build() ) )) .build() ), - Pair("interval", Schema.builder() + Pair("interval", AsyncAPISchema.builder() .type("integer") .description("Time interval associated with ohlc subscription in minutes.") .defaultValue(1) @@ -499,7 +499,7 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida )) .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .description("The name of the channel you subscribe too.") .enumValue(listOf( @@ -507,12 +507,12 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida )) .build() ), - Pair("token", Schema.builder() + Pair("token", AsyncAPISchema.builder() .type("string") .description("base64-encoded authentication token for private-data endpoints.") .build() ), - Pair("depth", Schema.builder() + Pair("depth", AsyncAPISchema.builder() .type("integer") .defaultValue(10) .description("Depth associated with book subscription in number of levels each side.") @@ -521,32 +521,32 @@ class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValida )) .build() ), - Pair("maxratecount", Schema.builder() + Pair("maxratecount", AsyncAPISchema.builder() .type("integer") .description("Max rate-limit budget. Compare to the ratecounter field in the openOrders updates to check whether you are approaching the rate limit.") .build() ), - Pair("ratecounter", Schema.builder() + Pair("ratecounter", AsyncAPISchema.builder() .type("boolean") .defaultValue(false) .description("Whether to send rate-limit counter in updates (supported only for openOrders subscriptions)") .build() ), - Pair("snapshot", Schema.builder() + Pair("snapshot", AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Whether to send historical feed data snapshot upon subscription (supported only for ownTrades subscriptions)") .build() ), - Pair("reqid", Schema.builder() + Pair("reqid", AsyncAPISchema.builder() .type("integer") .description("client originated ID reflected in response message.") .build() ), - Pair("pair", Schema.builder() + Pair("pair", AsyncAPISchema.builder() .type("array") .description("Array of currency pairs.") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("string") .description("Format of each pair is \"A/B\", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized.") .pattern("[A-Z\\s]+\\/[A-Z\\s]+") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/MercureAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/MercureAsyncAPI.kt index a015c5d3..2a33eb60 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/MercureAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/MercureAsyncAPI.kt @@ -10,7 +10,7 @@ import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class MercureAsyncAPI: AbstractExampleValidationTest() { @@ -89,33 +89,33 @@ class MercureAsyncAPI: AbstractExampleValidationTest() { Message.builder() .summary("The content of a book resource.") .externalDocs(ExternalDocumentation(null, "https://schema.org/Book")) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("@id", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("iri-reference") .build() ), Pair("@type", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("iri-reference") .build() ), Pair("name", - Schema.builder() + AsyncAPISchema.builder() .type("string") .build() ), Pair("isbn", - Schema.builder() + AsyncAPISchema.builder() .type("string") .build() ), Pair("abstract", - Schema.builder() + AsyncAPISchema.builder() .type("string") .build() ) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/NotAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/NotAsyncAPI.kt index ab5c395e..fae868ca 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/NotAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/NotAsyncAPI.kt @@ -7,7 +7,7 @@ import com.asyncapi.v3._0_0.model.component.Components import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class NotAsyncAPI: AbstractExampleValidationTest() { @@ -58,12 +58,12 @@ class NotAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("testSchema", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("key", - Schema.builder() - .not(Schema.builder().type("integer").build()) + AsyncAPISchema.builder() + .not(AsyncAPISchema.builder().type("integer").build()) .build() ) )) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OneOfAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OneOfAsyncAPI.kt index 551e37fb..ee97d3f5 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OneOfAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OneOfAsyncAPI.kt @@ -7,7 +7,7 @@ import com.asyncapi.v3._0_0.model.component.Components import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class OneOfAsyncAPI: AbstractExampleValidationTest() { @@ -71,10 +71,10 @@ class OneOfAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("testMessages", Message.builder() - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .oneOf(listOf( - Schema.builder().ref("#/components/schemas/objectWithKey").build(), - Schema.builder().ref("#/components/schemas/objectWithKey2").build() + AsyncAPISchema.builder().ref("#/components/schemas/objectWithKey").build(), + AsyncAPISchema.builder().ref("#/components/schemas/objectWithKey2").build() )) .build() ) @@ -93,18 +93,18 @@ class OneOfAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("objectWithKey", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("key", Schema.builder().type("string").build()) + Pair("key", AsyncAPISchema.builder().type("string").build()) )) .build() ), Pair("objectWithKey2", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("key2", Schema.builder().type("string").build()) + Pair("key2", AsyncAPISchema.builder().type("string").build()) )) .build() ) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OperationSecurityAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OperationSecurityAsyncAPI.kt index 46cd3011..aa5e02cd 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OperationSecurityAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/OperationSecurityAsyncAPI.kt @@ -9,7 +9,7 @@ import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3.binding.operation.http.HTTPOperationBinding import com.asyncapi.v3.binding.operation.http.HTTPOperationMethod -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.oauth2.OAuth2SecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuthFlows import com.asyncapi.v3.security_scheme.oauth2.flow.ClientCredentialsOAuthFlow @@ -83,15 +83,15 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("message", Message.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("X-SIGNATURE", Schema.builder() + Pair("X-SIGNATURE", AsyncAPISchema.builder() .description("ECC message signature") .type("string") .build() ), - Pair("Content-Type", Schema.builder() + Pair("Content-Type", AsyncAPISchema.builder() .type("string") .enumValue(listOf( "application/json" @@ -100,11 +100,11 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { ) )) .build()) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("metadata", Schema.builder().ref("#/components/schemas/MetaData").build()), - Pair("notification", Schema.builder().ref("#/components/schemas/Notification").build()) + Pair("metadata", AsyncAPISchema.builder().ref("#/components/schemas/MetaData").build()), + Pair("notification", AsyncAPISchema.builder().ref("#/components/schemas/Notification").build()) )) .build()) .build() @@ -112,20 +112,20 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("MetaData", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("topic", Schema.builder() + Pair("topic", AsyncAPISchema.builder() .type("string") .description("Topic subscribed to.") .build() ), - Pair("schemaVersion", Schema.builder() + Pair("schemaVersion", AsyncAPISchema.builder() .type("string") .description("The schema for this topic.") .build() ), - Pair("deprecated", Schema.builder() + Pair("deprecated", AsyncAPISchema.builder() .type("boolean") .description("If this is a deprecated schema or topic.") .defaultValue("false") @@ -135,30 +135,30 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("Notification", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("notificationId", Schema.builder() + Pair("notificationId", AsyncAPISchema.builder() .type("string") .description("The notification Id.") .build() ), - Pair("eventDate", Schema.builder() + Pair("eventDate", AsyncAPISchema.builder() .type("string") .description("The event date associated with this notification in UTC.") .build() ), - Pair("publishDate", Schema.builder() + Pair("publishDate", AsyncAPISchema.builder() .type("string") .description("The message publish date in UTC.") .build() ), - Pair("publishAttemptCount", Schema.builder() + Pair("publishAttemptCount", AsyncAPISchema.builder() .type("integer") .description("The number of attempts made to publish this message.") .build() ), - Pair("data", Schema.builder() + Pair("data", AsyncAPISchema.builder() .ref("#/components/schemas/AuthorizationRevocationData") .build() ) @@ -166,26 +166,26 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("AuthorizationRevocationData", - Schema.builder() + AsyncAPISchema.builder() .type("object") .description("The Authorization Revocation payload.") .properties(mapOf( - Pair("username", Schema.builder() + Pair("username", AsyncAPISchema.builder() .type("string") .description("The username for the user.") .build() ), - Pair("userId", Schema.builder() + Pair("userId", AsyncAPISchema.builder() .type("string") .description("The immutable public userId for the user") .build() ), - Pair("eiasToken", Schema.builder() + Pair("eiasToken", AsyncAPISchema.builder() .type("string") .description("The legacy eiasToken specific to the user") .build() ), - Pair("revokeReason", Schema.builder() + Pair("revokeReason", AsyncAPISchema.builder() .type("string") .description("The reason for authorization revocation") .enumValue(listOf( @@ -196,7 +196,7 @@ class OperationSecurityAsyncAPI: AbstractExampleValidationTest() { )) .build() ), - Pair("revocationDate", Schema.builder() + Pair("revocationDate", AsyncAPISchema.builder() .type("string") .description("Date and time when the authorization was revoked") .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcClientAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcClientAsyncAPI.kt index 8dff9686..ed2fda23 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcClientAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcClientAsyncAPI.kt @@ -14,7 +14,7 @@ import com.asyncapi.v3.binding.channel.amqp.AMQPChannelBinding import com.asyncapi.v3.binding.channel.amqp.AMQPChannelType import com.asyncapi.v3.binding.channel.amqp.queue.AMQPChannelQueueProperties import com.asyncapi.v3.binding.operation.amqp.AMQPOperationBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class RpcClientAsyncAPI: AbstractExampleValidationTest() { @@ -51,10 +51,10 @@ class RpcClientAsyncAPI: AbstractExampleValidationTest() { Pair("receiveSumResult", Message.builder() .correlationId(CorrelationId(null, "\$message.header#/correlation_id")) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("result", Schema.builder() + Pair("result", AsyncAPISchema.builder() .type("number") .examples(listOf(7)) .build() @@ -88,12 +88,12 @@ class RpcClientAsyncAPI: AbstractExampleValidationTest() { Pair("requestSum", Message.builder() .correlationId(CorrelationId(null, "\$message.header#/correlation_id")) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("numbers", Schema.builder() + Pair("numbers", AsyncAPISchema.builder() .type("array") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("number") .build() ) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcServerAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcServerAsyncAPI.kt index 65614a4a..40902eee 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcServerAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/RpcServerAsyncAPI.kt @@ -14,7 +14,7 @@ import com.asyncapi.v3.binding.channel.amqp.AMQPChannelBinding import com.asyncapi.v3.binding.channel.amqp.AMQPChannelType import com.asyncapi.v3.binding.channel.amqp.queue.AMQPChannelQueueProperties import com.asyncapi.v3.binding.operation.amqp.AMQPOperationBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class RpcServerAsyncAPI: AbstractExampleValidationTest() { @@ -51,10 +51,10 @@ class RpcServerAsyncAPI: AbstractExampleValidationTest() { Pair("sendSumResult", Message.builder() .correlationId(CorrelationId(null, "\$message.header#/correlation_id")) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("result", Schema.builder() + Pair("result", AsyncAPISchema.builder() .type("number") .examples(listOf(7)) .build() @@ -88,12 +88,12 @@ class RpcServerAsyncAPI: AbstractExampleValidationTest() { Pair("sum", Message.builder() .correlationId(CorrelationId(null, "\$message.header#/correlation_id")) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("numbers", Schema.builder() + Pair("numbers", AsyncAPISchema.builder() .type("array") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("number") .build() ) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SimpleAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SimpleAsyncAPI.kt index 48d14e54..b0ac9077 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SimpleAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SimpleAsyncAPI.kt @@ -7,7 +7,7 @@ import com.asyncapi.v3._0_0.model.component.Components import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema class SimpleAsyncAPI: AbstractExampleValidationTest() { @@ -55,17 +55,17 @@ class SimpleAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("UserSignedUp", Message.builder() - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("displayName", - Schema.builder() + AsyncAPISchema.builder() .type("string") .description("Name of the user") .build() ), Pair("email", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("email") .description("Email of the user") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SlackRtmAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SlackRtmAsyncAPI.kt index 18966b59..4bee7d0c 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SlackRtmAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/SlackRtmAsyncAPI.kt @@ -8,7 +8,7 @@ import com.asyncapi.v3._0_0.model.info.Info import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.http.HttpApiKeySecurityScheme class SlackRtmAsyncAPI: AbstractExampleValidationTest() { @@ -178,62 +178,62 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("attachment", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("fallback", Schema.builder() + Pair("fallback", AsyncAPISchema.builder() .type("string") .build() ), - Pair("color", Schema.builder() + Pair("color", AsyncAPISchema.builder() .type("string") .build() ), - Pair("pretext", Schema.builder() + Pair("pretext", AsyncAPISchema.builder() .type("string") .build() ), - Pair("author_name", Schema.builder() + Pair("author_name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("author_link", Schema.builder() + Pair("author_link", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("author_icon", Schema.builder() + Pair("author_icon", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("title", Schema.builder() + Pair("title", AsyncAPISchema.builder() .type("string") .build() ), - Pair("title_link", Schema.builder() + Pair("title_link", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("text", Schema.builder() + Pair("text", AsyncAPISchema.builder() .type("string") .build() ), - Pair("fields", Schema.builder() + Pair("fields", AsyncAPISchema.builder() .type("array") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("title", Schema.builder() + Pair("title", AsyncAPISchema.builder() .type("string") .build() ), - Pair("value", Schema.builder() + Pair("value", AsyncAPISchema.builder() .type("string") .build() ), - Pair("short", Schema.builder() + Pair("short", AsyncAPISchema.builder() .type("boolean") .build() ), @@ -242,26 +242,26 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { ) .build() ), - Pair("image_url", Schema.builder() + Pair("image_url", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("thumb_url", Schema.builder() + Pair("thumb_url", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("footer", Schema.builder() + Pair("footer", AsyncAPISchema.builder() .type("string") .build() ), - Pair("footer_icon", Schema.builder() + Pair("footer_icon", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("number") .build() ), @@ -273,10 +273,10 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("hello", Message.builder() .summary("First event received upon connection.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("hello")) .build() @@ -289,19 +289,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("connectionError", Message.builder() .summary("Event received when a connection error happens.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("error")) .build() ), - Pair("error", Schema.builder() + Pair("error", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("code", Schema.builder().type("number").build()), - Pair("msg", Schema.builder().type("string").build()), + Pair("code", AsyncAPISchema.builder().type("number").build()), + Pair("msg", AsyncAPISchema.builder().type("string").build()), )) .build() ) @@ -313,10 +313,10 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("accountsChanged", Message.builder() .summary("The list of accounts a user is signed into has changed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("accounts_changed")) .build() @@ -329,32 +329,32 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("botAdded", Message.builder() .summary("A bot user was added.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("bot_added")) .build() ), - Pair("bot", Schema.builder() + Pair("bot", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("app_id", Schema.builder() + Pair("app_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("icons", Schema.builder() + Pair("icons", AsyncAPISchema.builder() .type("object") - .additionalProperties(Schema.builder().type("string").build()) + .additionalProperties(AsyncAPISchema.builder().type("string").build()) .build() ) )) @@ -368,32 +368,32 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("botChanged", Message.builder() .summary("A bot user was changed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("bot_added")) .build() ), - Pair("bot", Schema.builder() + Pair("bot", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("app_id", Schema.builder() + Pair("app_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("icons", Schema.builder() + Pair("icons", AsyncAPISchema.builder() .type("object") - .additionalProperties(Schema.builder().type("string").build()) + .additionalProperties(AsyncAPISchema.builder().type("string").build()) .build() ) )) @@ -407,19 +407,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelArchive", Message.builder() .summary("A channel was archived.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_archive")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -431,30 +431,30 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelCreated", Message.builder() .summary("A channel was created.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_created")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ), - Pair("creator", Schema.builder() + Pair("creator", AsyncAPISchema.builder() .type("string") .build() ) @@ -469,15 +469,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelDeleted", Message.builder() .summary("A channel was deleted.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_deleted")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ) @@ -489,23 +489,23 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelHistoryChanged", Message.builder() .summary("Bulk updates were made to a channel's history.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_history_changed")) .build() ), - Pair("latest", Schema.builder() + Pair("latest", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ) @@ -517,30 +517,30 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelJoined", Message.builder() .summary("You joined a channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_joined")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ), - Pair("creator", Schema.builder() + Pair("creator", AsyncAPISchema.builder() .type("string") .build() ) @@ -555,15 +555,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelLeft", Message.builder() .summary("You left a channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_left")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ) @@ -575,19 +575,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelMarked", Message.builder() .summary("Your channel read marker was updated.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_marked")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ) @@ -599,26 +599,26 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelRename", Message.builder() .summary("A channel was renamed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_rename")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ) @@ -633,19 +633,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("channelUnarchive", Message.builder() .summary("A channel was unarchived.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("channel_unarchive")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -657,15 +657,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("commandsChanged", Message.builder() .summary("A slash command has been added or changed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("commands_changed")) .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ) @@ -677,38 +677,38 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("dndUpdated", Message.builder() .summary("Do not Disturb settings changed for the current user.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("dnd_updated")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("dnd_status", Schema.builder() + Pair("dnd_status", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("dnd_enabled", Schema.builder() + Pair("dnd_enabled", AsyncAPISchema.builder() .type("boolean") .build() ), - Pair("next_dnd_start_ts", Schema.builder() + Pair("next_dnd_start_ts", AsyncAPISchema.builder() .type("number") .build() ), - Pair("next_dnd_end_ts", Schema.builder() + Pair("next_dnd_end_ts", AsyncAPISchema.builder() .type("number") .build() ), - Pair("snooze_enabled", Schema.builder() + Pair("snooze_enabled", AsyncAPISchema.builder() .type("boolean") .build() ), - Pair("snooze_endtime", Schema.builder() + Pair("snooze_endtime", AsyncAPISchema.builder() .type("number") .build() ) @@ -723,30 +723,30 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("dndUpdatedUser", Message.builder() .summary("Do not Disturb settings changed for a member.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("dnd_updated_user")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("dnd_status", Schema.builder() + Pair("dnd_status", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("dnd_enabled", Schema.builder() + Pair("dnd_enabled", AsyncAPISchema.builder() .type("boolean") .build() ), - Pair("next_dnd_start_ts", Schema.builder() + Pair("next_dnd_start_ts", AsyncAPISchema.builder() .type("number") .build() ), - Pair("next_dnd_end_ts", Schema.builder() + Pair("next_dnd_end_ts", AsyncAPISchema.builder() .type("number") .build() ) @@ -761,19 +761,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("emailDomainChanged", Message.builder() .summary("The workspace email domain has changed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("email_domain_changed")) .build() ), - Pair("email_domain", Schema.builder() + Pair("email_domain", AsyncAPISchema.builder() .type("string") .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -785,25 +785,25 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("emojiRemoved", Message.builder() .summary("A custom emoji has been removed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("emoji_changed")) .build() ), - Pair("subtype", Schema.builder() + Pair("subtype", AsyncAPISchema.builder() .type("string") .enumValue(listOf("remove")) .build() ), - Pair("names", Schema.builder() + Pair("names", AsyncAPISchema.builder() .type("array") - .items(Schema.builder().type("string").build()) + .items(AsyncAPISchema.builder().type("string").build()) .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -815,29 +815,29 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("emojiAdded", Message.builder() .summary("A custom emoji has been added.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("emoji_changed")) .build() ), - Pair("subtype", Schema.builder() + Pair("subtype", AsyncAPISchema.builder() .type("string") .enumValue(listOf("add")) .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("value", Schema.builder() + Pair("value", AsyncAPISchema.builder() .type("string") .format("uri") .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -849,22 +849,22 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileChange", Message.builder() .summary("A file was changed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_change")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -876,23 +876,23 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileCommentAdded", Message.builder() .summary("A file comment was added.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_comment_added")) .build() ), - Pair("comment", Schema()), - Pair("file_id", Schema.builder() + Pair("comment", AsyncAPISchema()), + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -904,26 +904,26 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileCommentDeleted", Message.builder() .summary("A file comment was deleted.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_comment_deleted")) .build() ), - Pair("comment", Schema.builder() + Pair("comment", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -935,23 +935,23 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileCommentEdited", Message.builder() .summary("A file comment was edited.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_comment_edited")) .build() ), - Pair("comment", Schema()), - Pair("file_id", Schema.builder() + Pair("comment", AsyncAPISchema()), + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -963,22 +963,22 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileCreated", Message.builder() .summary("A file was created.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_created")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -990,19 +990,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileDeleted", Message.builder() .summary("A file was deleted.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_deleted")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -1014,22 +1014,22 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("filePublic", Message.builder() .summary("A file was made public.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_public")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -1041,22 +1041,22 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileShared", Message.builder() .summary("A file was shared.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_shared")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -1068,22 +1068,22 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("fileUnshared", Message.builder() .summary("A file was unshared.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("file_unshared")) .build() ), - Pair("file_id", Schema.builder() + Pair("file_id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("file", Schema.builder() + Pair("file", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder().type("string").build()), + Pair("id", AsyncAPISchema.builder().type("string").build()), )) .build() ), @@ -1095,10 +1095,10 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("goodbye", Message.builder() .summary("The server intends to close the connection soon.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("goodbye")) .build() @@ -1111,15 +1111,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupArchive", Message.builder() .summary("A private channel was archived.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_archive")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), @@ -1131,19 +1131,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupClose", Message.builder() .summary("You closed a private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_close")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), @@ -1155,23 +1155,23 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupHistoryChanged", Message.builder() .summary("Bulk updates were made to a private channel's history.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_history_changed")) .build() ), - Pair("latest", Schema.builder() + Pair("latest", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ), - Pair("event_ts", Schema.builder() + Pair("event_ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -1183,30 +1183,30 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupJoined", Message.builder() .summary("You joined a private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_joined")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ), - Pair("creator", Schema.builder() + Pair("creator", AsyncAPISchema.builder() .type("string") .build() ), @@ -1221,15 +1221,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupLeft", Message.builder() .summary("You left a private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_left")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), @@ -1241,19 +1241,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupMarked", Message.builder() .summary("A private channel read marker was updated.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_marked")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -1265,19 +1265,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupOpen", Message.builder() .summary("You opened a private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_open")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -1289,26 +1289,26 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupRename", Message.builder() .summary("A private channel was renamed.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_rename")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ), @@ -1323,19 +1323,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("groupUnarchive", Message.builder() .summary("A private channel was unarchived.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("group_unarchive")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -1347,19 +1347,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("imClose", Message.builder() .summary("You closed a DM.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("im_close")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -1371,37 +1371,37 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("imCreated", Message.builder() .summary("A DM was created.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("im_created")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("string") .build() ), - Pair("name", Schema.builder() + Pair("name", AsyncAPISchema.builder() .type("string") .build() ), - Pair("created", Schema.builder() + Pair("created", AsyncAPISchema.builder() .type("number") .build() ), - Pair("creator", Schema.builder() + Pair("creator", AsyncAPISchema.builder() .type("string") .build() ), )) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -1413,19 +1413,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("imMarked", Message.builder() .summary("A direct message read marker was updated.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("im_marked")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ), @@ -1437,19 +1437,19 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("imOpen", Message.builder() .summary("You opened a DM.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("im_open")) .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), @@ -1461,15 +1461,15 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("manualPresenceChange", Message.builder() .summary("You manually updated your presence.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("manual_presence_change")) .build() ), - Pair("presence", Schema.builder() + Pair("presence", AsyncAPISchema.builder() .type("string") .build() ), @@ -1481,32 +1481,32 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("memberJoinedChannel", Message.builder() .summary("A user joined a public or private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("member_joined_channel")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel_type", Schema.builder() + Pair("channel_type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("C", "G")) .build() ), - Pair("team", Schema.builder() + Pair("team", AsyncAPISchema.builder() .type("string") .build() ), - Pair("inviter", Schema.builder() + Pair("inviter", AsyncAPISchema.builder() .type("string") .build() ), @@ -1518,28 +1518,28 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("memberLeftChannel", Message.builder() .summary("A user left a public or private channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("member_left_channel")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel_type", Schema.builder() + Pair("channel_type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("C", "G")) .build() ), - Pair("team", Schema.builder() + Pair("team", AsyncAPISchema.builder() .type("string") .build() ), @@ -1551,43 +1551,43 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("message", Message.builder() .summary("A message was sent to a channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("message")) .build() ), - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("text", Schema.builder() + Pair("text", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ), - Pair("attachments", Schema.builder() + Pair("attachments", AsyncAPISchema.builder() .type("array") - .items(Schema.builder().ref("#/components/schemas/attachment").build()) + .items(AsyncAPISchema.builder().ref("#/components/schemas/attachment").build()) .build() ), - Pair("edited", Schema.builder() + Pair("edited", AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("user", Schema.builder() + Pair("user", AsyncAPISchema.builder() .type("string") .build() ), - Pair("ts", Schema.builder() + Pair("ts", AsyncAPISchema.builder() .type("string") .build() ) @@ -1602,23 +1602,23 @@ class SlackRtmAsyncAPI: AbstractExampleValidationTest() { Pair("outgoingMessage", Message.builder() .summary("A message was sent to a channel.") - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("message")) .build() ), - Pair("id", Schema.builder() + Pair("id", AsyncAPISchema.builder() .type("number") .build() ), - Pair("channel", Schema.builder() + Pair("channel", AsyncAPISchema.builder() .type("string") .build() ), - Pair("text", Schema.builder() + Pair("text", AsyncAPISchema.builder() .type("string") .build() ), diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsKafkaAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsKafkaAsyncAPI.kt index fb29727f..9460de7e 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsKafkaAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsKafkaAsyncAPI.kt @@ -14,7 +14,7 @@ import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.operation.OperationTrait import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3.binding.operation.kafka.KafkaOperationBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.SecurityScheme import java.math.BigDecimal @@ -196,45 +196,45 @@ class StreetlightsKafkaAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("lightMeasuredPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("lumens", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .description("Light intensity measured in lumens.") .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("turnOnOffPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("command", - Schema.builder() + AsyncAPISchema.builder() .type("string") .enumValue(listOf("on", "off")) .description("Whether to turn on or off the light.") .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("dimLightPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("percentage", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) @@ -242,13 +242,13 @@ class StreetlightsKafkaAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("date-time") .description("Date and time when the message was sent.") @@ -275,10 +275,10 @@ class StreetlightsKafkaAsyncAPI: AbstractExampleValidationTest() { .messageTraits(mapOf( Pair("commonHeaders", MessageTrait.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("my-app-header", Schema.builder() + Pair("my-app-header", AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) @@ -295,7 +295,7 @@ class StreetlightsKafkaAsyncAPI: AbstractExampleValidationTest() { OperationTrait.builder() .bindings(mapOf( Pair("kafka", KafkaOperationBinding.builder() - .clientId(Schema.builder() + .clientId(AsyncAPISchema.builder() .type("string") .enumValue(listOf("my-app-id")) .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsMQTTAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsMQTTAsyncAPI.kt index e9a4c330..355912e2 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsMQTTAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsMQTTAsyncAPI.kt @@ -17,7 +17,7 @@ import com.asyncapi.v3._0_0.model.operation.OperationTrait import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3._0_0.model.server.ServerVariable import com.asyncapi.v3.binding.operation.mqtt.MQTTOperationBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.oauth2.OAuth2SecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuthFlows import com.asyncapi.v3.security_scheme.oauth2.flow.AuthorizationCodeOAuthFlow @@ -245,53 +245,53 @@ class StreetlightsMQTTAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("lightMeasuredPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("lumens", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .description("Light intensity measured in lumens.") .build() ), - Pair("sentAt", Schema.builder().ref("#/components/schemas/sentAt").build()) + Pair("sentAt", AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build()) )) .build() ), Pair("turnOnOffPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("command", - Schema.builder() + AsyncAPISchema.builder() .type("string") .enumValue(listOf("on", "off")) .description("Whether to turn on or off the light.") .build() ), - Pair("sentAt", Schema.builder().ref("#/components/schemas/sentAt").build()) + Pair("sentAt", AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build()) )) .build() ), Pair("dimLightPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("percentage", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) .description("Percentage to which the light should be dimmed to.") .build() ), - Pair("sentAt", Schema.builder().ref("#/components/schemas/sentAt").build()) + Pair("sentAt", AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build()) )) .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("date-time") .description("Date and time when the message was sent.") @@ -355,10 +355,10 @@ class StreetlightsMQTTAsyncAPI: AbstractExampleValidationTest() { .messageTraits(mapOf( Pair("commonHeaders", MessageTrait.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("my-app-header", Schema.builder() + Pair("my-app-header", AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsOperationSecurityAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsOperationSecurityAsyncAPI.kt index 3d38588e..cdd874db 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsOperationSecurityAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/StreetlightsOperationSecurityAsyncAPI.kt @@ -13,7 +13,7 @@ import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.operation.OperationTrait import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3.binding.operation.kafka.KafkaOperationBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.SecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuth2SecurityScheme import com.asyncapi.v3.security_scheme.oauth2.OAuthFlows @@ -212,45 +212,45 @@ class StreetlightsOperationSecurityAsyncAPI: AbstractExampleValidationTest() { )) .schemas(mapOf( Pair("lightMeasuredPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("lumens", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .description("Light intensity measured in lumens.") .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("turnOnOffPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("command", - Schema.builder() + AsyncAPISchema.builder() .type("string") .enumValue(listOf("on", "off")) .description("Whether to turn on or off the light.") .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("dimLightPayload", - Schema.builder() + AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair("percentage", - Schema.builder() + AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) @@ -258,13 +258,13 @@ class StreetlightsOperationSecurityAsyncAPI: AbstractExampleValidationTest() { .build() ), Pair("sentAt", - Schema.builder().ref("#/components/schemas/sentAt").build() + AsyncAPISchema.builder().ref("#/components/schemas/sentAt").build() ) )) .build() ), Pair("sentAt", - Schema.builder() + AsyncAPISchema.builder() .type("string") .format("date-time") .description("Date and time when the message was sent.") @@ -304,10 +304,10 @@ class StreetlightsOperationSecurityAsyncAPI: AbstractExampleValidationTest() { .messageTraits(mapOf( Pair("commonHeaders", MessageTrait.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( - Pair("my-app-header", Schema.builder() + Pair("my-app-header", AsyncAPISchema.builder() .type("integer") .minimum(BigDecimal.ZERO) .maximum(BigDecimal.valueOf(100)) @@ -324,7 +324,7 @@ class StreetlightsOperationSecurityAsyncAPI: AbstractExampleValidationTest() { OperationTrait.builder() .bindings(mapOf( Pair("kafka", KafkaOperationBinding.builder() - .clientId(Schema.builder() + .clientId(AsyncAPISchema.builder() .type("string") .enumValue(listOf("my-app-id")) .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/WebsocketGeminiAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/WebsocketGeminiAsyncAPI.kt index 88df5c00..baa463b7 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/WebsocketGeminiAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/WebsocketGeminiAsyncAPI.kt @@ -13,7 +13,7 @@ import com.asyncapi.v3._0_0.model.operation.Operation import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3.binding.channel.ws.WebSocketsChannelBinding -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -139,7 +139,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { "ws", WebSocketsChannelBinding.builder() .query( - Schema.builder() + AsyncAPISchema.builder() .type("object") .description( "The semantics of entry type filtering is:\n" + @@ -152,7 +152,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { .properties(mapOf( Pair( "heartbeat", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(false) .description( @@ -163,7 +163,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ), Pair( "top_of_book", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(false) .description( @@ -175,7 +175,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ), Pair( "bids", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Include bids in change events") @@ -183,7 +183,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ), Pair( "offers", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Include asks in change events") @@ -191,7 +191,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ), Pair( "trades", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Include trade events") @@ -199,7 +199,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ), Pair( "auctions", - Schema.builder() + AsyncAPISchema.builder() .type("boolean") .defaultValue(true) .description("Include auction events") @@ -277,34 +277,34 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ) )) .schemas(mapOf( - Pair("market", Schema.builder() + Pair("market", AsyncAPISchema.builder() .type("object") .oneOf(listOf( - Schema.builder().ref("#/components/schemas/heartbeat").build(), - Schema.builder().ref("#/components/schemas/update").build(), + AsyncAPISchema.builder().ref("#/components/schemas/heartbeat").build(), + AsyncAPISchema.builder().ref("#/components/schemas/update").build(), )) .build() ), - Pair("heartbeat", Schema.builder() + Pair("heartbeat", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("type", Schema.builder().type("string").constValue("heartbeat").build()) + Pair("type", AsyncAPISchema.builder().type("string").constValue("heartbeat").build()) )) .required(listOf("type")) .build(), - Schema.builder() + AsyncAPISchema.builder() .ref("#/components/schemas/default") .build(), )) .build() ), - Pair("update", Schema.builder() + Pair("update", AsyncAPISchema.builder() .allOf(listOf( - Schema.builder() + AsyncAPISchema.builder() .properties(mapOf( - Pair("type", Schema.builder().type("string").constValue("update").build()), - Pair("eventId", Schema.builder() + Pair("type", AsyncAPISchema.builder().type("string").constValue("update").build()), + Pair("eventId", AsyncAPISchema.builder() .type("integer") .description( "A monotonically increasing sequence number indicating when this " + @@ -313,8 +313,8 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ) .build() ), - Pair("events", Schema.builder().ref("#/components/schemas/events").build()), - Pair("timestamp", Schema.builder() + Pair("events", AsyncAPISchema.builder().ref("#/components/schemas/events").build()), + Pair("timestamp", AsyncAPISchema.builder() .type("number") .description( "The timestamp in seconds for this group of events (included for " + @@ -323,7 +323,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ) .build() ), - Pair("timestampms", Schema.builder() + Pair("timestampms", AsyncAPISchema.builder() .type("number") .description("The timestamp in milliseconds for this group of events.") .build() @@ -331,18 +331,18 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { )) .required(listOf("type", "eventId", "events", "timestamp", "timestampms")) .build(), - Schema.builder().ref("#/components/schemas/default").build(), + AsyncAPISchema.builder().ref("#/components/schemas/default").build(), )) .build() ), - Pair("default", Schema.builder() + Pair("default", AsyncAPISchema.builder() .type("object") .description( "This object is always part of the payload. In case of type=heartbeat, " + "these are the only fields.") .required(listOf("type", "socket_sequence")) .properties(mapOf( - Pair("socket_sequence", Schema.builder() + Pair("socket_sequence", AsyncAPISchema.builder() .type("integer") .description( "zero-indexed monotonic increasing sequence number attached to each " + @@ -357,30 +357,30 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { )) .build() ), - Pair("events", Schema.builder() + Pair("events", AsyncAPISchema.builder() .type("array") .description("Either a change to the order book, or the indication that a trade has occurred.") - .items(Schema.builder() + .items(AsyncAPISchema.builder() .type("object") .additionalProperties(false) .properties(mapOf( - Pair("type", Schema.builder() + Pair("type", AsyncAPISchema.builder() .type("string") .enumValue(listOf("trade", "change", "auction, block_trade")) .build() ), - Pair("price", Schema.builder() + Pair("price", AsyncAPISchema.builder() .type("number") .multipleOf(0.01) .description("The price of this order book entry.") .build() ), - Pair("side", Schema.builder() + Pair("side", AsyncAPISchema.builder() .type("string") .enumValue(listOf("bid", "side")) .build() ), - Pair("reason", Schema.builder() + Pair("reason", AsyncAPISchema.builder() .type("string") .enumValue(listOf("place", "trade", "cancel", "initial")) .description( @@ -390,7 +390,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ) .build() ), - Pair("remaining", Schema.builder() + Pair("remaining", AsyncAPISchema.builder() .type("number") .description( "The quantity remaining at that price level after this change " + @@ -399,7 +399,7 @@ class WebsocketGeminiAsyncAPI: AbstractExampleValidationTest() { ) .build() ), - Pair("delta", Schema.builder() + Pair("delta", AsyncAPISchema.builder() .type("number") .description( "The quantity changed. May be negative, if an order is filled or canceled. For initial messages, delta will equal remaining." diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt index 25f4d846..f54d28e9 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt @@ -4,8 +4,6 @@ import com.asyncapi.v3.Reference import com.asyncapi.v3.SerDeTest import com.asyncapi.v3._0_0.model.ExternalDocumentation import com.asyncapi.v3._0_0.model.Tag -import com.asyncapi.v3.schema.Schema -import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest import com.asyncapi.v3.binding.message.googlepubsub.GooglePubSubMessageBindingTest @@ -13,6 +11,8 @@ import com.asyncapi.v3.binding.message.http.HTTPMessageBindingTest import com.asyncapi.v3.binding.message.ibmmq.IBMMQMessageBindingTest import com.asyncapi.v3.binding.message.kafka.KafkaMessageBindingTest import com.asyncapi.v3.binding.message.mqtt.MQTTMessageBindingTest +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema class MessageTestWithSchema: SerDeTest() { @@ -26,19 +26,19 @@ class MessageTestWithSchema: SerDeTest() { override fun build(): Message { return Message.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair( "correlationId", - Schema.builder() + AsyncAPISchema.builder() .description("Correlation ID set by application") .type("string") .build() ), Pair( "applicationInstanceId", - Schema.builder() + AsyncAPISchema.builder() .description("Unique identifier for a given instance of the publishing application") .type("string") .build() @@ -46,12 +46,12 @@ class MessageTestWithSchema: SerDeTest() { )) .build() ) - .payload(Schema.builder() + .payload(AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair( "metric", - Schema.builder() + AsyncAPISchema.builder() .description("Metric set by application") .type("string") .build() @@ -180,43 +180,37 @@ class MessageTestWithMultiFormatSchema: SerDeTest() { override fun build(): Message { return Message.builder() - .headers(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "correlationId", - mapOf( - Pair("description", "Correlation ID set by application"), - Pair("type", "string") - ) + .headers(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("correlationId", AsyncAPISchema.builder() + .type("string") + .description("Correlation ID set by application") + .build() ), - Pair( - "applicationInstanceId", - mapOf( - Pair("description", "Unique identifier for a given instance of the publishing application"), - Pair("type", "string") - ) + Pair("applicationInstanceId", AsyncAPISchema.builder() + .type("string") + .description("Unique identifier for a given instance of the publishing application") + .build() ) )) - )).build() - ) - .payload(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "metric", - mapOf( - Pair("description", "Metric set by application"), - Pair("type", "string") - ) + .build() + )) + .payload(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("metric", AsyncAPISchema.builder() + .type("string") + .description("Metric set by application") + .build() ) )) - )).build() - ) + .build() + )) .correlationId(Reference("#/components/messages/message-correlation-id")) .contentType("application/json") .name("UserSignup") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt index a337a64a..1a8e246e 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt @@ -4,8 +4,7 @@ import com.asyncapi.v3.Reference import com.asyncapi.v3.SerDeTest import com.asyncapi.v3._0_0.model.ExternalDocumentation import com.asyncapi.v3._0_0.model.Tag -import com.asyncapi.v3.schema.Schema -import com.asyncapi.v3.schema.MultiFormatSchema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest import com.asyncapi.v3.binding.message.googlepubsub.GooglePubSubMessageBindingTest @@ -13,6 +12,7 @@ import com.asyncapi.v3.binding.message.http.HTTPMessageBindingTest import com.asyncapi.v3.binding.message.ibmmq.IBMMQMessageBindingTest import com.asyncapi.v3.binding.message.kafka.KafkaMessageBindingTest import com.asyncapi.v3.binding.message.mqtt.MQTTMessageBindingTest +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema class MessageTraitTestWithSchema: SerDeTest() { @@ -26,19 +26,19 @@ class MessageTraitTestWithSchema: SerDeTest() { override fun build(): MessageTrait { return MessageTrait.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type("object") .properties(mapOf( Pair( "correlationId", - Schema.builder() + AsyncAPISchema.builder() .description("Correlation ID set by application") .type("string") .build() ), Pair( "applicationInstanceId", - Schema.builder() + AsyncAPISchema.builder() .description("Unique identifier for a given instance of the publishing application") .type("string") .build() @@ -150,28 +150,24 @@ class MessageTraitTestWithMultiFormatSchema: SerDeTest() { override fun build(): MessageTrait { return MessageTrait.builder() - .headers(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "correlationId", - mapOf( - Pair("description", "Correlation ID set by application"), - Pair("type", "string") - ) + .headers(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("correlationId", AsyncAPISchema.builder() + .type("string") + .description("Correlation ID set by application") + .build() ), - Pair( - "applicationInstanceId", - mapOf( - Pair("description", "Unique identifier for a given instance of the publishing application"), - Pair("type", "string") - ) + Pair("applicationInstanceId", AsyncAPISchema.builder() + .type("string") + .description("Unique identifier for a given instance of the publishing application") + .build() ) )) - )).build() - ) + .build() + )) .correlationId(Reference("#/components/messages/message-correlation-id")) .contentType("application/json") .name("UserSignup") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageWithArrayPayloadTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageWithArrayPayloadTest.kt index 02825157..f82d84c2 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageWithArrayPayloadTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageWithArrayPayloadTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3._0_0.model.channel.message import com.asyncapi.v3.ClasspathUtils -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.fasterxml.jackson.databind.ObjectMapper import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test @@ -14,9 +14,9 @@ class MessageWithArrayPayloadTest { @DisplayName("Test array items property is parsed as a schema object") fun testArrayItemsPropertyIsParsedAsSchemaObjectWhenItIsASingleJsonSchema() { val model = ClasspathUtils.readAsString("/json/v3/3.0.0/model/channel/message/messageWithArrayPayloadJsonSchema.json") - val schema = objectMapper.readValue(model, Message::class.java).payload as Schema + val schema = objectMapper.readValue(model, Message::class.java).payload as AsyncAPISchema assertTrue( - schema.items is Schema + schema.items is AsyncAPISchema ) } @@ -24,7 +24,7 @@ class MessageWithArrayPayloadTest { @DisplayName("Test array items property is parsed as list of schemas") fun testArrayItemsPropertyIsParsedAsArrayListOfSchemasWhenItIsAnArrayOfSchemas() { val model = ClasspathUtils.readAsString("/json/v3/3.0.0/model/channel/message/messageWithArrayPayloadArrayOfSchemas.json") - val schema = objectMapper.readValue(model, Message::class.java).payload as Schema - assertTrue(schema.items is ArrayList<*> && (schema.items as ArrayList<*>).all { it is Schema }) + val schema = objectMapper.readValue(model, Message::class.java).payload as AsyncAPISchema + assertTrue(schema.items is ArrayList<*> && (schema.items as ArrayList<*>).all { it is AsyncAPISchema }) } } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt index 2c42c289..8d85f021 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt @@ -18,9 +18,10 @@ import com.asyncapi.v3._0_0.model.operation.reply.OperationReplyTest import com.asyncapi.v3._0_0.model.operation.reply.OperationReplyTestWithReference import com.asyncapi.v3._0_0.model.server.ServerTest import com.asyncapi.v3._0_0.model.server.ServerVariableTest -import com.asyncapi.v3.schema.MultiFormatSchema -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema import com.asyncapi.v3.schema.Type +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema import com.asyncapi.v3.security_scheme.ApiKeySecuritySchemeTest import com.asyncapi.v3.security_scheme.OpenIdConnectSecuritySchemeTest import com.asyncapi.v3.security_scheme.http.HttpApiKeySecuritySchemeTest @@ -49,32 +50,31 @@ class ComponentsTest: SerDeTest() { */ return Components.builder() .schemas(mapOf( - Pair("Category", Schema.builder() + Pair("Category", AsyncAPISchema.builder() .type(Type.OBJECT) .properties(mapOf( - Pair("id", Schema.builder().type(Type.INTEGER).format("int64").build()), - Pair("name", Schema.builder().type(Type.STRING).build()) + Pair("id", AsyncAPISchema.builder().type(Type.INTEGER).format("int64").build()), + Pair("name", AsyncAPISchema.builder().type(Type.STRING).build()) )) .build() ), - Pair( - "Tag", - MultiFormatSchema.builder() - .schemaFormat("application/json") - .schema(mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "integer"), - Pair("format", "int64") - )), - Pair("name", mapOf( - Pair("type", "string") - )) - )) + Pair("Tag", JsonFormatSchema( + "application/schema+json;version=draft-07", + JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("integer") + .format("int64") + .build() + ), + Pair("name", JsonSchema.builder() + .type("string") + .build() + ) )) .build() - ), + )), Pair("User", Reference("#/components/schemas/user")) )) .servers(mapOf( diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBindingTest.kt index 8182aec6..1159d1a1 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/channel/ws/WebSocketsChannelBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.channel.ws import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type /** @@ -21,12 +21,12 @@ class WebSocketsChannelBindingTest: SerDeTest() { override fun build(): WebSocketsChannelBinding { return WebSocketsChannelBinding.builder() .method(WebSocketsChannelMethod.GET) - .query(Schema.builder() + .query(AsyncAPISchema.builder() .type(Type.OBJECT) .properties(mapOf( Pair( "ref", - Schema.builder() + AsyncAPISchema.builder() .type(Type.STRING) .description("Referral.") .build() @@ -34,12 +34,12 @@ class WebSocketsChannelBindingTest: SerDeTest() { )) .build() ) - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type(Type.OBJECT) .properties(mapOf( Pair( "Authentication", - Schema.builder() + AsyncAPISchema.builder() .type(Type.STRING) .description("Authentication token") .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBindingTest.kt index 610b2f74..be3c7be8 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/anypointmq/AnypointMQMessageBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.message.anypointmq import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type class AnypointMQMessageBindingTest: SerDeTest() { @@ -16,12 +16,12 @@ class AnypointMQMessageBindingTest: SerDeTest() { override fun build(): AnypointMQMessageBinding { return AnypointMQMessageBinding.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type(Type.OBJECT) .properties(mapOf( Pair( "correlationId", - Schema.builder() + AsyncAPISchema.builder() .type(Type.STRING) .description("Correlation ID set by application") .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/http/HTTPMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/http/HTTPMessageBindingTest.kt index 2b52abc2..7b7ef2c5 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/http/HTTPMessageBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/http/HTTPMessageBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.message.http import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type class HTTPMessageBindingTest: SerDeTest() { @@ -16,12 +16,12 @@ class HTTPMessageBindingTest: SerDeTest() { override fun build(): HTTPMessageBinding { return HTTPMessageBinding.builder() - .headers(Schema.builder() + .headers(AsyncAPISchema.builder() .type(Type.OBJECT) .properties(mapOf( Pair( "Content-Type", - Schema.builder() + AsyncAPISchema.builder() .type(Type.STRING) .enumValue(listOf("application/json")) .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/kafka/KafkaMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/kafka/KafkaMessageBindingTest.kt index 4331ecde..1cf3e5b4 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/kafka/KafkaMessageBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/message/kafka/KafkaMessageBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.message.kafka import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type class KafkaMessageBindingTest: SerDeTest() { @@ -16,7 +16,7 @@ class KafkaMessageBindingTest: SerDeTest() { override fun build(): KafkaMessageBinding { return KafkaMessageBinding.builder() - .key(Schema.builder() + .key(AsyncAPISchema.builder() .type(Type.STRING) .enumValue(listOf("myKey")) .build()) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/http/HTTPOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/http/HTTPOperationBindingTest.kt index 9a101826..14990d90 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/http/HTTPOperationBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/http/HTTPOperationBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.operation.http import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type import java.math.BigDecimal @@ -19,13 +19,13 @@ class HTTPOperationBindingTest: SerDeTest() { return HTTPOperationBinding.builder() .type(HTTPOperationType.REQUEST) .method(HTTPOperationMethod.GET) - .query(Schema.builder() + .query(AsyncAPISchema.builder() .type(Type.OBJECT) .required(listOf("companyId")) .properties(mapOf( Pair( "companyId", - Schema.builder() + AsyncAPISchema.builder() .type(Type.NUMBER) .minimum(BigDecimal.ONE) .description("The Id of the company.") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBindingTest.kt index e42eb7bf..ab88192f 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBindingTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/binding/operation/kafka/KafkaOperationBindingTest.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.binding.operation.kafka import com.asyncapi.v3.SerDeTest -import com.asyncapi.v3.schema.Schema +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.Type class KafkaOperationBindingTest: SerDeTest() { @@ -16,11 +16,11 @@ class KafkaOperationBindingTest: SerDeTest() { override fun build(): KafkaOperationBinding { return KafkaOperationBinding.builder() - .groupId(Schema.builder() + .groupId(AsyncAPISchema.builder() .type(Type.STRING) .enumValue(listOf("myGroupId")) .build()) - .clientId(Schema.builder() + .clientId(AsyncAPISchema.builder() .type(Type.STRING) .enumValue(listOf("myClientId")) .build()) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt new file mode 100644 index 00000000..33127806 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt @@ -0,0 +1,100 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.properties.* +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.* +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.math.BigDecimal +import java.util.stream.Stream + +class ReadJsonPropertiesTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + private val bigDecimalObjectMapper: ObjectMapper = ObjectMapper() + .configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + fun compareSchemas(schemaToCompareWith: String, + schemaClass: Class<*>, + schemaProvider: SchemaProvider + ) { + val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) + val jsonSchema = if (schemaProvider.jsonSchema().defaultValue is BigDecimal) { + bigDecimalObjectMapper.readValue(jsonSchemaString, schemaClass) + } else { + objectMapper.readValue(jsonSchemaString, schemaClass) + } + val schemaToCheck: Any? = when (schemaClass) { + JsonSchema::class.java -> schemaProvider.jsonSchema() + AsyncAPISchema::class.java -> schemaProvider.asyncAPISchema() + else -> null + } + + Assertions.assertEquals(jsonSchema, schemaToCheck) + } + + @Nested + inner class JsonSchemaImplementation { + + @ArgumentsSource(Properties::class) + @ParameterizedTest(name = "Read: {0}") + fun readAnyTypeProperty(constPropertyToRead: String, schemaProvider: SchemaProvider) { + compareSchemas(constPropertyToRead, JsonSchema::class.java, schemaProvider) + } + + } + + @Nested + inner class AsyncAPISchemaImplementation { + + @ArgumentsSource(Properties::class) + @ParameterizedTest(name = "Read: {0}") + fun readAnyTypeProperty(constPropertyToRead: String, schemaProvider: SchemaProvider) { + compareSchemas(constPropertyToRead, AsyncAPISchema::class.java, schemaProvider) + } + + } + + class Properties: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/json/properties/bigdecimal.json", ConstDefaultExamplesBigDecimalTest()), + Arguments.of("/json/v3/schema/json/properties/bigdecimal-maximum.json", ConstDefaultExamplesBigDecimalMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/bigdecimal-minimum.json", ConstDefaultExamplesBigDecimalMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/biginteger.json", ConstDefaultExamplesBigIntegerTest()), + Arguments.of("/json/v3/schema/json/properties/biginteger-maximum.json", ConstDefaultExamplesBigIntegerMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/biginteger-minimum.json", ConstDefaultExamplesBigIntegerMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/boolean-false.json", ConstDefaultExamplesBooleanFalseTest()), + Arguments.of("/json/v3/schema/json/properties/boolean-true.json", ConstDefaultExamplesBooleanTrueTest()), + + Arguments.of("/json/v3/schema/json/properties/double.json", ConstDefaultExamplesDoubleTest()), + Arguments.of("/json/v3/schema/json/properties/double-maximum.json", ConstDefaultExamplesDoubleMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/double-minimum.json", ConstDefaultExamplesDoubleMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/int.json", ConstDefaultExamplesIntTest()), + Arguments.of("/json/v3/schema/json/properties/int-maximum.json", ConstDefaultExamplesIntMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/int-minimum.json", ConstDefaultExamplesIntMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/null.json", ConstDefaultExamplesNullTest()), + + Arguments.of("/json/v3/schema/json/properties/object.json", ConstDefaultExamplesObjectTest()), + + Arguments.of("/json/v3/schema/json/properties/array.json", ConstDefaultExamplesArrayTest()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt new file mode 100644 index 00000000..5946e7b2 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt @@ -0,0 +1,73 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.* +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.* +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class ReadJsonSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + fun compareSchemas(schemaToCompareWith: String, + schemaClass: Class<*>, + schemaProvider: SchemaProvider + ) { + val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) + val jsonSchema = objectMapper.readValue(jsonSchemaString, schemaClass) + val schemaToCheck: Any? = when (schemaClass) { + JsonSchema::class.java -> schemaProvider.jsonSchema() + AsyncAPISchema::class.java -> schemaProvider.asyncAPISchema() + else -> null + } + + Assertions.assertEquals(jsonSchema, schemaToCheck) + } + + @Nested + inner class JsonSchemaImplementation { + + @ArgumentsSource(JsonSchemas::class) + @ParameterizedTest(name = "Read: {0}") + fun readJsonSchema(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, JsonSchema::class.java, schemaProvider) + } + + } + + @Nested + inner class AsyncAPISchemaImplementation { + + @ArgumentsSource(JsonSchemas::class) + @ParameterizedTest(name = "Read: {0}") + fun readJsonSchema(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPISchema::class.java, schemaProvider) + } + + } + + class JsonSchemas: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/json/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/json/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/json/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/json/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/json/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/json/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/json/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt new file mode 100644 index 00000000..1174ee68 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -0,0 +1,21 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema + +interface SchemaProvider { + + fun jsonSchema(): JsonSchema = JsonSchema() + + fun jsonFormatSchemaJson(): JsonFormatSchema = JsonFormatSchema(jsonSchema()) + + fun jsonFormatSchemaYaml(): JsonFormatSchema = JsonFormatSchema("application/schema+yaml;version=draft-07", jsonSchema()) + + fun asyncAPISchema(): AsyncAPISchema = AsyncAPISchema() + + fun asyncAPIFormatSchemaEmptySchemaFormat(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", asyncAPISchema()) + + fun openAPISchema(): OpenAPISchema = OpenAPISchema() + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt new file mode 100644 index 00000000..6e708296 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -0,0 +1,1068 @@ +package com.asyncapi.v3.schema.avro + +import com.asyncapi.v3.schema.avro.v1._9_0.* +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaLogicalType +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaType + +class AvroSchemasProvider { + + fun applicationEventTest(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("ApplicationEvent") + .namespace("model") + .doc("") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("applicationId") + .type(AvroSchemaType.STRING) + .doc("Application ID") + .build(), + AvroSchemaRecordField.builder() + .name("status") + .type(AvroSchemaType.STRING) + .doc("Application Status") + .build(), + AvroSchemaRecordField.builder() + .name("documents") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaArray("model.DocumentInfo") + ) + ) + .doc("") + .defaultValue(null) + .build() + )) + .build() + } + + fun documentInfo(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("DocumentInfo") + .namespace("model") + .doc("") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("documentId") + .type(AvroSchemaType.STRING) + .doc("Document ID") + .build(), + AvroSchemaRecordField.builder() + .name("filePath") + .type(AvroSchemaType.STRING) + .doc("Document Path") + .build() + )) + .build() + } + + fun fooBar(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("Bar") + .namespace("foo") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("title") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("created_at") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) + .build() + ) + ) + .build() + )) + .build() + } + + fun fullRecordV1(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("FullRecordV1") + .namespace("org.apache.avro.specific.test") + .doc("Test schema changes: this is the 'old' schema the SpecificRecord expects to see") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("b") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroSchemaRecordField.builder() + .name("i32") + .type(AvroSchemaType.INT) + .build(), + AvroSchemaRecordField.builder() + .name("i64") + .type(AvroSchemaType.LONG) + .build(), + AvroSchemaRecordField.builder() + .name("f32") + .type(AvroSchemaType.FLOAT) + .build(), + AvroSchemaRecordField.builder() + .name("f64") + .type(AvroSchemaType.DOUBLE) + .build(), + AvroSchemaRecordField.builder() + .name("s") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) + .build(), + AvroSchemaRecordField.builder() + .name("h") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) + .build() + )) + .build() + } + + fun fullRecordV2(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("FullRecordV2") + .namespace("org.apache.avro.specific.test") + .doc("Test schema changes: this is the 'new' schema actually used to write data") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("b") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroSchemaRecordField.builder() + .name("i64") + .type(AvroSchemaType.INT) + .build(), + AvroSchemaRecordField.builder() + .name("i32") + .type(AvroSchemaType.INT) + .build(), + AvroSchemaRecordField.builder() + .name("f64") + .type(AvroSchemaType.LONG) + .build(), + AvroSchemaRecordField.builder() + .name("f32") + .type( + AvroSchemaUnion( + AvroSchemaType.FLOAT, AvroSchemaType.NULL + ) + ) + .build(), + AvroSchemaRecordField.builder() + .name("newfield") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("h") + .type(AvroSchemaType.BYTES) + .build(), + AvroSchemaRecordField.builder() + .name("myMap") + .type(AvroSchemaMap(AvroSchemaType.STRING)) + .build() + )) + .build() + } + + fun logicalUUID(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("Action") + .namespace("schema.common") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("name") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("guid") + .type( + AvroSchema.builder() + .type(AvroSchemaType.STRING) + .logicalType(AvroSchemaLogicalType.UUID) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("time") + .type( + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("requestId") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) + .build() + )) + .build() + } + + fun logicalTypesWithMultipleFields(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("Action") + .namespace("schema.common") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("name") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("uuid") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("time") + .type( + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("requestId") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) + .build() + )) + .build() + } + + fun myResponse(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("MyResponse") + .namespace("model") + .doc("") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("isSuccessful") + .doc("Indicator for successful or unsuccessful call") + .type(AvroSchemaType.BOOLEAN) + .build() + )) + .build() + } + + fun regressionErrorFieldInRecord(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("RecordWithErrorField") + .namespace("org.apache.avro.specific.test") + .doc("With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("s") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("e") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaRecord.builder() + .type(AvroSchemaType.ERROR) + .name("TestError") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("message") + .type(AvroSchemaType.STRING) + .build() + ) + ) + .build() + ) + ) + .defaultValue(null) + .build() + )) + .build() + } + + fun schemaLocation(): AvroSchemaRecord { + val lat = AvroSchemaRecordField.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .build() + lat.metadata = mapOf(Pair("field-id", 1)) + + val long = AvroSchemaRecordField.builder() + .name("long") + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .build() + long.metadata = mapOf(Pair("field-id", 2)) + + return AvroSchemaRecord.builder() + .name("r7") + .fields(listOf(lat, long)) + .build() + } + + fun schemaLocationRead(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("table") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("location") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() + .name("r7") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroSchemaRecordField.builder() + .name("long_r2") + .type(AvroSchemaUnion(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + ) + ) + .build() + ) + ) + .metadata( + mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + ) + ) + .build() + ) + ) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 5))) + .build() + )) + .build() + } + + fun schemaLocationWrite(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("table") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("location") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() + .name("r7") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroSchemaRecordField.builder() + .name("long") + .type(AvroSchemaUnion(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + ) + ) + .build() + ) + ) + .metadata( + mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + ) + ) + .build() + ) + ) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 5))) + .build() + )) + .build() + } + + fun schemaBuilder(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("recordAll") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("requiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroSchemaRecordField.builder() + .name("requiredBooleanWithDefault") + .type(AvroSchemaType.BOOLEAN) + .defaultValue(true) + .build(), + AvroSchemaRecordField.builder() + .name("optionalBoolean") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.BOOLEAN + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalBooleanWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.BOOLEAN, + AvroSchemaType.NULL + ) + ) + .defaultValue(true) + .build(), + AvroSchemaRecordField.builder() + .name("requiredInt") + .type(AvroSchemaType.INT) + .build(), + AvroSchemaRecordField.builder() + .name("optionalInt") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.INT + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalIntWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.INT, + AvroSchemaType.NULL + ) + ) + .defaultValue(1) + .build(), + AvroSchemaRecordField.builder() + .name("requiredLong") + .type(AvroSchemaType.LONG) + .build(), + AvroSchemaRecordField.builder() + .name("optionalLong") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.LONG + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalLongWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.LONG, + AvroSchemaType.NULL + ) + ) + .defaultValue(1) + .build(), + AvroSchemaRecordField.builder() + .name("requiredFloat") + .type(AvroSchemaType.FLOAT) + .build(), + AvroSchemaRecordField.builder() + .name("optionalFloat") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.FLOAT + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalFloatWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.FLOAT, + AvroSchemaType.NULL + ) + ) + .defaultValue(1.0) + .build(), + AvroSchemaRecordField.builder() + .name("requiredDouble") + .type(AvroSchemaType.DOUBLE) + .build(), + AvroSchemaRecordField.builder() + .name("optionalDouble") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.DOUBLE + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalDoubleWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.DOUBLE, + AvroSchemaType.NULL + ) + ) + .defaultValue(1.0) + .build(), + AvroSchemaRecordField.builder() + .name("requiredBytes") + .type(AvroSchemaType.BYTES) + .build(), + AvroSchemaRecordField.builder() + .name("optionalBytes") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.BYTES + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalBytesWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.BYTES, + AvroSchemaType.NULL + ) + ) + .defaultValue("A") + .build(), + AvroSchemaRecordField.builder() + .name("requiredString") + .type(AvroSchemaType.STRING) + .build(), + AvroSchemaRecordField.builder() + .name("optionalString") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.STRING + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalStringWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaType.STRING, + AvroSchemaType.NULL + ) + ) + .defaultValue("a") + .build(), + AvroSchemaRecordField.builder() + .name("requiredRecord") + .type( + AvroSchemaRecord.builder() + .name("nestedRequiredRecord") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build()) + ) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("optionalRecord") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaRecord.builder() + .name("nestedOptionalRecord") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + ) + ) + .build() + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalRecordWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaRecord.builder() + .name("nestedOptionalRecordWithDefault") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + ) + ) + .build(), AvroSchemaType.NULL + ) + ) + .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) + .build(), + AvroSchemaRecordField.builder() + .name("requiredEnum") + .type( + AvroSchemaEnum.builder() + .name("requiredEnum") + .symbols(listOf("a", "b")) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("optionalEnum") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaEnum.builder() + .name("optionalEnum") + .symbols(listOf("a", "b")) + .build() + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalEnumWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaEnum.builder() + .name("optionalEnumWithDefault") + .symbols(listOf("a", "b")) + .build(), + AvroSchemaType.NULL, + ) + ) + .defaultValue("b") + .build(), + AvroSchemaRecordField.builder() + .name("requiredArray") + .type( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("optionalArray") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build() + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalArrayWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + ) + ) + .defaultValue(listOf("a")) + .build(), + AvroSchemaRecordField.builder() + .name("requiredMap") + .type( + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("optionalMap") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build() + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalMapWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + ) + ) + .defaultValue(mapOf(Pair("a", "b"))) + .build(), + AvroSchemaRecordField.builder() + .name("requiredFixed") + .type( + AvroSchemaFixed.builder() + .name("requiredFixed") + .size(1) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("optionalFixed") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaFixed.builder() + .name("optionalFixed") + .size(1) + .build() + ) + ) + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .name("optionalFixedWithDefault") + .type( + AvroSchemaUnion( + AvroSchemaFixed.builder() + .name("optionalFixedWithDefault") + .size(1) + .build(), AvroSchemaType.NULL + ) + ) + .defaultValue("A") + .build(), + AvroSchemaRecordField.builder() + .name("unionType") + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) + .build(), + AvroSchemaRecordField.builder() + .name("unionBooleanWithDefault") + .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.INT)) + .defaultValue(true) + .build(), + AvroSchemaRecordField.builder() + .name("unionIntWithDefault") + .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) + .defaultValue(1) + .build(), + AvroSchemaRecordField.builder() + .name("unionLongWithDefault") + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.INT)) + .defaultValue(1) + .build(), + AvroSchemaRecordField.builder() + .name("unionFloatWithDefault") + .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.INT)) + .defaultValue(1.0) + .build(), + AvroSchemaRecordField.builder() + .name("unionDoubleWithDefault") + .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.INT)) + .defaultValue(1.0) + .build(), + AvroSchemaRecordField.builder() + .name("unionBytesWithDefault") + .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.INT)) + .defaultValue("A") + .build(), + AvroSchemaRecordField.builder() + .name("unionStringWithDefault") + .type(listOf(AvroSchemaType.STRING, AvroSchemaType.INT)) + .defaultValue("a") + .build(), + AvroSchemaRecordField.builder() + .name("unionRecordWithDefault") + .type(listOf( + AvroSchemaRecord.builder() + .name("nestedUnionRecordWithDefault") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + )) + .build(), AvroSchemaType.INT + )) + .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) + .build(), + AvroSchemaRecordField.builder() + .name("unionEnumWithDefault") + .type(listOf( + AvroSchemaEnum.builder() + .name("nestedUnionEnumWithDefault") + .symbols(listOf("a", "b")) + .build(), AvroSchemaType.INT + )) + .defaultValue("b") + .build(), + AvroSchemaRecordField.builder() + .name("unionArrayWithDefault") + .type(listOf( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT + )) + .defaultValue(listOf("a")) + .build(), + AvroSchemaRecordField.builder() + .name("unionMapWithDefault") + .type(listOf( + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT + )) + .defaultValue(mapOf(Pair("a", "b"))) + .build(), + AvroSchemaRecordField.builder() + .name("unionFixedWithDefault") + .type(listOf( + AvroSchemaFixed.builder() + .name("nestedUnionFixedWithDefault") + .size(1) + .build(), AvroSchemaType.INT + )) + .defaultValue("A") + .build(), + )) + .build() + } + + fun simpleRecord(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("SimpleRecord") + .fields(listOf( + AvroSchemaRecordField.builder() + .type(AvroSchemaType.INT) + .name("value") + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.INT + ) + ) + .name("nullableValue") + .doc("doc") + .build() + )) + .build() + } + + fun testRecordWithLogicalTypes(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("TestRecordWithLogicalTypes") + .doc("Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroSchemaRecordField.builder() + .type(AvroSchemaType.BOOLEAN) + .name("b") + .build(), + AvroSchemaRecordField.builder() + .type(AvroSchemaType.INT) + .name("i32") + .build(), + AvroSchemaRecordField.builder() + .type(AvroSchemaType.LONG) + .name("i64") + .build(), + AvroSchemaRecordField.builder() + .type(AvroSchemaType.FLOAT) + .name("f32") + .build(), + AvroSchemaRecordField.builder() + .type(AvroSchemaType.DOUBLE) + .name("f64") + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.STRING + ) + ) + .name("s") + .defaultValue(null) + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.INT) + .logicalType(AvroSchemaLogicalType.DATE) + .build() + ) + .name("d") + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.INT) + .logicalType(AvroSchemaLogicalType.TIME_MILLIS) + .build() + ) + .name("t") + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) + .build() + ) + .name("ts") + .build(), + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.BYTES) + .logicalType(AvroSchemaLogicalType.BIG_DECIMAL) + .build() + ) + .name("bd") + .build(), + )) + .build() + } + + fun testRecordWithMapsAndArrays(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("TestRecordWithMapsAndArrays") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("arr") + .type( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .defaultValue(emptyList()) + .build() + ) + .build(), + AvroSchemaRecordField.builder() + .name("map") + .type( + AvroSchemaMap.builder() + .values(AvroSchemaType.LONG) + .defaultValue(emptyMap()) + .build() + ) + .build() + )) + .build() + } + + fun testUnionRecord(): AvroSchemaUnion { + return AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() + .name("TestUnionRecord") + .namespace("org.apache.avro.specific") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("amount") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchema.builder() + .type(AvroSchemaType.BYTES) + .logicalType(AvroSchemaLogicalType.DECIMAL) + .precision(31) + .scale(8) + .build() + ) + ) + .defaultValue(null) + .build() + ) + ) + .build() + ) + } + + fun unionAndFixedFields(): AvroSchemaRecord { + return AvroSchemaRecord.builder() + .name("UnionAndFixedFields") + .doc("Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroSchemaRecordField.builder() + .name("u") + .type( + AvroSchemaUnion( + AvroSchemaType.BOOLEAN, + AvroSchemaType.INT, + AvroSchemaType.LONG, + AvroSchemaType.FLOAT, + AvroSchemaType.STRING + ) + ) + .build(), + AvroSchemaRecordField.builder() + .name("l") + .type( + AvroSchemaUnion( + AvroSchemaType.STRING, AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) + .build() + ) + ) + .build(), + AvroSchemaRecordField.builder() + .name("f") + .type( + AvroSchemaFixed.builder() + .name("md5") + .size(16) + .build() + ) + .build() + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt new file mode 100644 index 00000000..ec2b0d6a --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt @@ -0,0 +1,67 @@ +package com.asyncapi.v3.schema.avro + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class AvroSchemaSchemaTest { + + fun compareSchemas( + schemaToCheckPath: String, + clazz: Class<*>, + schemaToCheck: Any + ) { + val schemaAsJson = ClasspathUtils.readAsString(schemaToCheckPath) + val schema = objectMapper.readValue(schemaAsJson, clazz) + + Assertions.assertEquals(schema, schemaToCheck) + } + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + @ArgumentsSource(AvroSchemas::class) + @ParameterizedTest(name = "Read: {0}") + fun read(schemaToCheckPath: String, clazz: Class<*>, avroSchema: Any) { + compareSchemas(schemaToCheckPath, clazz, avroSchema) + } + + class AvroSchemas: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchema::class.java, AvroSchemasProvider().applicationEventTest()), + Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", AvroSchema::class.java, AvroSchemasProvider().documentInfo()), + Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", AvroSchema::class.java, AvroSchemasProvider().fooBar()), + Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", AvroSchema::class.java, AvroSchemasProvider().fullRecordV1()), + Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", AvroSchema::class.java, AvroSchemasProvider().fullRecordV2()), + Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", AvroSchema::class.java, AvroSchemasProvider().logicalUUID()), + Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", AvroSchema::class.java, AvroSchemasProvider().logicalTypesWithMultipleFields()), + Arguments.of("/json/v3/schema/avro/MyResponse.avsc", AvroSchema::class.java, AvroSchemasProvider().myResponse()), + Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", AvroSchema::class.java, AvroSchemasProvider().regressionErrorFieldInRecord()), + Arguments.of("/json/v3/schema/avro/schema-location.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocation()), + Arguments.of("/json/v3/schema/avro/schema-location-read.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocationRead()), + Arguments.of("/json/v3/schema/avro/schema-location-write.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocationWrite()), + Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", AvroSchema::class.java, AvroSchemasProvider().schemaBuilder()), + Arguments.of("/json/v3/schema/avro/simple_record.avsc", AvroSchema::class.java, AvroSchemasProvider().simpleRecord()), + Arguments.of("/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc", AvroSchema::class.java, AvroSchemasProvider().testRecordWithLogicalTypes()), + Arguments.of("/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc", AvroSchema::class.java, AvroSchemasProvider().testRecordWithMapsAndArrays()), + Arguments.of("/json/v3/schema/avro/TestUnionRecord.avsc", AvroSchemaUnion::class.java, AvroSchemasProvider().testUnionRecord()), + Arguments.of("/json/v3/schema/avro/union_and_fixed_fields.avsc", AvroSchema::class.java, AvroSchemasProvider().unionAndFixedFields()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt new file mode 100644 index 00000000..f2becc41 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt @@ -0,0 +1,89 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ArraysSchemaTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/arrays.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .description("A representation of a person, company, organization, or place") + .type("object") + .properties(mapOf( + Pair("fruits", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), + Pair("vegetables", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().ref("#/definitions/veggie").build()) + .build() + ) + )) + .definitions(mapOf( + Pair("veggie", JsonSchema.builder() + .type("object") + .required(listOf("veggieName", "veggieLike")) + .properties(mapOf( + Pair("veggieName", JsonSchema.builder() + .type("string") + .description("The name of the vegetable.") + .build() + ), + Pair("veggieLike", JsonSchema.builder() + .type("boolean") + .description("Do I like this vegetable?") + .build() + ) + )) + .build() + ) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/arrays.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .description("A representation of a person, company, organization, or place") + .type("object") + .properties(mapOf( + Pair("fruits", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .build() + ), + Pair("vegetables", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().ref("#/definitions/veggie").build()) + .build() + ) + )) + .definitions(mapOf( + Pair("veggie", AsyncAPISchema.builder() + .type("object") + .required(listOf("veggieName", "veggieLike")) + .properties(mapOf( + Pair("veggieName", AsyncAPISchema.builder() + .type("string") + .description("The name of the vegetable.") + .build() + ), + Pair("veggieLike", AsyncAPISchema.builder() + .type("boolean") + .description("Do I like this vegetable?") + .build() + ) + )) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt new file mode 100644 index 00000000..cfe8b7ac --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt @@ -0,0 +1,110 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ComplexObjectTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/complex-object.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Complex Object") + .type("object") + .properties(mapOf( + Pair("name", JsonSchema.builder() + .type("string") + .build() + ), + Pair("age", JsonSchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("address", JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("street", JsonSchema.builder() + .type("string") + .build() + ), + Pair("city", JsonSchema.builder() + .type("string") + .build() + ), + Pair("state", JsonSchema.builder() + .type("string") + .build() + ), + Pair("postalCode", JsonSchema.builder() + .type("string") + .pattern("\\d{5}") + .build() + ) + )) + .required(listOf("street", "city", "state", "postalCode")) + .build() + ), + Pair("hobbies", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), + )) + .required(listOf("name", "age")) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/complex-object.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Complex Object") + .type("object") + .properties(mapOf( + Pair("name", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("age", AsyncAPISchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("address", AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("street", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("city", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("state", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("postalCode", AsyncAPISchema.builder() + .type("string") + .pattern("\\d{5}") + .build() + ) + )) + .required(listOf("street", "city", "state", "postalCode")) + .build() + ), + Pair("hobbies", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .build() + ), + )) + .required(listOf("name", "age")) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt new file mode 100644 index 00000000..c4e423bf --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt @@ -0,0 +1,109 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConditionalValidationIfElse: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/conditional-validation-if-else.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Conditional Validation with If-Else") + .type("object") + .properties(mapOf( + Pair("isMember", JsonSchema.builder() + .type("boolean") + .build() + ), + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .build() + ) + )) + .required(listOf("isMember")) + .ifValue(JsonSchema.builder() + .properties(mapOf( + Pair("isMember", JsonSchema.builder() + .constValue(true) + .build() + ), + )) + .build() + ) + .thenValue(JsonSchema.builder() + .properties(mapOf( + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .minLength(10) + .maxLength(10) + .build() + ), + )) + .build() + ) + .elseValue(JsonSchema.builder() + .properties(mapOf( + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .minLength(15) + .build() + ), + )) + .build() + ) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/conditional-validation-if-else.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Conditional Validation with If-Else") + .type("object") + .properties(mapOf( + Pair("isMember", AsyncAPISchema.builder() + .type("boolean") + .build() + ), + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .build() + ) + )) + .required(listOf("isMember")) + .ifValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("isMember", AsyncAPISchema.builder() + .constValue(true) + .build() + ), + )) + .build() + ) + .thenValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .minLength(10) + .maxLength(10) + .build() + ), + )) + .build() + ) + .elseValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .minLength(15) + .build() + ), + )) + .build() + ) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt new file mode 100644 index 00000000..9906c4d3 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt @@ -0,0 +1,532 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class Draft07CoreSchemaMetaSchemaTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .schema("http://json-schema.org/draft-07/schema#") + .id("http://json-schema.org/draft-07/schema#") + .title("Core schema meta-schema") + .definitions(mapOf( + Pair("schemaArray", JsonSchema.builder() + .type("array") + .minItems(1) + .items(JsonSchema.builder().ref("#").build()) + .build() + ), + Pair("nonNegativeInteger", JsonSchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("nonNegativeIntegerDefault0", JsonSchema.builder() + .allOf(listOf( + JsonSchema.builder().ref("#/definitions/nonNegativeInteger").build(), + JsonSchema.builder().defaultValue(0).build() + )) + .build() + ), + Pair("simpleTypes", JsonSchema.builder() + .enumValue(listOf( + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + )) + .build() + ), + Pair("stringArray", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .uniqueItems(true) + .defaultValue(emptyList()) + .build() + ) + )) + .type(listOf("object", "boolean")) + .properties(mapOf( + Pair("\$id", JsonSchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$schema", JsonSchema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("\$ref", JsonSchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$comment", JsonSchema.builder() + .type("string") + .build() + ), + Pair("title", JsonSchema.builder() + .type("string") + .build() + ), + Pair("description", JsonSchema.builder() + .type("string") + .build() + ), + Pair("default", true), + Pair("readOnly", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("writeOnly", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("examples", JsonSchema.builder() + .type("array") + .items(true) + .build() + ), + Pair("multipleOf", JsonSchema.builder() + .type("number") + .exclusiveMinimum(BigDecimal.ZERO) + .build() + ), + Pair("maximum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMaximum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("minimum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMinimum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("maxLength", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minLength", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("pattern", JsonSchema.builder() + .type("string") + .format("regex") + .build() + ), + Pair("additionalItems", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("items", JsonSchema.builder() + .anyOf(listOf( + JsonSchema.builder().ref("#").build(), + JsonSchema.builder().ref("#/definitions/schemaArray").build(), + )) + .defaultValue(true) + .build() + ), + Pair("maxItems", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minItems", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("uniqueItems", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("contains", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("maxProperties", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minProperties", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("required", JsonSchema.builder() + .ref("#/definitions/stringArray") + .build() + ), + Pair("additionalProperties", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("definitions", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("properties", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("patternProperties", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .propertyNames(JsonSchema.builder().format("regex").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("dependencies", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().anyOf(listOf( + JsonSchema.builder().ref("#").build(), + JsonSchema.builder().ref("#/definitions/stringArray").build(), + )).build()) + .build() + ), + Pair("propertyNames", JsonSchema.builder().ref("#").build()), + Pair("const", true), + Pair("enum", JsonSchema.builder() + .type("array") + .items(true) + .minItems(1) + .uniqueItems(true) + .build() + ), + Pair("type", JsonSchema.builder() + .anyOf(listOf( + JsonSchema.builder().ref("#/definitions/simpleTypes").build(), + JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().ref("#/definitions/simpleTypes").build()) + .minItems(1) + .uniqueItems(true) + .build() + )) + .build() + ), + Pair("format", JsonSchema.builder() + .type("string") + .build() + ), + Pair("contentMediaType", JsonSchema.builder() + .type("string") + .build() + ), + Pair("contentEncoding", JsonSchema.builder() + .type("string") + .build() + ), + Pair("if", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("then", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("else", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("allOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("anyOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("oneOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("not", JsonSchema.builder() + .ref("#") + .build() + ), + )) + .defaultValue(true) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .schema("http://json-schema.org/draft-07/schema#") + .id("http://json-schema.org/draft-07/schema#") + .title("Core schema meta-schema") + .definitions(mapOf( + Pair("schemaArray", AsyncAPISchema.builder() + .type("array") + .minItems(1) + .items(AsyncAPISchema.builder().ref("#").build()) + .build() + ), + Pair("nonNegativeInteger", AsyncAPISchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("nonNegativeIntegerDefault0", AsyncAPISchema.builder() + .allOf(listOf( + AsyncAPISchema.builder().ref("#/definitions/nonNegativeInteger").build(), + AsyncAPISchema.builder().defaultValue(0).build() + )) + .build() + ), + Pair("simpleTypes", AsyncAPISchema.builder() + .enumValue(listOf( + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + )) + .build() + ), + Pair("stringArray", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .uniqueItems(true) + .defaultValue(emptyList()) + .build() + ) + )) + .type(listOf("object", "boolean")) + .properties(mapOf( + Pair("\$id", AsyncAPISchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$schema", AsyncAPISchema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("\$ref", AsyncAPISchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$comment", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("title", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("description", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("default", true), + Pair("readOnly", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("writeOnly", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("examples", AsyncAPISchema.builder() + .type("array") + .items(true) + .build() + ), + Pair("multipleOf", AsyncAPISchema.builder() + .type("number") + .exclusiveMinimum(BigDecimal.ZERO) + .build() + ), + Pair("maximum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMaximum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("minimum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMinimum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("maxLength", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minLength", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("pattern", AsyncAPISchema.builder() + .type("string") + .format("regex") + .build() + ), + Pair("additionalItems", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("items", AsyncAPISchema.builder() + .anyOf(listOf( + AsyncAPISchema.builder().ref("#").build(), + AsyncAPISchema.builder().ref("#/definitions/schemaArray").build(), + )) + .defaultValue(true) + .build() + ), + Pair("maxItems", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minItems", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("uniqueItems", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("contains", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("maxProperties", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minProperties", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("required", AsyncAPISchema.builder() + .ref("#/definitions/stringArray") + .build() + ), + Pair("additionalProperties", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("definitions", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("properties", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("patternProperties", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .propertyNames(AsyncAPISchema.builder().format("regex").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("dependencies", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().anyOf(listOf( + AsyncAPISchema.builder().ref("#").build(), + AsyncAPISchema.builder().ref("#/definitions/stringArray").build(), + )).build()) + .build() + ), + Pair("propertyNames", AsyncAPISchema.builder().ref("#").build()), + Pair("const", true), + Pair("enum", AsyncAPISchema.builder() + .type("array") + .items(true) + .minItems(1) + .uniqueItems(true) + .build() + ), + Pair("type", AsyncAPISchema.builder() + .anyOf(listOf( + AsyncAPISchema.builder().ref("#/definitions/simpleTypes").build(), + AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().ref("#/definitions/simpleTypes").build()) + .minItems(1) + .uniqueItems(true) + .build() + )) + .build() + ), + Pair("format", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("contentMediaType", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("contentEncoding", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("if", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("then", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("else", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("allOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("anyOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("oneOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("not", AsyncAPISchema.builder() + .ref("#") + .build() + ), + )) + .defaultValue(true) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt new file mode 100644 index 00000000..f9af8303 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt @@ -0,0 +1,43 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class EnumeratedValuesTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/enumerated-values.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Enumerated Values") + .type("object") + .properties(mapOf( + Pair("data", JsonSchema.builder() + .enumValue(listOf( + 42, true, "hello", null, listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/enumerated-values.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Enumerated Values") + .type("object") + .properties(mapOf( + Pair("data", AsyncAPISchema.builder() + .enumValue(listOf( + 42, true, "hello", null, listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt new file mode 100644 index 00000000..63f25de1 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt @@ -0,0 +1,64 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class PersonTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/person.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Person") + .type("object") + .properties(mapOf( + Pair("firstName", JsonSchema.builder() + .type("string") + .description("The person's first name.") + .build() + ), + Pair("lastName", JsonSchema.builder() + .type("string") + .description("The person's last name.") + .build() + ), + Pair("age", JsonSchema.builder() + .type("integer") + .description("Age in years which must be equal to or greater than zero.") + .minimum(BigDecimal.ZERO) + .build() + ) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/person.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Person") + .type("object") + .properties(mapOf( + Pair("firstName", AsyncAPISchema.builder() + .type("string") + .description("The person's first name.") + .build() + ), + Pair("lastName", AsyncAPISchema.builder() + .type("string") + .description("The person's last name.") + .build() + ), + Pair("age", AsyncAPISchema.builder() + .type("integer") + .description("Age in years which must be equal to or greater than zero.") + .minimum(BigDecimal.ZERO) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt new file mode 100644 index 00000000..4334d690 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt @@ -0,0 +1,41 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class RegexPatternTest: SchemaProvider { + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/regex-pattern.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Regular Expression Pattern") + .type("object") + .properties(mapOf( + Pair("code", JsonSchema.builder() + .type("string") + .pattern("^[A-Z]{3}-\\d{3}$") + .build() + ) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/regex-pattern.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Regular Expression Pattern") + .type("object") + .properties(mapOf( + Pair("code", AsyncAPISchema.builder() + .type("string") + .pattern("^[A-Z]{3}-\\d{3}$") + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt new file mode 100644 index 00000000..064164bc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt @@ -0,0 +1,91 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesArrayTest: SchemaProvider { + + private val jsonValue = JsonSchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + JsonSchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3, + JsonSchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + JsonSchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + + private val asyncapiValue = AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + AsyncAPISchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3, + AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + AsyncAPISchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(listOf(jsonValue)) + .defaultValue(listOf(jsonValue)) + .examples(listOf( + jsonValue, + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(listOf(asyncapiValue)) + .defaultValue(listOf(asyncapiValue)) + .examples(listOf( + asyncapiValue, + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt new file mode 100644 index 00000000..cb6af518 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalMaximumTest: SchemaProvider { + + private val value = BigDecimal("2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt new file mode 100644 index 00000000..5a7c7446 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalMinimumTest: SchemaProvider { + + private val value = BigDecimal("-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt new file mode 100644 index 00000000..e3ce747c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalTest: SchemaProvider { + + private val value = BigDecimal("1.123456789021474836471234567890214748364712345678902147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt new file mode 100644 index 00000000..deeebe36 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerMaximumTest: SchemaProvider { + + private val value = BigInteger("214748364721474836472147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt new file mode 100644 index 00000000..dcffc9bd --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerMinimumTest: SchemaProvider { + + private val value = BigInteger("-214748364821474836482147483648") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt new file mode 100644 index 00000000..2ca5695b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerTest: SchemaProvider { + + private val value = BigInteger("12345678902147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt new file mode 100644 index 00000000..099ee50d --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesBooleanFalseTest: SchemaProvider { + + private val value = false + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt new file mode 100644 index 00000000..bdd98dc2 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesBooleanTrueTest: SchemaProvider { + + private val value = true + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt new file mode 100644 index 00000000..7968adbd --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleMaximumTest: SchemaProvider { + + private val value: Double = 1.7976931348623157E308 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt new file mode 100644 index 00000000..e4d0420e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleMinimumTest: SchemaProvider { + + private val value: Double = -4.9E-324 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt new file mode 100644 index 00000000..1c887d63 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleTest: SchemaProvider { + + private val value: Double = 123.456 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt new file mode 100644 index 00000000..02d07659 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntMaximumTest: SchemaProvider { + + private val value: Int = 2147483647 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt new file mode 100644 index 00000000..e3cfeea5 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntMinimumTest: SchemaProvider { + + private val value: Int = -2147483648 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt new file mode 100644 index 00000000..d6e677e9 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntTest: SchemaProvider { + + private val value: Int = 0 + + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt new file mode 100644 index 00000000..ff007981 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesNullTest: SchemaProvider { + + private val value = null + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt new file mode 100644 index 00000000..56e24799 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt @@ -0,0 +1,35 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesObjectTest: SchemaProvider { + + private val jsonValue = JsonSchema.builder() + .type("string") + .constValue("abc") + .build() + + private val asyncapiValue = AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .build() + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(jsonValue) + .defaultValue(jsonValue) + .examples(listOf(jsonValue)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(asyncapiValue) + .defaultValue(asyncapiValue) + .examples(listOf(asyncapiValue)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt new file mode 100644 index 00000000..5f4132bd --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -0,0 +1,131 @@ +package com.asyncapi.v3.schema.multiformat + +import com.asyncapi.v3.schema.multiformat.asyncapi.* +import com.asyncapi.v3.schema.multiformat.avro.* +import com.asyncapi.v3.schema.multiformat.json.JsonFormatSchemaTest +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_1Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_2Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_3Test +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested + +class MultiFormatSchemaTest { + + @Nested + inner class AsyncAPISchema { + + @Nested + @DisplayName("2.0.0") + inner class V2_0_0: AsyncAPIFormatSchemaV2_0_0Test() + + @Nested + @DisplayName("2.1.0") + inner class V2_1_0: AsyncAPIFormatSchemaV2_1_0Test() + + @Nested + @DisplayName("2.2.0") + inner class V2_2_0: AsyncAPIFormatSchemaV2_2_0Test() + + @Nested + @DisplayName("2.3.0") + inner class V2_3_0: AsyncAPIFormatSchemaV2_3_0Test() + + @Nested + @DisplayName("2.4.0") + inner class V2_4_0: AsyncAPIFormatSchemaV2_4_0Test() + + @Nested + @DisplayName("2.5.0") + inner class V2_5_0: AsyncAPIFormatSchemaV2_5_0Test() + + @Nested + @DisplayName("2.6.0") + inner class V2_6_0: AsyncAPIFormatSchemaV2_6_0Test() + + @Nested + @DisplayName("3.0.0") + inner class V3_0_0: AsyncAPIFormatSchemaV3_0_0Test() + + @Nested + @DisplayName("MultiFormatSchema with empty schemaFormat is AsyncAPI Schema") + inner class EmptySchemaFormat: EmptySchemaFormatTest() + + @Nested + @DisplayName("MultiFormatSchema with null schemaFormat is AsyncAPI Schema") + inner class NullSchemaFormat: NullSchemaFormatTest() + + @Nested + @DisplayName("MultiFormatSchema without schemaFormat is AsyncAPI Schema") + inner class WithoutSchemaFormat: WithoutSchemaFormatTest() + + } + + @Nested + inner class AvroSchema { + + @Nested + @DisplayName("1.9.0") + inner class V1_9_0: AvroFormatSchemaV1_9_0Test() + + @Nested + @DisplayName("1.9.1") + inner class V1_9_1: AvroFormatSchemaV1_9_1Test() + + @Nested + @DisplayName("1.9.2") + inner class V1_9_2: AvroFormatSchemaV1_9_2Test() + + @Nested + @DisplayName("1.10.0") + inner class V1_10_0: AvroFormatSchemaV1_10_0Test() + + @Nested + @DisplayName("1.10.1") + inner class V1_10_1: AvroFormatSchemaV1_10_1Test() + + @Nested + @DisplayName("1.10.2") + inner class V1_10_2: AvroFormatSchemaV1_10_2Test() + + @Nested + @DisplayName("1.11.0") + inner class V1_11_0: AvroFormatSchemaV1_11_0Test() + + @Nested + @DisplayName("1.11.1") + inner class V1_11_1: AvroFormatSchemaV1_11_1Test() + + } + + @Nested + inner class JsonSchema { + + @Nested + @DisplayName("Draft-07") + inner class Draft07: JsonFormatSchemaTest() + + } + + @Nested + inner class OpenAPISchema { + + @Nested + @DisplayName("3.0.0") + inner class V3_0_0: OpenAPIFormatSchemaV3_0_0Test() + + @Nested + @DisplayName("3.0.1") + inner class V3_0_1: OpenAPIFormatSchemaV3_0_1Test() + + @Nested + @DisplayName("3.0.2") + inner class V3_0_2: OpenAPIFormatSchemaV3_0_2Test() + + @Nested + @DisplayName("3.0.3") + inner class V3_0_3: OpenAPIFormatSchemaV3_0_3Test() + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt new file mode 100644 index 00000000..e076b795 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class AsyncAPIFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + openAPIFormatSchemaToCompareWithFilePath: String, + schemaToCheck: AsyncAPIFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(openAPIFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, AsyncAPIFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) + + abstract fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt new file mode 100644 index 00000000..6c70dda0 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_0_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt new file mode 100644 index 00000000..fde6fb5c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_1_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt new file mode 100644 index 00000000..205bdd81 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_2_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt new file mode 100644 index 00000000..da5fe7ad --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_3_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt new file mode 100644 index 00000000..c7063fbc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_4_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt new file mode 100644 index 00000000..61424c32 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_5_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt new file mode 100644 index 00000000..97d059e6 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_6_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt new file mode 100644 index 00000000..1f432975 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV3_0_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt new file mode 100644 index 00000000..009363db --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt @@ -0,0 +1,104 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class EmptySchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt new file mode 100644 index 00000000..043ae506 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt @@ -0,0 +1,106 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class NullSchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt new file mode 100644 index 00000000..86333980 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt @@ -0,0 +1,106 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class WithoutSchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt new file mode 100644 index 00000000..af4a4912 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class AvroFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + avroFormatSchemaToCompareWithFilePath: String, + schemaToCheck: AvroFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(avroFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, AvroFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) + + abstract fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt new file mode 100644 index 00000000..8b28c946 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt new file mode 100644 index 00000000..b9291bab --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt new file mode 100644 index 00000000..d6ddda20 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_2Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt new file mode 100644 index 00000000..13ee0c27 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_11_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt new file mode 100644 index 00000000..d972a95f --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_11_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_0Test.kt new file mode 100644 index 00000000..9bd6c750 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_0Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt new file mode 100644 index 00000000..5cbe22bc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt new file mode 100644 index 00000000..9d8e448b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_2Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt new file mode 100644 index 00000000..b8d5f9ff --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt @@ -0,0 +1,126 @@ +package com.asyncapi.v3.schema.multiformat.json + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class JsonFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + jsonFormatSchemaToCompareWithFilePath: String, + schemaToCheck: JsonFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(jsonFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, JsonFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + fun parseJson( + jsonFormatSchemaToCompareWithFilePath: String, + jsonFormatSchema: JsonFormatSchema + ) { + compareSchemas(jsonFormatSchemaToCompareWithFilePath, jsonFormatSchema) + + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + fun parseYaml( + jsonFormatSchemaToCompareWithFilePath: String, + jsonFormatSchema: JsonFormatSchema + ) { + compareSchemas(jsonFormatSchemaToCompareWithFilePath, jsonFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/arrays.schema.json", + JsonFormatSchema(ArraysSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json", + JsonFormatSchema(ComplexObjectTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json", + JsonFormatSchema(ConditionalValidationIfElse().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json", + JsonFormatSchema(Draft07CoreSchemaMetaSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json", + JsonFormatSchema(EnumeratedValuesTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/person.schema.json", + JsonFormatSchema(PersonTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json", + JsonFormatSchema(RegexPatternTest().jsonSchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ArraysSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ComplexObjectTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ConditionalValidationIfElse().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", Draft07CoreSchemaMetaSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", EnumeratedValuesTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", PersonTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", RegexPatternTest().jsonSchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt new file mode 100644 index 00000000..8acfbc49 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class OpenAPIFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + openAPIFormatSchemaToCompareWithFilePath: String, + schemaToCheck: OpenAPIFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(openAPIFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, OpenAPIFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) + + abstract fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt new file mode 100644 index 00000000..1643aae4 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_0Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.0", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.0", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.0", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.0", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt new file mode 100644 index 00000000..f4de776d --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_1Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.1", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.1", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.1", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.1", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt new file mode 100644 index 00000000..8bab13d0 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_2Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.2", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.2", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.2", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.2", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt new file mode 100644 index 00000000..b432763d --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_3Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.3", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.3", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.3", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.3", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt new file mode 100644 index 00000000..b3e92b4f --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt @@ -0,0 +1,145 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0 + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.* +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class OpenAPISchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + @Nested + inner class XMLTest { + + @ArgumentsSource(XMLs::class) + @ParameterizedTest(name = "Read: {0}") + fun read(xmlToRead: String, xmlToCheck: XML) { + val xmlString = ClasspathUtils.readAsString(xmlToRead) + val xml = objectMapper.readValue(xmlString, XML::class.java) + + Assertions.assertEquals(xml, xmlToCheck) + } + + } + + @Nested + inner class DiscriminatorTest { + + @ArgumentsSource(Discriminators::class) + @ParameterizedTest(name = "Read: {0}") + fun read(discriminatorToRead: String, discriminatorToCheck: Discriminator) { + val discriminatorString = ClasspathUtils.readAsString(discriminatorToRead) + val discriminator = objectMapper.readValue(discriminatorString, Discriminator::class.java) + + Assertions.assertEquals(discriminator, discriminatorToCheck) + } + + } + + @Nested + inner class ExternalDocumentationTest { + + @ArgumentsSource(ExternalDocumentations::class) + @ParameterizedTest(name = "Read: {0}") + fun read(discriminatorToRead: String, externalDocumentationToCheck: ExternalDocumentation) { + val externalDocumentationString = ClasspathUtils.readAsString(discriminatorToRead) + val externalDocumentation = objectMapper.readValue(externalDocumentationString, ExternalDocumentation::class.java) + + Assertions.assertEquals(externalDocumentation, externalDocumentationToCheck) + } + + } + + @Nested + inner class SchemaTest { + + @ArgumentsSource(Schemas::class) + @ParameterizedTest(name = "Read: {0}") + fun read(schemaToRead: String, schemaToCheck: SchemaProvider) { + val externalDocumentationString = ClasspathUtils.readAsString(schemaToRead) + val externalDocumentation = objectMapper.readValue(externalDocumentationString, OpenAPISchema::class.java) + + Assertions.assertEquals(externalDocumentation, schemaToCheck.openAPISchema()) + } + + } + + class XMLs: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + val extendedXML = XML( + "animal", "http://example.com/schema/sample", "sample", true, true + ) + extendedXML.extensions = mapOf(Pair("x-extension-property", "value")) + + return Stream.of( + Arguments.of("/json/v3/schema/openapi/xml.json", extendedXML), + Arguments.of("/json/v3/schema/openapi/xml-attribute.json", XML.builder().attribute(true).build()), + Arguments.of("/json/v3/schema/openapi/xml-name-replacement.json", XML.builder().name("animal").build()), + Arguments.of("/json/v3/schema/openapi/xml-prefix-and-namespace.json", XML.builder() + .namespace("http://example.com/schema/sample") + .prefix("sample").build() + ), + Arguments.of("/json/v3/schema/openapi/xml-wrapped.json", XML.builder().wrapped(true).build()), + ) + } + + } + + class Discriminators: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/discriminator.json", Discriminator.builder() + .propertyName("pet_type") + .mapping(mapOf( + Pair("dog", "#/components/schemas/Dog"), + Pair("monster", "https://gigantic-server.com/schemas/Monster/schema.json"), + )).build() + ), + Arguments.of("/json/v3/schema/openapi/discriminator-propertyname.json", Discriminator.builder().propertyName("pet_type").build()), + ) + } + + } + + class ExternalDocumentations: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + val extendedExternalDocumentation = ExternalDocumentation("Find more info here", "https://example.com") + extendedExternalDocumentation.extensions = mapOf(Pair("x-extension-property", "value")) + + return Stream.of( + Arguments.of("/json/v3/schema/openapi/externaldocumentation.json", extendedExternalDocumentation), + Arguments.of("/json/v3/schema/openapi/externaldocumentation-url.json", ExternalDocumentation( + null, "https://example.com" + )), + ) + } + + } + + class Schemas: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/schema.json", SchemaTest()), + Arguments.of("/json/v3/schema/openapi/properties/array.json", ExampleEnumDefaultArrayTest()), + Arguments.of("/json/v3/schema/openapi/properties/null.json", ExampleEnumDefaultNullTest()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt new file mode 100644 index 00000000..5e8f9532 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt @@ -0,0 +1,174 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0 + +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Discriminator +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.ExternalDocumentation +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.XML +import java.math.BigDecimal + +class SchemaTest: SchemaProvider { + + override fun openAPISchema(): OpenAPISchema { + val schema = OpenAPISchema.builder() + .name("schema name") + .title("schema title") + .multipleOf(BigDecimal(2.5)) + .maximum(BigDecimal(100)) + .exclusiveMaximum(true) + .minimum(BigDecimal(0)) + .exclusiveMinimum(true) + .maxLength(3) + .minLength(20) + .pattern("^\\d{3}-\\d{2}-\\d{4}$") + .maxItems(10) + .minItems(1) + .uniqueItems(true) + .maxProperties(10) + .minProperties(2) + .required(listOf("id", "username")) + .type("object") + .allOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/Pet").build(), + OpenAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("hunts", OpenAPISchema.builder().type("boolean").build()), + Pair("age", OpenAPISchema.builder().type("integer").build()) + )) + .build() + )) + .anyOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/PetByAge").build(), + OpenAPISchema.builder() + .name("Pet by age") + .type("object") + .properties(mapOf( + Pair("age", OpenAPISchema.builder().type("integer").build()), + Pair("nickname", OpenAPISchema.builder().type("string").build()) + )) + .build(), + OpenAPISchema.builder().ref("#/components/schemas/PetByType").build(), + OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + )) + .oneOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/PetByAge").build(), + OpenAPISchema.builder() + .name("Pet by age") + .type("object") + .properties(mapOf( + Pair("age", OpenAPISchema.builder().type("integer").build()), + Pair("nickname", OpenAPISchema.builder().type("string").build()) + )) + .build(), + OpenAPISchema.builder().ref("#/components/schemas/PetByType").build(), + OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + )) + .not(OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + ) + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog", "Owl")) + .build() + ), + Pair("hunts", OpenAPISchema.builder() + .type("boolean") + .build() + ) + )) + .additionalProperties(OpenAPISchema.builder() + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog", "Owl")) + .additionalProperties(false) + .build() + ) + )) + .additionalProperties(OpenAPISchema.builder() + .properties(mapOf( + Pair("hunts", OpenAPISchema.builder() + .type("boolean") + .build() + ) + )) + .build() + ) + .build() + ) + .description("schema description") + .format("uri") + .ref("#/components/example/ref") + .nullable(true) + .readOnly(true) + .writeOnly(true) + .example(OpenAPISchema.builder() + .type("string") + .enumValue(listOf("approved", "pending", "closed", "new")) + .example("approved") + .build() + ) + .externalDocs(ExternalDocumentation( + "external docs description", + "https://example.docs/this" + )) + .deprecated(true) + .xml(XML( + "animal", + "http://example.com/schema/sample", + "sample", + true, + true + )) + .enumValue(listOf("asc", "desc", null)) + .defaultValue(listOf("asc", "desc", null)) + .discriminator(Discriminator( + "pet_type", + mapOf( + Pair("dog", "#/components/schemas/Dog"), + Pair("monster", "https://gigantic-server.com/schemas/Monster/schema.json"), + ) + )) + .build() + schema.extensions = mapOf(Pair("x-extension-property", "value")) + + return schema + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt new file mode 100644 index 00000000..3c1c877e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt @@ -0,0 +1,43 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties + +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema + +class ExampleEnumDefaultArrayTest: SchemaProvider { + + private val value = listOf( + 42, + true, + "hello", + null, + listOf( + 1, + 2, + 3, + OpenAPISchema.builder() + .type("string") + .defaultValue("abc") + .example(listOf( + OpenAPISchema.builder() + .type("string") + .defaultValue("abc") + .build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + ) + + override fun openAPISchema(): OpenAPISchema { + return OpenAPISchema.builder() + .example(value) + .enumValue(value) + .defaultValue(value) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt new file mode 100644 index 00000000..805357c8 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt @@ -0,0 +1,18 @@ +package com.asyncapi.v3.schema.openapi.v3._0_0.properties + +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema + +class ExampleEnumDefaultNullTest: SchemaProvider { + + private val value = null + + override fun openAPISchema(): OpenAPISchema { + return OpenAPISchema.builder() + .example(value) + .enumValue(value) + .defaultValue(value) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index a748d5a5..28da7797 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -259,12 +259,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -272,8 +272,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -300,8 +300,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -401,12 +401,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -433,8 +433,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -566,8 +566,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -681,12 +681,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -713,8 +713,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -841,12 +841,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -857,8 +857,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -885,8 +885,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -986,12 +986,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1018,8 +1018,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1151,8 +1151,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1266,12 +1266,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1298,8 +1298,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1449,8 +1449,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1550,12 +1550,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1582,8 +1582,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1715,8 +1715,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1830,12 +1830,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1862,8 +1862,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2105,8 +2105,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -2114,8 +2114,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -2176,12 +2176,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2189,8 +2189,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -2217,8 +2217,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2318,12 +2318,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2350,8 +2350,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2483,8 +2483,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2598,12 +2598,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2630,8 +2630,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2758,12 +2758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2774,8 +2774,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -2802,8 +2802,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2903,12 +2903,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2935,8 +2935,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3068,8 +3068,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3183,12 +3183,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3215,8 +3215,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3366,8 +3366,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3467,12 +3467,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -3499,8 +3499,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3632,8 +3632,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3747,12 +3747,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3779,8 +3779,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -4022,8 +4022,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -4031,8 +4031,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -4124,9 +4124,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4264,9 +4264,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4403,9 +4403,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4573,9 +4573,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4713,9 +4713,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4852,9 +4852,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4969,7 +4969,7 @@ } }, "Tag" : { - "schemaFormat" : "application/json", + "schemaFormat" : "application/schema+json;version=draft-07", "schema" : { "type" : "object", "properties" : { @@ -5131,12 +5131,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5144,8 +5144,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -5172,8 +5172,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5273,12 +5273,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5305,8 +5305,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5438,8 +5438,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5553,12 +5553,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5585,8 +5585,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5713,12 +5713,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5729,8 +5729,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -5757,8 +5757,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5858,12 +5858,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5890,8 +5890,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6023,8 +6023,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6138,12 +6138,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -6170,8 +6170,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6321,8 +6321,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6422,12 +6422,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -6454,8 +6454,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6587,8 +6587,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6702,12 +6702,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -6734,8 +6734,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6977,8 +6977,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -6986,8 +6986,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -7048,12 +7048,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7061,8 +7061,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -7089,8 +7089,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7190,12 +7190,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7222,8 +7222,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7355,8 +7355,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7470,12 +7470,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7502,8 +7502,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7630,12 +7630,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7646,8 +7646,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -7674,8 +7674,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7775,12 +7775,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7807,8 +7807,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7940,8 +7940,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8055,12 +8055,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -8087,8 +8087,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8238,8 +8238,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8339,12 +8339,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -8371,8 +8371,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8504,8 +8504,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8619,12 +8619,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -8651,8 +8651,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8894,8 +8894,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -8903,8 +8903,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -8996,9 +8996,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9136,9 +9136,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9275,9 +9275,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9445,9 +9445,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9585,9 +9585,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9724,9 +9724,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9877,12 +9877,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -9890,8 +9890,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -9918,8 +9918,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10019,12 +10019,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -10051,8 +10051,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10184,8 +10184,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10299,12 +10299,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10331,8 +10331,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10459,12 +10459,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10475,8 +10475,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -10503,8 +10503,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10604,12 +10604,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -10636,8 +10636,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10769,8 +10769,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10884,12 +10884,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10916,8 +10916,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11067,8 +11067,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11168,12 +11168,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -11200,8 +11200,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11333,8 +11333,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11448,12 +11448,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -11480,8 +11480,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11778,9 +11778,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -11918,9 +11918,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -12013,12 +12013,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -12045,8 +12045,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12160,12 +12160,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -12192,8 +12192,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12327,8 +12327,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12614,8 +12614,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -12623,8 +12623,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -12662,9 +12662,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -12760,8 +12760,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json index b4eafd4e..cacc25aa 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json @@ -5289,7 +5289,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json index ee8b9769..a74df3c7 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json @@ -31,12 +31,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -72,8 +72,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -173,12 +173,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -205,8 +205,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -338,8 +338,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -453,12 +453,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -485,8 +485,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -613,12 +613,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -657,8 +657,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -758,12 +758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -790,8 +790,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -923,8 +923,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1038,12 +1038,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1070,8 +1070,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1221,8 +1221,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1322,12 +1322,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1354,8 +1354,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1487,8 +1487,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1602,12 +1602,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1634,8 +1634,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1877,8 +1877,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -1886,8 +1886,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json index 26ba2e35..14181083 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json @@ -31,12 +31,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -72,8 +72,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -173,12 +173,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -205,8 +205,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -338,8 +338,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -453,12 +453,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -485,8 +485,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -613,12 +613,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -657,8 +657,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -758,12 +758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -790,8 +790,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -923,8 +923,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1038,12 +1038,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1070,8 +1070,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1221,8 +1221,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1322,12 +1322,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1354,8 +1354,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1487,8 +1487,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1602,12 +1602,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1634,8 +1634,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1877,8 +1877,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -1886,8 +1886,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json index b46b9cac..4fd445a2 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json @@ -3,12 +3,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -16,8 +16,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -145,12 +145,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -177,8 +177,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -310,8 +310,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -425,12 +425,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -457,8 +457,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json index 02e8b9d8..188d3afd 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json @@ -5,12 +5,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -21,8 +21,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -49,8 +49,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -150,12 +150,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -182,8 +182,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -315,8 +315,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -430,12 +430,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -462,8 +462,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json index d6e27026..6887c72e 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json @@ -27,8 +27,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -128,12 +128,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -160,8 +160,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -293,8 +293,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -408,12 +408,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -440,8 +440,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json index bb367ffe..df3c310d 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json @@ -3,12 +3,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -35,8 +35,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json index c2dd50c7..b46b615a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json @@ -5,12 +5,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -37,8 +37,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json index 7bd1b597..13f3cffc 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json @@ -24,8 +24,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index c78dc018..d937e849 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -13,7 +13,7 @@ } }, "Tag" : { - "schemaFormat" : "application/json", + "schemaFormat" : "application/schema+json;version=draft-07", "schema" : { "type" : "object", "properties" : { @@ -175,12 +175,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -188,8 +188,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -216,8 +216,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -317,12 +317,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -349,8 +349,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -482,8 +482,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -597,12 +597,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -757,12 +757,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -773,8 +773,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -801,8 +801,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -902,12 +902,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -934,8 +934,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1067,8 +1067,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1182,12 +1182,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1214,8 +1214,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1365,8 +1365,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1466,12 +1466,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1498,8 +1498,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1631,8 +1631,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1746,12 +1746,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1778,8 +1778,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2021,8 +2021,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -2030,8 +2030,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -2092,12 +2092,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2105,8 +2105,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -2133,8 +2133,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2234,12 +2234,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2266,8 +2266,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2399,8 +2399,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2514,12 +2514,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2546,8 +2546,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2674,12 +2674,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2690,8 +2690,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -2718,8 +2718,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2819,12 +2819,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2851,8 +2851,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2984,8 +2984,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3099,12 +3099,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3131,8 +3131,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3282,8 +3282,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3383,12 +3383,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -3415,8 +3415,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3548,8 +3548,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3663,12 +3663,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3695,8 +3695,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3938,8 +3938,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -3947,8 +3947,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -4040,9 +4040,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4180,9 +4180,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4319,9 +4319,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4489,9 +4489,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4629,9 +4629,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4768,9 +4768,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4921,12 +4921,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -4934,8 +4934,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -4962,8 +4962,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5063,12 +5063,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5095,8 +5095,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5228,8 +5228,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5343,12 +5343,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5375,8 +5375,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5503,12 +5503,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5519,8 +5519,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -5547,8 +5547,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5648,12 +5648,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5680,8 +5680,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5813,8 +5813,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5928,12 +5928,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5960,8 +5960,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6111,8 +6111,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6212,12 +6212,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -6244,8 +6244,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6377,8 +6377,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6492,12 +6492,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -6524,8 +6524,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6822,9 +6822,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -6962,9 +6962,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -7057,12 +7057,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7089,8 +7089,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7204,12 +7204,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7236,8 +7236,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7371,8 +7371,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7658,8 +7658,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -7667,8 +7667,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -7706,9 +7706,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -7804,8 +7804,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json index f91bdf04..dcab9a3a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json @@ -13,7 +13,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json index 1274a6fe..acb016d5 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json @@ -13,7 +13,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json index 3e489169..76102126 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json @@ -58,9 +58,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -198,9 +198,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -337,9 +337,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json index a50dbc19..6526f625 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json @@ -57,9 +57,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -197,9 +197,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -336,9 +336,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json index ba5c25b6..b12fa47a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json @@ -54,9 +54,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json index 5e1d3d73..4cb84973 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json @@ -53,9 +53,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json index f0c5c5dc..cc6e6930 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json @@ -4,8 +4,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -13,8 +13,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json index 35dee45d..e137e19d 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json @@ -3,8 +3,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json index 70152613..4b10d04b 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json @@ -6,9 +6,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc new file mode 100644 index 00000000..7f27d31b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc @@ -0,0 +1,27 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": ["null", { + "type": "array", + "items": "model.DocumentInfo" + }], + "doc": "", + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc new file mode 100644 index 00000000..7f6383f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc @@ -0,0 +1,18 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc new file mode 100644 index 00000000..c67a6eba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc @@ -0,0 +1,13 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc new file mode 100644 index 00000000..af11831b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc @@ -0,0 +1,284 @@ +{ + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc new file mode 100644 index 00000000..065b448d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc @@ -0,0 +1,50 @@ +{ + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc new file mode 100644 index 00000000..24487c98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc @@ -0,0 +1,23 @@ +{ + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc new file mode 100644 index 00000000..a6b0bb39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc @@ -0,0 +1,23 @@ +[ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc new file mode 100644 index 00000000..c0d7396e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc @@ -0,0 +1,21 @@ +{ + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc new file mode 100644 index 00000000..66a80597 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc @@ -0,0 +1,29 @@ +{ + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc new file mode 100644 index 00000000..fd809e6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc @@ -0,0 +1,29 @@ +{ + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc new file mode 100644 index 00000000..31881474 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc @@ -0,0 +1,30 @@ +{ + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc new file mode 100644 index 00000000..a373524e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc @@ -0,0 +1,30 @@ +{ + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc new file mode 100644 index 00000000..c01875bf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc @@ -0,0 +1,22 @@ +{ + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json new file mode 100644 index 00000000..e94c027f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json @@ -0,0 +1,28 @@ +{ + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json new file mode 100644 index 00000000..3b811fb9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json @@ -0,0 +1,28 @@ +{ + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json new file mode 100644 index 00000000..e791630a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json @@ -0,0 +1,14 @@ +{ + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc new file mode 100644 index 00000000..39e35347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc @@ -0,0 +1,8 @@ +{ + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc new file mode 100644 index 00000000..01884575 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc @@ -0,0 +1,18 @@ +{ + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json new file mode 100644 index 00000000..88e59e27 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json @@ -0,0 +1,34 @@ +{ + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json new file mode 100644 index 00000000..07a25a4f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json @@ -0,0 +1,41 @@ +{ + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..e6285588 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json @@ -0,0 +1,39 @@ +{ + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..bfb8b8a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,172 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json new file mode 100644 index 00000000..11f1b90b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json @@ -0,0 +1,11 @@ +{ + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json new file mode 100644 index 00000000..bcab4804 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json @@ -0,0 +1,21 @@ +{ + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json new file mode 100644 index 00000000..fc113a02 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json @@ -0,0 +1,106 @@ +{ + "const": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + } + ], + "default": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + } + ], + "examples": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json new file mode 100644 index 00000000..032583ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647, + "default": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647, + "examples": [2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json new file mode 100644 index 00000000..c68594d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648, + "default": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648, + "examples": [-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json new file mode 100644 index 00000000..980cdec4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json @@ -0,0 +1,5 @@ +{ + "const": 1.123456789021474836471234567890214748364712345678902147483647, + "default": 1.123456789021474836471234567890214748364712345678902147483647, + "examples": [1.123456789021474836471234567890214748364712345678902147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json new file mode 100644 index 00000000..1043bf67 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 214748364721474836472147483647, + "default": 214748364721474836472147483647, + "examples": [214748364721474836472147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json new file mode 100644 index 00000000..963dc327 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -214748364821474836482147483648, + "default": -214748364821474836482147483648, + "examples": [-214748364821474836482147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json new file mode 100644 index 00000000..62fabf8b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json @@ -0,0 +1,5 @@ +{ + "const": 12345678902147483647, + "default": 12345678902147483647, + "examples": [12345678902147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json new file mode 100644 index 00000000..45ceebb8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json @@ -0,0 +1,5 @@ +{ + "const": false, + "default": false, + "examples": [false] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json new file mode 100644 index 00000000..58ac5c98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json @@ -0,0 +1,5 @@ +{ + "const": true, + "default": true, + "examples": [true] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json new file mode 100644 index 00000000..7bcc4bbc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 1.7976931348623157E308, + "default": 1.7976931348623157E308, + "examples": [1.7976931348623157E308] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json new file mode 100644 index 00000000..569f14fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -4.9E-324, + "default": -4.9E-324, + "examples": [-4.9E-324] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json new file mode 100644 index 00000000..7840b2cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json @@ -0,0 +1,5 @@ +{ + "const": 123.456, + "default": 123.456, + "examples": [123.456] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json new file mode 100644 index 00000000..4e921565 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 3.4028234, + "default": 3.4028234, + "examples": [3.4028234] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json new file mode 100644 index 00000000..f684d466 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -0.000001, + "default": -0.000001, + "examples": [-0.000001] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json new file mode 100644 index 00000000..181f520d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json @@ -0,0 +1,5 @@ +{ + "const": 1.1234567, + "default": 1.1234567, + "examples": [1.1234567] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json new file mode 100644 index 00000000..1283cc6f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 2147483647, + "default": 2147483647, + "examples": [2147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json new file mode 100644 index 00000000..e6527f86 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -2147483648, + "default": -2147483648, + "examples": [-2147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json new file mode 100644 index 00000000..2a5a4b6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json @@ -0,0 +1,5 @@ +{ + "const": 0, + "default": 0, + "examples": [0] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json new file mode 100644 index 00000000..88f688df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json @@ -0,0 +1,5 @@ +{ + "const": null, + "default": null, + "examples": [null] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json new file mode 100644 index 00000000..f1d4fbba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json @@ -0,0 +1,16 @@ +{ + "const": { + "type": "string", + "const": "abc" + }, + "default": { + "type": "string", + "const": "abc" + }, + "examples": [ + { + "type": "string", + "const": "abc" + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json new file mode 100644 index 00000000..82e34caf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json @@ -0,0 +1,12 @@ +{ + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..9ccbb273 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..a001806a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..ee97cf42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..e533100a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..8c3617dd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..bebe6b8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..457d226f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..1afafa81 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..8c65ccae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..1520bf39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..efb6bd2d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..f53f8753 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..71534348 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..c1740aa8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..97eedf64 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..632b49d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..7ae73e9a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..3ba907f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..00718098 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0d0c000e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..82a762a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..6f461678 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..cc4258bb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..393802f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..5f7cf384 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..d09d8353 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..585622fd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..1955ae2a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..50dbeaa0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..db4a273c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..3ba6a3ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8dcfbb5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..2af936ae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..5a79affa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..007ccad2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..6107245a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..26e5fd2a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..feae34f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..837afff7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..67327cc2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..e807fb03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..c3910508 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..ad0c7262 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..5ccb47ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..c84e1acc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..376a3524 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..4147d48c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..bb86ceea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..0fe37492 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..c2f8118a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..08965325 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..9ddd01e6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..5f021a5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..e0b1e117 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..74ac68c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..1779619b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..264f7d6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..5caad998 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..7b728fe2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8b5f2609 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..f9ca8f1a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..b07da134 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..1ac0bc74 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..258fb97e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..ef014b39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..1ceb3beb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..f4ad81f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..ce5eaacf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..4d7d73c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..ca7c0701 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..30e20850 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..a4ee9e5e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..c2cd1d91 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..7b0e8f60 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..44248817 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0ebfca00 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..d36d60a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..31afd8dc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..66ff5e01 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..b2680bf3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..eb1b4043 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..c8cf594c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..e43a5c42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..06515671 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..9513fe7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..2c841b8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..2c5cdecc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..b8b6c860 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..f3f97174 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..ce3e0096 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..c2a9940b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..fd174ebc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..e1461688 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..3325a556 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..f556d218 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..5dce443b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..51e43a18 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..37d087a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..a1ddba2e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..c8b469fa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..f3dc9004 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..d89e869f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..723296d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..cda0bd4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..fd942604 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..eac81525 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..15bc2a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..2cd2611f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..a638c9d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..a68efc39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..0ee9afce --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..5eb999f3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..280c0614 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..b807c9fc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..a2afa001 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..32f234d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..5c17f3d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..03476640 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..77d1e1f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..c7c58076 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..0f2e0105 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..4af79118 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..3bd11767 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..7eebfbfe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..0efcef97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..f09b3f68 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..ee453ee2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..ae29c1b4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..d66dab7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..31fbf610 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..18cad7f6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..48de1d4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..a185fc43 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b8d13d12 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..f5a24ba2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..85acde63 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..c02e8c0f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..16502a8a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..f14b0bf8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..3a9b47f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..fb471dbd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..ea84f354 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..d8f8acd3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..7b3cb572 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..431a85d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..f649404c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..a379376c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..3574a0a6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..49956775 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..f09f8ed6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..1b1a2229 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..01941c5a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..f6329c14 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..8a05265e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..038be9e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..545c2f6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..4eddf572 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..a79f3410 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..33c685e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..69b89f02 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..b7b68540 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..ef123b0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..55d9ee66 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..efe6b7df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..e4bebeee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..2360adc3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..a3bc197e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..3a2a7509 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..2817c994 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..6706c171 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..a5ae0ae1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..25f2a1fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..5e4e2062 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..3330f54c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..9075ed0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..c6966532 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..8950a9e4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..037b3033 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b1a866fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..f1cb6f96 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..6852fff7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..c869b0a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..1e9aa24b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..972cbe24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..6062b663 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..433bc7ca --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..69de6026 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a65a8a4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..1cf64c5e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..46b10757 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..2504bee4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..79a3224a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..23625df1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..4f7102c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..b6936391 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..b3afbf26 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json new file mode 100644 index 00000000..bd28415b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json new file mode 100644 index 00000000..c059144d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..2a8de809 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..fd630b0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json new file mode 100644 index 00000000..3a7c9893 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json new file mode 100644 index 00000000..1017da7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json new file mode 100644 index 00000000..761dd145 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml new file mode 100644 index 00000000..aca4d1dd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..b76367b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0d2a990f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..9b26361a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..d855d235 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml new file mode 100644 index 00000000..adc25975 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..dc2322f6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..fde8915d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..d6d6df25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..380d050e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..3dc936a0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..92e2a1b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..6a60760e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..c61325c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b38a28f8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..c5f2fbf7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..d1bb7ecf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..02913a8e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..147e627d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..a891512b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..bb1def4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..6784598d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..addba641 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..957b23b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..80ae4a3f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..96317d72 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..45805cfb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..a18d294b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..5996ba21 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..2af6e464 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..f0b29eb5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..ac1ebcfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..0ff839e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..e2d043e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..c5eebe4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..1dabd345 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..53d8bfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..373c5467 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..8d17f257 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..2d0c9267 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..9c5a3156 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..0661e521 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..ffa79186 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..cc6ca4ac --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..fe5960bd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..447765b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..5bbd9250 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..2256e4c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..0366e21b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..695eb8ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..103a2b4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..552a8f35 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..0f0a092d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..64f55018 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..48255741 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..53918421 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..3679160b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..94b9383a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..63fa67fc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..1a35ab61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..364460c3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..ac17210c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..fbef0d1e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..7e848a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..8ea98efb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..bfb77ff2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..b037f7cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..533ac151 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..0d35c7b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..a5a51429 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..86b0b054 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..3f0ab400 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..5176e9b4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..4a0f4aa1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..c9e7eda6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..e9d59b9d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..89699204 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..f0ccb928 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..7ce393a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..44bb2aa7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..1feeaab2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..dd638c1b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..3578e507 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..4f0d5526 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..fe80ba0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..5532797b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..a832e70d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..18357b60 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..11e2889d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..e03e2998 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..aed0e550 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..3abf3347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..9be06c34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..a43d0f6f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..686ba97d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..3e162495 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..6b83f55f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..7b6acade --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c3c0346a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..20d1ea68 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..df5a1b7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..316ca67d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..cec3ad41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..f7d69f77 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..9e88a248 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..e9ac2d90 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..6fc34ed4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..a0fca74e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..3f9dcdf0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..6b13de4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..d033ec6d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..e0ee2cda --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..af2975c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..2ac28fce --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..631a0bd0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..f9624a13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..d2623811 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..bc9d1f2b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..b198cf1c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..7ac87480 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..cd4c103f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..d7e5e136 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..885ff7ca --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..68f12374 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..bd75cda3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..a177941b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..b77aa3a2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..a9c031de --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..f3323395 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..c100e124 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..32c75173 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..3a454c65 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..3af8ca73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..3292040d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..98bb02b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..79037029 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..19cfae6e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..6e6ebc8d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..37bf7ae1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..7dd6053f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..ed45b0f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..79f81e0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..d0e03b67 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..4832c791 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..0908d65a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..ca86f831 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..ae4221c7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..e15c6e07 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..675ade4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..ac8c6370 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..1c88b8a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..0bb35b65 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..3ccbb235 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..bbcbf6d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..2c73986d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..e3c376b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..d14f3d11 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..f3751913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..92c1d404 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..ffb30a44 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..020b315c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..440925b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..0ed04ed7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..8fba05a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..13fd2fd9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..1319e4df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..7e36a744 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..9c21f64e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..93cbcb03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..3e1d4926 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..04066c13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..9a394d7c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..b6ec45e5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..1bcb188b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..acbd8d4c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..8ab1d27e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..83c16b37 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..854230e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..f89dfc24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..8d972805 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..6d2aef04 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..3866080d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..a27541c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..0e3c8dc4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..0921e297 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..5e5fc560 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..f35068e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..48ce722a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..5ffc7693 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..69b1dae0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..3b1b76b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..6d98a94e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..d9501a4e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..9ba29202 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..7f07d913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..8fd2223c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..5bd4f789 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..5afa1faf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..6233a7ef --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..4e71d612 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..6060855d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..17a3c1ef --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..5a7c37e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..726e9ffe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..8a752139 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..dfe8240f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..9029df24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..06446dfc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..2e5dafda --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..ca21c01b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..e07403e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..1742ad71 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..379d44db --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..abeb59a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..ec5acc73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..3c73fb56 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..4c78ded2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..ba4e8b7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..4c4fd999 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..9988c4d6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..cca79f12 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..a92d39e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..b8d493c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..8961acbd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..b3f02f95 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..1fbc7937 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..944d3a34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..da640be8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..20947e15 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..cea82de0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..6cdda889 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..e75508b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..3ae4ebfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..91bab326 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..7a31802f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..571e97b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..fbe84270 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..4a81ed64 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..0a55f74f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..29a06856 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..f4e5567b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..c7f2cf0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c9cf455b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..9404f855 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..ac9f87b3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..fd6df24f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..eb6551e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..ee720169 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..ba2c8198 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..3dc0b006 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..7e1a424d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..11abfed4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..eba8c1f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..2e3f27cb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..93d43634 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..03236807 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..22072983 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..aff0e94f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..335d4876 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..296a4d25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..e6cc3384 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..aeea4687 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..7a3db901 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..39a21559 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..542ec781 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..fef0e1e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..5477bb8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..bfb67852 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..4d681e41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..37d7dd14 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..96eb6bdc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..0a8bd77a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..6c9b12f9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..fd627743 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..3a4eb834 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..a624086d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..08c3c214 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..70eb69e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..0e556bec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..7b40b630 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..5b28fa84 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..121798e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..c70f7d5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..9b9daa8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..81344dee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..eedd00a8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..f4e5cfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..941c2170 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..5682fce4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..8ffa4eaa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..d4a745ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..4203673b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..4977af69 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..9f724db4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..12d128e4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..74394a76 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..4ecac9d4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..77f23d93 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..6d49f053 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..2f80eca3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..1ae5f1b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..d6eed846 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..36fa0df4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..7ab01116 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..637d72a0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..4a72b951 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..a21a5bfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..be320339 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..2d193668 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..55bff5ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..d23a981e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..7cfc4a53 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..aa1c0d7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..bd9586f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..02f1d7d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..3a855ad8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..e29d712a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..11d8b0e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..bc2b9190 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..3f9ea489 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..2f8f8b61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..be3156f3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..5a6d20cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..d0faa673 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..87e9490b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..8d499f33 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..340ec2f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..02117872 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..60da782a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..a6debd32 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..b3798c31 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..9f30c293 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..046368b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..cd0f2f72 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..1623583c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..70d981d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..38e0d4e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..7bdd6104 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..69d248c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e2f119ee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..662329d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..b63c824e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..74fc0005 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..bbc648fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..dda9e031 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..4582d1ee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..2695c5d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..a1641a25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..f3022e79 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..2490666e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..39599dd7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..3e35b8b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..6b2c5376 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..237fc219 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..707aa347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..3d386ba7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..00a65950 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..469c4e7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..8b3aa2e6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..2aaf4454 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..f9887c87 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..4d37d307 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..3e538d97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..d22becbc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..7c39855f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..43bc837c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..b2bdf139 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..231be206 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..02aea719 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..0d75cb11 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..a308695c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..b40732d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..b4dc8cdb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..ca67d402 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..cdcb8a74 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..372cae9b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..633329b2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..3b283b46 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..4243d0b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..b894dfa1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..bdfe223f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..ca7eb337 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..3e4b3783 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..f3b67eb4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..ccf455e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..33963477 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c8720afe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..d3d176c3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..413c4229 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..5ee7034b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..d650fb34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..d60dda61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..1272e5be --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..68ef9b6e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..93c04c5d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..6f61a708 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..b89d067f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..e86063a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..1e09d8a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..29fcfb59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..3101930d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..86235632 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..b7df784d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..8a8a0554 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..e678106d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..c01c65e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..10c9cdab --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..365f7011 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..912c0314 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..2d4948d9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..707a3db2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..4b5d6718 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..dfa3f931 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..7945311c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..cc483a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..3eee6ec3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..e3d29a47 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..8224d884 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..45abf7a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..72ad6517 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..8bbb8eff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..d4cdd5e3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..10b51144 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..2bdc1bd4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..17a3ff05 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..013bf7a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..857e843e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..8b71297d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..4d4f5a1b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..6abb1ffa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..7eed0342 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..24e79c0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..efc90ef3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..e49d28b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..a52b0350 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..068c40ae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..364c543d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..ddab914b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..0104cfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..6c9b2721 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..8ba4b781 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..56d50f09 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..862317cb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..1b46e9de --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..ad2dde93 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..fd4bb290 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..4a5a12f9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..2d5cd418 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..72e18a97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..f6846a98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..ff6d7c33 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..8ba42070 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..f5d78645 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..d81164c7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..16f8d434 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..b1ae31fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..e301b4a9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..d7e6e9fa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..2a2243bd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..770e777f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..37d812d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..60c9d726 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..f059abf6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..4d3c337e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..d6508200 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..ea1fce48 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..2cc33aac --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..78ae67d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..ae51a947 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..8d74cf3b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..3f086c2e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..c5e81408 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..a6b3dda7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..2e0eb07f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..100c5f5a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..a7e67091 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..2b0f711f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..50aaef25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..c1bd4991 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..82cd6c76 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..1510242a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..dd0231cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..1fa8f74d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..d6debd3b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..42132381 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..e2066186 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..f36ef43d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..5ed1c50d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..7faabc25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..36057ba6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..50ac9c03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..bf19adc1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..268d0a69 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..5ff1d878 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..eb9a29f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..f84503c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..43e23b54 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..ece3bcfd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..347775be --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..f9227b36 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..172a4952 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..e3031ee8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..d4ed2e26 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..71c14f08 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..2f5f8f96 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..accf9aee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..589f89ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..2135cae5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..768af978 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..773ce745 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..1bdec03e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..2fc46f35 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..607ca47c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..b1f81ddb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e7eb9310 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..772f0a19 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..52fca4ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..40fd8935 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..11c51a43 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..cdbec3a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..7306d724 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..723a34c5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..c28914a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..b3fb1b0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..7453626a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..eb7106e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..3f5a4d3c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..467d03d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..834f9194 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..7f817591 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..cf881ddb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..8390794b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..e6088df3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..ee9f6726 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..8dda3a06 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..41d0631d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..5c10f088 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..050e8b88 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..17d378fd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..d08d6c6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..f6f04913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..780d81ad --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..accadc8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..996a6853 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..ead9ad4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..8d29f1ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..7e0ad977 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..3747400f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..821c88ed --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..d25eb8eb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..6f0796b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..1cd2b113 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..c14246b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..da694e7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..56e538d7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e3b30f57 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..ff424075 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..de3c4f4e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..5051b798 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..2901b30f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..71a89248 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..c5b6168f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..c249f3e3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..b18bf5c0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..e8c318f2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..85b6e9e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..3639dab9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..5ce77610 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..4a9273f4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..77209ce1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..c4773a45 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..9f2fb2af --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..aca3814c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..ab88efd1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..a0ff23ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..db4af2d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..6d02b0da --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..d47bc55b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..02de22b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..b41231f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..8d2b05d6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..43b066bc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..f11e7f13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..aa26b45f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..f7d355c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..2009d089 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..c5e4a5b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..5f9720f8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..9a86ed73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..499e7c48 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..faf855d7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..a49c689e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..232ce831 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..0730227b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..8eee36aa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..a6d84671 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..b0b94ea7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/arrays.schema.json new file mode 100644 index 00000000..ab24f72d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json new file mode 100644 index 00000000..52498a01 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..4c658616 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..a85d880c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json new file mode 100644 index 00000000..ffb3ffd3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/person.schema.json new file mode 100644 index 00000000..beb597a2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json new file mode 100644 index 00000000..ed0390cc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml new file mode 100644 index 00000000..c6f5727f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml new file mode 100644 index 00000000..e6c75d55 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0247faed --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..53e3b503 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml new file mode 100644 index 00000000..a43c5da7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml new file mode 100644 index 00000000..58ca8fd1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml new file mode 100644 index 00000000..0cc26493 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..825a8c6b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.0", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..7f763b51 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.0 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..ca6bfabe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..925a6a9f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.0 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..2b999879 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.1", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..4cfae2ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.1 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..31e84e7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.1", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..cebd9e55 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.1 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..a9c24a6a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.2", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..13a0628d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.2 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..44cc0c8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.2", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..2da4a372 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.2 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..c61f20df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.3", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..5b1e5f57 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.3 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..398c1e9f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.3", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..886578db --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.3 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json new file mode 100644 index 00000000..4296200b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml new file mode 100644 index 00000000..edbf68b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json new file mode 100644 index 00000000..1df1ed52 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml new file mode 100644 index 00000000..c01793c5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..bb8a59af --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a5dc86c0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..6a072113 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..a1f03214 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: '' +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json new file mode 100644 index 00000000..48de5bcd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml new file mode 100644 index 00000000..6de5e15c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json new file mode 100644 index 00000000..fe65ec3c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml new file mode 100644 index 00000000..616f30fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json new file mode 100644 index 00000000..c552edf0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml new file mode 100644 index 00000000..bc3b0d66 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json new file mode 100644 index 00000000..b70a8a42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml new file mode 100644 index 00000000..e4085492 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json new file mode 100644 index 00000000..691250b7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml new file mode 100644 index 00000000..8ab3f7f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..71e03832 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a451fe31 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..585fa24b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": null, + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..d84611b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json new file mode 100644 index 00000000..9592d9c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml new file mode 100644 index 00000000..e469f812 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json new file mode 100644 index 00000000..6c4090d4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml new file mode 100644 index 00000000..13b9f8ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: null +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json new file mode 100644 index 00000000..05723bcd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml new file mode 100644 index 00000000..231072ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json new file mode 100644 index 00000000..1549e74a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json @@ -0,0 +1,36 @@ +{ + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml new file mode 100644 index 00000000..7fdd32d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml @@ -0,0 +1,27 @@ +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json new file mode 100644 index 00000000..557c70b2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json @@ -0,0 +1,43 @@ +{ + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml new file mode 100644 index 00000000..bee67a7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml @@ -0,0 +1,35 @@ +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..227c33d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json @@ -0,0 +1,41 @@ +{ + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..7bf84a41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml @@ -0,0 +1,27 @@ +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8f13271f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json @@ -0,0 +1,174 @@ +{ + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..c7d09fb8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,163 @@ +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json new file mode 100644 index 00000000..f063a090 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json @@ -0,0 +1,13 @@ +{ + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml new file mode 100644 index 00000000..7e3cfccc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml @@ -0,0 +1,15 @@ +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json new file mode 100644 index 00000000..bcbd21a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json @@ -0,0 +1,23 @@ +{ + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml new file mode 100644 index 00000000..81836816 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml @@ -0,0 +1,16 @@ +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json new file mode 100644 index 00000000..2a928347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json @@ -0,0 +1,14 @@ +{ + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml new file mode 100644 index 00000000..017469c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml @@ -0,0 +1,9 @@ +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json new file mode 100644 index 00000000..5db0d535 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json @@ -0,0 +1,3 @@ +{ + "propertyName": "pet_type" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json new file mode 100644 index 00000000..e37ee7d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json @@ -0,0 +1,7 @@ +{ + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json new file mode 100644 index 00000000..1f125af4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json @@ -0,0 +1,3 @@ +{ + "url": "https://example.com" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json new file mode 100644 index 00000000..20aa0964 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json @@ -0,0 +1,5 @@ +{ + "description": "Find more info here", + "url": "https://example.com", + "x-extension-property": "value" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json new file mode 100644 index 00000000..9a24444f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json @@ -0,0 +1,65 @@ +{ + "example": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ], + "enum": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ], + "default": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json new file mode 100644 index 00000000..8016ff6a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json @@ -0,0 +1,5 @@ +{ + "example": null, + "enum": null, + "default": null +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json new file mode 100644 index 00000000..0c529e6b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json @@ -0,0 +1,175 @@ +{ + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json new file mode 100644 index 00000000..73eaca92 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json @@ -0,0 +1,3 @@ +{ + "attribute": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json new file mode 100644 index 00000000..68520200 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json @@ -0,0 +1,3 @@ +{ + "name": "animal" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json new file mode 100644 index 00000000..d7a8bda6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json @@ -0,0 +1,4 @@ +{ + "namespace": "http://example.com/schema/sample", + "prefix": "sample" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json new file mode 100644 index 00000000..7d4ad6f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json @@ -0,0 +1,3 @@ +{ + "wrapped": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json new file mode 100644 index 00000000..dfe05fba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json @@ -0,0 +1,8 @@ +{ + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true, + "x-extension-property": "value" +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index d833a672..ba543c30 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.asyncapi asyncapi - 1.0.0-EAP-3 + 1.0.0-RC AsyncAPI