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..57f23067 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,7 +1,7 @@ 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.AsyncAPISchema; import com.asyncapi.v3.schema.MultiFormatSchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -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..b56c85f3 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 @@ -2,7 +2,7 @@ import com.asyncapi.v3.Reference; import com.asyncapi.v3.schema.MultiFormatSchema; -import com.asyncapi.v3.schema.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; @@ -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..e62d14be 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 @@ -2,7 +2,7 @@ import com.asyncapi.v3.Reference; import com.asyncapi.v3.schema.MultiFormatSchema; -import com.asyncapi.v3.schema.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; @@ -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..f4efc111 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 @@ -39,13 +39,13 @@ 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.AsyncAPISchema}
  • *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
@@ -57,12 +57,12 @@ 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.AsyncAPISchema}
  • *
  • {@link com.asyncapi.v3.schema.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..662f6ed2 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 @@ -39,13 +39,13 @@ 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.AsyncAPISchema}
  • *
  • {@link com.asyncapi.v3.schema.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..bdf01759 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 @@ -24,7 +24,7 @@ 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.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/SchemasAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAdditionalPropertiesDeserializer.java similarity index 84% 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/AsyncAPISchemaAdditionalPropertiesDeserializer.java index 659d70fe..0e751265 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/AsyncAPISchemaAdditionalPropertiesDeserializer.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.jackson.schema; -import com.asyncapi.v3.schema.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; @@ -14,7 +14,7 @@ * @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) * @author GraviteeSource Team */ -public class SchemasAdditionalPropertiesDeserializer extends JsonDeserializer { +public class AsyncAPISchemaAdditionalPropertiesDeserializer 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(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/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/schema/AsyncAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java new file mode 100644 index 00000000..df48cf9f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java @@ -0,0 +1,867 @@ +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.AsyncAPISchemaItemsDeserializer; +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") + 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") + 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; + + /** + * This property has been overwritten by AsyncAPI Specification - maybe boolean value + *

+ *

+ * 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") + @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") + 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") + 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/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java similarity index 96% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java index 1d2a6cf7..426d7671 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java @@ -1,12 +1,13 @@ 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.jackson.schema.JsonSchemaItemsDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.Nullable; import javax.validation.constraints.Min; @@ -25,8 +26,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class Schema extends ExtendableObject { +public class JsonSchema { /** * JSON Schema ID. @@ -262,7 +262,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("items") - @JsonDeserialize(using = SchemaItemsDeserializer.class) + @JsonDeserialize(using = JsonSchemaItemsDeserializer.class) public Object items; /** @@ -282,7 +282,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("additionalItems") - public Schema additionalItems; + public JsonSchema additionalItems; /** * The value of this keyword MUST be a non-negative integer. @@ -336,7 +336,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("contains") - public Schema contains; + public JsonSchema contains; /* Validation Keywords for Objects @@ -404,7 +404,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("properties") - public Map properties; + public Map properties; /** * The value of "patternProperties" MUST be an object. @@ -426,12 +426,9 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("patternProperties") - public Map patternProperties; + public Map patternProperties; /** - * This property has been overwritten by AsyncAPI Specification - maybe boolean value - *

- *

* 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 @@ -448,8 +445,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("additionalProperties") - @JsonDeserialize(using = SchemasAdditionalPropertiesDeserializer.class) - public Object 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 @@ -493,7 +489,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("propertyNames") - public Schema propertyNames; + public JsonSchema propertyNames; /* Keywords for Applying Subschemas Conditionally @@ -516,7 +512,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("if") - public Schema ifValue; + public JsonSchema ifValue; /** * This keyword's value MUST be a valid JSON Schema. @@ -530,7 +526,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("then") - public Schema thenValue; + public JsonSchema thenValue; /** * This keyword's value MUST be a valid JSON Schema. @@ -544,7 +540,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("else") - public Schema elseValue; + public JsonSchema elseValue; /* Keywords for Applying Subschemas With Boolean Logic @@ -562,7 +558,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("allOf") - public List allOf; + public List allOf; /** * This keyword's value MUST be a non-empty array. @@ -576,7 +572,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("anyOf") - public List anyOf; + public List anyOf; /** * This keyword's value MUST be a non-empty array. @@ -590,7 +586,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("oneOf") - public List oneOf; + public List oneOf; /** * This keyword's value MUST be a valid JSON Schema. @@ -601,7 +597,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("not") - public Schema not; + public JsonSchema not; /* Semantic Validation With "format" @@ -688,7 +684,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("definitions") - private Map definitions; + private Map definitions; /* Schema Annotations 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 index 62dc3d8a..9304c07a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java @@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull; /** - * The Multi Format Schema Object represents a schema definition. It differs from the {@link Schema} in that it supports + * 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 @@ -28,7 +28,7 @@ public class MultiFormatSchema extends ExtendableObject { * 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}. + * 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. @@ -54,7 +54,7 @@ public class MultiFormatSchema extends ExtendableObject { *

* Definition of the message payload. *

- * It can be of any type but defaults to {@link Schema}. + * 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 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..b7a3dffe 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 @@ -20,7 +20,7 @@ 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.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,16 +238,16 @@ 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() ) @@ -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") @@ -295,26 +295,26 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { ) )) .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..64232863 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 @@ -13,7 +13,7 @@ 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.security_scheme.http.HttpSecurityScheme class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { @@ -228,15 +228,15 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { )) .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() @@ -258,15 +258,15 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { )) .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..3363eb0a 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,7 +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.AsyncAPISchema import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest @@ -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() 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..3fae68ce 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,7 +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.AsyncAPISchema import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest @@ -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() 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..25f6c3c5 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 @@ -19,7 +19,7 @@ import com.asyncapi.v3._0_0.model.operation.reply.OperationReplyTestWithReferenc 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.Type import com.asyncapi.v3.security_scheme.ApiKeySecuritySchemeTest import com.asyncapi.v3.security_scheme.OpenIdConnectSecuritySchemeTest @@ -49,11 +49,11 @@ 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() ), 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())