From 682ac150bdf66bbc2d3a8e36d216d2d6736c4095 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 01:07:34 +0400 Subject: [PATCH 01/44] refactor(schemas): update JSON Schema meta properties --- .../java/com/asyncapi/v3/schema/Schema.java | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index f71302ac..2e89002e 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -5,6 +5,7 @@ import com.asyncapi.v3.jackson.schema.SchemasAdditionalPropertiesDeserializer; import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -29,7 +30,8 @@ *

* New properties may appear in this class after community requests. * - * @see AnyncAPI Schema Object + * @see Draft 07 JSON Schema + * @see Draft 07 JSON Schema Validation * @author Pavel Bodiachevskii */ @Data @@ -39,6 +41,44 @@ @EqualsAndHashCode(callSuper = true) public class Schema 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; + /* Schema Annotations @@ -154,10 +194,6 @@ information for documentation and user interface display purposes. @JsonProperty public List examples; - @Nullable - @JsonProperty("$ref") - private String ref; - /* String-Encoding Non-JSON Data From bbcfdbffa930ccdc52dbcd3cbb02937dbd54c5fc Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 01:27:40 +0400 Subject: [PATCH 02/44] refactor(schemas): update JSON Schema Validation Keywords for Any Instance Type --- .../java/com/asyncapi/v3/schema/Schema.java | 97 ++- .../v3/3.0.0/model/asyncapi - extended.json | 784 +++++++++--------- .../model/channel/channel - extended.json | 124 +-- .../channel with reference - extended.json | 124 +-- .../channel/message/message - extended.json | 44 +- .../channel/message/message 2 - extended.json | 36 +- .../message with reference - extended.json | 36 +- .../message/messageTrait - extended.json | 12 +- .../message/messageTrait 2 - extended.json | 8 +- ...essageTrait with reference - extended.json | 8 +- .../components/components - extended.json | 488 +++++------ .../model/operation/operation - extended.json | 24 +- .../operation with reference - extended.json | 24 +- .../operation/operationTrait - extended.json | 8 +- ...rationTrait with reference - extended.json | 8 +- .../webSocketsChannelBinding - extended.json | 8 +- .../anypointMQMessageBinding - extended.json | 4 +- .../http/httpMessageBinding - extended.json | 4 +- .../http/httpOperationBinding - extended.json | 8 +- 19 files changed, 935 insertions(+), 914 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 2e89002e..d1601844 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -79,6 +79,65 @@ public class Schema extends ExtendableObject { @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; + /* Schema Annotations @@ -252,44 +311,6 @@ as assertions (Section 3.2). While no special effort is required to Validation. */ - /* - Validation Keywords for Any Instance Type - */ - - /** - * The value of this keyword MUST be either a string or an array. If it is an array, elements of the array MUST - * be strings and MUST be unique. - *
- * String values MUST be one of the six primitive types ("null", "boolean", "object", "array", "number", or "string"), - * or "integer" which matches any number with a zero fractional part. - *
- * An instance validates if and only if the instance is in any of the sets listed for this keyword. - * - */ - @Nullable - @JsonProperty - public Object type; - - /** - * The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique. - *
- * An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value. - *
- * Elements in the array might be of any value, including null. - */ - @Nullable - @JsonProperty("enum") - public List enumValue; - - /** - * The value of this keyword MAY be of any type, including null. - *
- * An instance validates successfully against this keyword if its value is equal to the value of the keyword. - */ - @Nullable - @JsonProperty("const") - public Object constValue; - /* Validation Keywords for Numeric Instances (number and integer) */ diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index a748d5a5..421d0619 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -256,7 +256,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -266,16 +265,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -297,13 +297,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -316,13 +316,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -398,7 +398,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -408,7 +407,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -430,13 +430,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -449,13 +449,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -563,13 +563,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -582,13 +582,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -710,13 +710,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -729,13 +729,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -882,13 +882,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -901,13 +901,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -983,7 +983,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -993,7 +992,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -1015,13 +1015,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1034,13 +1034,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1148,13 +1148,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1167,13 +1167,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1295,13 +1295,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1314,13 +1314,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1446,13 +1446,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1465,13 +1465,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1547,7 +1547,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1557,7 +1556,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -1579,13 +1579,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1598,13 +1598,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1712,13 +1712,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1731,13 +1731,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1859,13 +1859,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1878,13 +1878,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2102,22 +2102,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -2173,7 +2173,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2183,16 +2182,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2214,13 +2214,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2233,13 +2233,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2315,7 +2315,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2325,7 +2324,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2347,13 +2347,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2366,13 +2366,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2480,13 +2480,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2499,13 +2499,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2627,13 +2627,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2646,13 +2646,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2799,13 +2799,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2818,13 +2818,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2900,7 +2900,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2910,7 +2909,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2932,13 +2932,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2951,13 +2951,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3065,13 +3065,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3084,13 +3084,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3212,13 +3212,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3231,13 +3231,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3363,13 +3363,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3382,13 +3382,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3464,7 +3464,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -3474,7 +3473,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -3496,13 +3496,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3515,13 +3515,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3629,13 +3629,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3648,13 +3648,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3776,13 +3776,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3795,13 +3795,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4019,22 +4019,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -4120,16 +4120,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4260,16 +4260,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4399,16 +4399,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4569,16 +4569,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4709,16 +4709,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4848,16 +4848,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4957,16 +4957,16 @@ "components" : { "schemas" : { "Category" : { - "type" : "object", "properties" : { "id" : { - "type" : "integer", - "format" : "int64" + "format" : "int64", + "type" : "integer" }, "name" : { "type" : "string" } - } + }, + "type" : "object" }, "Tag" : { "schemaFormat" : "application/json", @@ -5128,7 +5128,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5138,16 +5137,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -5169,13 +5169,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5188,13 +5188,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5270,7 +5270,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5280,7 +5279,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -5302,13 +5302,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5321,13 +5321,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5435,13 +5435,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5454,13 +5454,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5582,13 +5582,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5601,13 +5601,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5754,13 +5754,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5773,13 +5773,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5855,7 +5855,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5865,7 +5864,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -5887,13 +5887,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5906,13 +5906,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6020,13 +6020,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6039,13 +6039,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6167,13 +6167,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6186,13 +6186,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6318,13 +6318,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6337,13 +6337,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6419,7 +6419,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -6429,7 +6428,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -6451,13 +6451,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6470,13 +6470,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6584,13 +6584,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6603,13 +6603,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6731,13 +6731,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6750,13 +6750,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6974,22 +6974,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -7045,7 +7045,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7055,16 +7054,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -7086,13 +7086,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7105,13 +7105,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7187,7 +7187,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7197,7 +7196,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -7219,13 +7219,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7238,13 +7238,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7352,13 +7352,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7371,13 +7371,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7499,13 +7499,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7518,13 +7518,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7671,13 +7671,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7690,13 +7690,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7772,7 +7772,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7782,7 +7781,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -7804,13 +7804,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7823,13 +7823,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7937,13 +7937,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7956,13 +7956,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8084,13 +8084,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -8103,13 +8103,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8235,13 +8235,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -8254,13 +8254,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8336,7 +8336,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -8346,7 +8345,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -8368,13 +8368,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -8387,13 +8387,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8501,13 +8501,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -8520,13 +8520,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8648,13 +8648,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -8667,13 +8667,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -8891,22 +8891,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -8992,16 +8992,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9132,16 +9132,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9271,16 +9271,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9441,16 +9441,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9581,16 +9581,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9720,16 +9720,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -9874,7 +9874,6 @@ "messages" : { "message 1" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -9884,16 +9883,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -9915,13 +9915,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -9934,13 +9934,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10016,7 +10016,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10026,7 +10025,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -10048,13 +10048,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10067,13 +10067,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10181,13 +10181,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10200,13 +10200,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10328,13 +10328,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10347,13 +10347,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10500,13 +10500,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10519,13 +10519,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10601,7 +10601,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10611,7 +10610,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -10633,13 +10633,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10652,13 +10652,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10766,13 +10766,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10785,13 +10785,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -10913,13 +10913,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -10932,13 +10932,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11064,13 +11064,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -11083,13 +11083,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11165,7 +11165,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -11175,7 +11174,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -11197,13 +11197,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -11216,13 +11216,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11330,13 +11330,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -11349,13 +11349,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11477,13 +11477,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -11496,13 +11496,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11774,16 +11774,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -11914,16 +11914,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -12010,7 +12010,6 @@ "messageTraits" : { "messageTrait 1" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -12020,7 +12019,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -12042,13 +12042,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -12061,13 +12061,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -12189,13 +12189,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -12208,13 +12208,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -12324,13 +12324,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -12343,13 +12343,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -12611,22 +12611,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -12658,16 +12658,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -12757,13 +12757,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -12776,13 +12776,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json index ee8b9769..980f7dd1 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json @@ -28,7 +28,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -38,16 +37,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -69,13 +69,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -88,13 +88,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -170,7 +170,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -180,7 +179,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -202,13 +202,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -221,13 +221,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -335,13 +335,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -354,13 +354,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -482,13 +482,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -501,13 +501,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -654,13 +654,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -673,13 +673,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -755,7 +755,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -765,7 +764,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -787,13 +787,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -806,13 +806,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -920,13 +920,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -939,13 +939,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1067,13 +1067,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1086,13 +1086,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1218,13 +1218,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1237,13 +1237,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1319,7 +1319,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1329,7 +1328,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -1351,13 +1351,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1370,13 +1370,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1484,13 +1484,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1503,13 +1503,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1631,13 +1631,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1650,13 +1650,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1874,22 +1874,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json index 26ba2e35..26a76ca4 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json @@ -28,7 +28,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -38,16 +37,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -69,13 +69,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -88,13 +88,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -170,7 +170,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -180,7 +179,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -202,13 +202,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -221,13 +221,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -335,13 +335,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -354,13 +354,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -482,13 +482,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -501,13 +501,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -654,13 +654,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -673,13 +673,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -755,7 +755,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -765,7 +764,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -787,13 +787,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -806,13 +806,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -920,13 +920,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -939,13 +939,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1067,13 +1067,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1086,13 +1086,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1218,13 +1218,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1237,13 +1237,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1319,7 +1319,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1329,7 +1328,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -1351,13 +1351,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1370,13 +1370,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1484,13 +1484,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1503,13 +1503,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1631,13 +1631,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1650,13 +1650,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1874,22 +1874,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json index b46b9cac..8d957300 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json @@ -1,6 +1,5 @@ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10,16 +9,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -41,13 +41,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -60,13 +60,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -142,7 +142,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -152,7 +151,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -174,13 +174,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -193,13 +193,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -307,13 +307,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -326,13 +326,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -454,13 +454,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -473,13 +473,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json index 02e8b9d8..259359b0 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json @@ -46,13 +46,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -65,13 +65,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -147,7 +147,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -157,7 +156,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -179,13 +179,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -198,13 +198,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -312,13 +312,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -331,13 +331,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -459,13 +459,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -478,13 +478,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json index d6e27026..e9cc1898 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json @@ -24,13 +24,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -43,13 +43,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -125,7 +125,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -135,7 +134,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -157,13 +157,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -176,13 +176,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -290,13 +290,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -309,13 +309,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -437,13 +437,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -456,13 +456,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json index bb367ffe..9b8b6659 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json @@ -1,6 +1,5 @@ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10,7 +9,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -32,13 +32,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -51,13 +51,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json index c2dd50c7..9b200c67 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json @@ -34,13 +34,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -53,13 +53,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json index 7bd1b597..4f57eafb 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json @@ -21,13 +21,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -40,13 +40,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index c78dc018..3cd4b8a4 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -1,16 +1,16 @@ { "schemas" : { "Category" : { - "type" : "object", "properties" : { "id" : { - "type" : "integer", - "format" : "int64" + "format" : "int64", + "type" : "integer" }, "name" : { "type" : "string" } - } + }, + "type" : "object" }, "Tag" : { "schemaFormat" : "application/json", @@ -172,7 +172,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -182,16 +181,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -213,13 +213,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -232,13 +232,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -314,7 +314,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -324,7 +323,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -346,13 +346,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -365,13 +365,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -479,13 +479,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -498,13 +498,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -626,13 +626,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -645,13 +645,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -798,13 +798,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -817,13 +817,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -899,7 +899,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -909,7 +908,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -931,13 +931,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -950,13 +950,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1064,13 +1064,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1083,13 +1083,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1211,13 +1211,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1230,13 +1230,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1362,13 +1362,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1381,13 +1381,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1463,7 +1463,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1473,7 +1472,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -1495,13 +1495,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1514,13 +1514,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1628,13 +1628,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1647,13 +1647,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -1775,13 +1775,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -1794,13 +1794,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2018,22 +2018,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -2089,7 +2089,6 @@ }, "message" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2099,16 +2098,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2130,13 +2130,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2149,13 +2149,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2231,7 +2231,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2241,7 +2240,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2263,13 +2263,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2282,13 +2282,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2396,13 +2396,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2415,13 +2415,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2543,13 +2543,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2562,13 +2562,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2715,13 +2715,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2734,13 +2734,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2816,7 +2816,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2826,7 +2825,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -2848,13 +2848,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -2867,13 +2867,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -2981,13 +2981,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3000,13 +3000,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3128,13 +3128,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3147,13 +3147,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3279,13 +3279,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3298,13 +3298,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3380,7 +3380,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -3390,7 +3389,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -3412,13 +3412,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3431,13 +3431,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3545,13 +3545,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3564,13 +3564,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3692,13 +3692,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -3711,13 +3711,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -3935,22 +3935,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -4036,16 +4036,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4176,16 +4176,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4315,16 +4315,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4485,16 +4485,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4625,16 +4625,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4764,16 +4764,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -4918,7 +4918,6 @@ "messages" : { "message 1" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -4928,16 +4927,17 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "payload" : { - "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -4959,13 +4959,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -4978,13 +4978,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5060,7 +5060,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5070,7 +5069,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -5092,13 +5092,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5111,13 +5111,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5225,13 +5225,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5244,13 +5244,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5372,13 +5372,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5391,13 +5391,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5544,13 +5544,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5563,13 +5563,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5645,7 +5645,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5655,7 +5654,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -5677,13 +5677,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5696,13 +5696,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5810,13 +5810,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5829,13 +5829,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -5957,13 +5957,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -5976,13 +5976,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6108,13 +6108,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6127,13 +6127,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6209,7 +6209,6 @@ } ], "traits" : [ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -6219,7 +6218,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -6241,13 +6241,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6260,13 +6260,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6374,13 +6374,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6393,13 +6393,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6521,13 +6521,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -6540,13 +6540,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6818,16 +6818,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -6958,16 +6958,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7054,7 +7054,6 @@ "messageTraits" : { "messageTrait 1" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7064,7 +7063,8 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - } + }, + "type" : "object" }, "correlationId" : { "description" : "Default Correlation ID", @@ -7086,13 +7086,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7105,13 +7105,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7233,13 +7233,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7252,13 +7252,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7368,13 +7368,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7387,13 +7387,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7655,22 +7655,22 @@ "ws" : { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" } @@ -7702,16 +7702,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -7801,13 +7801,13 @@ }, "anypointmq" : { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1" }, @@ -7820,13 +7820,13 @@ }, "http" : { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json index 3e489169..8a5cde61 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json @@ -54,16 +54,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -194,16 +194,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -333,16 +333,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json index a50dbc19..72923619 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json @@ -53,16 +53,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -193,16 +193,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, @@ -332,16 +332,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json index ba5c25b6..ba19ec9a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json @@ -50,16 +50,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json index 5e1d3d73..4cd705de 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json @@ -49,16 +49,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json index f0c5c5dc..f5e50f72 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json @@ -1,22 +1,22 @@ { "method" : "GET", "query" : { - "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - } + }, + "type" : "object" }, "headers" : { - "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json index 35dee45d..c1d0c443 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json @@ -1,12 +1,12 @@ { "headers" : { - "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - } + }, + "type" : "object" }, "bindingVersion" : "0.0.1", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json index 436e5391..bf5b150e 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json @@ -1,12 +1,12 @@ { "headers" : { - "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - } + }, + "type" : "object" }, "bindingVersion" : "0.1.0", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json index 70152613..608f1415 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json @@ -2,16 +2,16 @@ "type" : "request", "method" : "GET", "query" : { - "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { "description" : "The Id of the company.", - "type" : "number", - "minimum" : 1 + "minimum" : 1, + "type" : "number" } }, - "additionalProperties" : false + "additionalProperties" : false, + "type" : "object" }, "bindingVersion" : "0.1.0", "x-number" : 0, From 1144bd369ba21d2c94ccf4a18c844e9bab33a410 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 01:38:45 +0400 Subject: [PATCH 03/44] refactor(schemas): update JSON Schema Validation Keywords for Numeric Instances (number and integer) --- .../java/com/asyncapi/v3/schema/Schema.java | 113 ++++++++++-------- .../v3/3.0.0/model/asyncapi - extended.json | 60 +++++----- .../components/components - extended.json | 36 +++--- .../model/operation/operation - extended.json | 12 +- .../operation with reference - extended.json | 12 +- .../operation/operationTrait - extended.json | 4 +- ...rationTrait with reference - extended.json | 4 +- .../http/httpOperationBinding - extended.json | 4 +- 8 files changed, 130 insertions(+), 115 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index d1601844..898cb5d1 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -10,6 +10,7 @@ import lombok.*; import org.jetbrains.annotations.Nullable; +import javax.validation.constraints.Min; import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -138,6 +139,69 @@ public class Schema extends ExtendableObject { @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; + /* Schema Annotations @@ -311,55 +375,6 @@ as assertions (Section 3.2). While no special effort is required to Validation. */ - /* - Validation Keywords for Numeric Instances (number and integer) - */ - - /** - * The value of "multipleOf" MUST be a number, strictly greater than 0. - *
- * A numeric instance is valid only if division by this keyword's value results in an integer. - */ - @Nullable - @JsonProperty - public Number multipleOf; - - /** - * The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. - *
- * If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". - */ - @Nullable - @JsonProperty - public BigDecimal maximum; - - /** - * The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance. - *
- * If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". - */ - @Nullable - @JsonProperty - public BigDecimal exclusiveMaximum; - - /** - * The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. - *
- * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". - */ - @Nullable - @JsonProperty - public BigDecimal minimum; - - /** - * The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. - *
- * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". - */ - @Nullable - @JsonProperty - public BigDecimal exclusiveMinimum; - /* Validation Keywords for Strings */ diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index 421d0619..56a75920 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -4124,8 +4124,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4264,8 +4264,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4403,8 +4403,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4573,8 +4573,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4713,8 +4713,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4852,8 +4852,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -8996,8 +8996,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -9136,8 +9136,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -9275,8 +9275,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -9445,8 +9445,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -9585,8 +9585,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -9724,8 +9724,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -11778,8 +11778,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -11918,8 +11918,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -12662,8 +12662,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index 3cd4b8a4..e61e81aa 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -4040,8 +4040,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4180,8 +4180,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4319,8 +4319,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4489,8 +4489,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4629,8 +4629,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -4768,8 +4768,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -6822,8 +6822,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -6962,8 +6962,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -7706,8 +7706,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json index 8a5cde61..84a1c8be 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json @@ -58,8 +58,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -198,8 +198,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -337,8 +337,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json index 72923619..0b1d8b54 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json @@ -57,8 +57,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -197,8 +197,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, @@ -336,8 +336,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json index ba19ec9a..2e55b916 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json @@ -54,8 +54,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json index 4cd705de..121562da 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json @@ -53,8 +53,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json index 608f1415..0966386c 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json @@ -6,8 +6,8 @@ "properties" : { "companyId" : { "description" : "The Id of the company.", - "minimum" : 1, - "type" : "number" + "type" : "number", + "minimum" : 1 } }, "additionalProperties" : false, From f6660a97ab0f4d47cbaaa5a912b3861620486ff1 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 01:45:33 +0400 Subject: [PATCH 04/44] refactor(schemas): update JSON Schema Validation Keywords for Strings --- .../java/com/asyncapi/v3/schema/Schema.java | 93 +++++++++++-------- 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 898cb5d1..092d1227 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -202,6 +202,60 @@ Validation Keywords for Numeric Instances (number and integer) @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; + /* Schema Annotations @@ -375,45 +429,6 @@ as assertions (Section 3.2). While no special effort is required to Validation. */ - /* - Validation Keywords for Strings - */ - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. - *
- * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. - */ - @Nullable - @JsonProperty - public Integer maxLength; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. - *
- * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. - *
- * Omitting this keyword has the same behavior as a value of 0. - */ - @Nullable - @JsonProperty - public Integer minLength; - - /** - * The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according - * to the ECMA 262 regular expression dialect. - *
- * A string instance is considered valid if the regular expression matches the instance successfully. - * Recall: regular expressions are not implicitly anchored. - */ - @Nullable - @JsonProperty - public String pattern; - /* Validation Keywords for Arrays */ From 2753611be8b4aefdef5086ea32dfa679887298f5 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 01:56:25 +0400 Subject: [PATCH 05/44] refactor(schemas): update JSON Schema Validation Keywords for Arrays --- .../java/com/asyncapi/v3/schema/Schema.java | 173 ++++++++++-------- 1 file changed, 96 insertions(+), 77 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 092d1227..b916f269 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -256,6 +256,102 @@ Validation Keywords for Numeric Instances (number and integer) @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 = SchemaItemsDeserializer.class) + public Object items; + + /** + * The value of "additionalItems" MUST be a valid JSON Schema. + *

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

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

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

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

+ * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. + * + * @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 Schema contains; + /* Schema Annotations @@ -429,83 +525,6 @@ as assertions (Section 3.2). While no special effort is required to Validation. */ - /* - Validation Keywords for Arrays - */ - - /** - * The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. - *
- * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - *
- * If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. - *
- * If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same - * position, if any. - *
- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - @JsonDeserialize(using = SchemaItemsDeserializer.class) - public Object items; - - /** - * The value of "additionalItems" MUST be a valid JSON Schema. - *
- * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - *
- * If "items" is an array of schemas, validation succeeds if every instance element at a position greater than the size of "items" - * validates against "additionalItems". - *
- * Otherwise, "additionalItems" MUST be ignored, as the "items" schema (possibly the default value of an empty schema) is applied - * to all elements. - *
- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - public Schema additionalItems; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. - */ - @Nullable - @JsonProperty - public Integer maxItems; - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. - *
- * Omitting this keyword has the same behavior as a value of 0. - */ - @Nullable - @JsonProperty - public Integer minItems; - - /** - * The value of this keyword MUST be a boolean. - *
- * If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, - * the instance validates successfully if all of its elements are unique. - *
- * Omitting this keyword has the same behavior as a value of false. - */ - @Nullable - @JsonProperty - public Boolean uniqueItems; - - /** - * The value of this keyword MUST be a valid JSON Schema. - *
- * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. - */ - @Nullable - @JsonProperty - public Schema contains; - /* Validation Keywords for Objects */ From 862a4f3398977ae76c01de38883ce877b2305724 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 29 Mar 2024 02:27:18 +0400 Subject: [PATCH 06/44] refactor(schemas): update JSON Schema Validation Keywords for Objects --- .../java/com/asyncapi/v3/schema/Schema.java | 281 ++++--- .../v3/3.0.0/model/asyncapi - extended.json | 720 +++++++++--------- .../model/channel/channel - extended.json | 124 +-- .../channel with reference - extended.json | 124 +-- .../channel/message/message - extended.json | 44 +- .../channel/message/message 2 - extended.json | 36 +- .../message with reference - extended.json | 36 +- .../message/messageTrait - extended.json | 12 +- .../message/messageTrait 2 - extended.json | 8 +- ...essageTrait with reference - extended.json | 8 +- .../components/components - extended.json | 448 +++++------ .../model/operation/operation - extended.json | 12 +- .../operation with reference - extended.json | 12 +- .../operation/operationTrait - extended.json | 4 +- ...rationTrait with reference - extended.json | 4 +- .../webSocketsChannelBinding - extended.json | 8 +- .../anypointMQMessageBinding - extended.json | 4 +- .../http/httpMessageBinding - extended.json | 4 +- .../http/httpOperationBinding - extended.json | 4 +- 19 files changed, 963 insertions(+), 930 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index b916f269..fa54a041 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -352,6 +352,163 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("contains") public Schema contains; + /* + Validation Keywords for Objects + */ + + /** + * The value of this keyword MUST be a non-negative integer. + *

+ * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, + * the value of this keyword. + * + * @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 = SchemasAdditionalPropertiesDeserializer.class) + public Object additionalProperties; + + /** + * [CREF1] - This keyword may be split into two, with the variation that uses an array of property names rather than a + * subschema getting a new name. The dual behavior is confusing and relatively difficult to implement. In the previous + * draft, we proposed dropping the keyword altogether, or dropping one of its forms, but we received feedback in support of + * keeping it. See issues #442 and #528 at https://github.com/json-schema-org/json-schema-spec/issues for further discussion. + * Further feedback is encouraged. + *

+ *

+ *

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

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

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

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

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

+ * Omitting this keyword has the same behavior as an empty object. + * + * @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 Schema propertyNames; + /* Schema Annotations @@ -525,130 +682,6 @@ as assertions (Section 3.2). While no special effort is required to Validation. */ - /* - Validation Keywords for Objects - */ - - /** - * The value of this keyword MUST be a non-negative integer. - *
- * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, - * the value of this keyword. - */ - @Nullable - @JsonProperty - public Integer maxProperties; - - /** - * The value of this keyword MUST be a non-negative integer. - *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- * Omitting this keyword has the same behavior as an empty schema. - */ - @Nullable - @JsonProperty - public Schema propertyNames; - /* Keywords for Applying Subschemas Conditionally diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index 56a75920..51e854c2 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -256,6 +256,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -265,17 +266,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -297,13 +297,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -316,13 +316,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -398,6 +398,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -407,8 +408,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -430,13 +430,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -449,13 +449,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -563,13 +563,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -582,13 +582,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -710,13 +710,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -729,13 +729,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -882,13 +882,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -901,13 +901,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -983,6 +983,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -992,8 +993,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -1015,13 +1015,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1034,13 +1034,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1148,13 +1148,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1167,13 +1167,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1295,13 +1295,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1314,13 +1314,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1446,13 +1446,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1465,13 +1465,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1547,6 +1547,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1556,8 +1557,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -1579,13 +1579,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1598,13 +1598,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1712,13 +1712,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1731,13 +1731,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1859,13 +1859,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1878,13 +1878,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2102,22 +2102,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -2173,6 +2173,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2182,17 +2183,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2214,13 +2214,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2233,13 +2233,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2315,6 +2315,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2324,8 +2325,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2347,13 +2347,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2366,13 +2366,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2480,13 +2480,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2499,13 +2499,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2627,13 +2627,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2646,13 +2646,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2799,13 +2799,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2818,13 +2818,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2900,6 +2900,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2909,8 +2910,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2932,13 +2932,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2951,13 +2951,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3065,13 +3065,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3084,13 +3084,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3212,13 +3212,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3231,13 +3231,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3363,13 +3363,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3382,13 +3382,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3464,6 +3464,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -3473,8 +3474,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -3496,13 +3496,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3515,13 +3515,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3629,13 +3629,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3648,13 +3648,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3776,13 +3776,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3795,13 +3795,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -4019,22 +4019,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -4120,6 +4120,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4128,8 +4129,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4260,6 +4260,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4268,8 +4269,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4399,6 +4399,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4407,8 +4408,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4569,6 +4569,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4577,8 +4578,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4709,6 +4709,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4717,8 +4718,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4848,6 +4848,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4856,8 +4857,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4957,6 +4957,7 @@ "components" : { "schemas" : { "Category" : { + "type" : "object", "properties" : { "id" : { "format" : "int64", @@ -4965,8 +4966,7 @@ "name" : { "type" : "string" } - }, - "type" : "object" + } }, "Tag" : { "schemaFormat" : "application/json", @@ -5128,6 +5128,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5137,17 +5138,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -5169,13 +5169,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5188,13 +5188,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5270,6 +5270,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5279,8 +5280,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -5302,13 +5302,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5321,13 +5321,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5435,13 +5435,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5454,13 +5454,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5582,13 +5582,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5601,13 +5601,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5754,13 +5754,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5773,13 +5773,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5855,6 +5855,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5864,8 +5865,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -5887,13 +5887,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5906,13 +5906,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6020,13 +6020,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6039,13 +6039,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6167,13 +6167,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6186,13 +6186,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6318,13 +6318,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6337,13 +6337,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6419,6 +6419,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -6428,8 +6429,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -6451,13 +6451,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6470,13 +6470,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6584,13 +6584,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6603,13 +6603,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6731,13 +6731,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6750,13 +6750,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6974,22 +6974,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -7045,6 +7045,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7054,17 +7055,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -7086,13 +7086,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7105,13 +7105,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7187,6 +7187,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7196,8 +7197,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -7219,13 +7219,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7238,13 +7238,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7352,13 +7352,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7371,13 +7371,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7499,13 +7499,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7518,13 +7518,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7671,13 +7671,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7690,13 +7690,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7772,6 +7772,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7781,8 +7782,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -7804,13 +7804,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7823,13 +7823,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7937,13 +7937,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7956,13 +7956,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8084,13 +8084,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -8103,13 +8103,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8235,13 +8235,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -8254,13 +8254,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8336,6 +8336,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -8345,8 +8346,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -8368,13 +8368,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -8387,13 +8387,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8501,13 +8501,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -8520,13 +8520,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8648,13 +8648,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -8667,13 +8667,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -8891,22 +8891,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -8992,6 +8992,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9000,8 +9001,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9132,6 +9132,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9140,8 +9141,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9271,6 +9271,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9279,8 +9280,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9441,6 +9441,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9449,8 +9450,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9581,6 +9581,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9589,8 +9590,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9720,6 +9720,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -9728,8 +9729,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -9874,6 +9874,7 @@ "messages" : { "message 1" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -9883,17 +9884,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -9915,13 +9915,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -9934,13 +9934,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10016,6 +10016,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10025,8 +10026,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -10048,13 +10048,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10067,13 +10067,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10181,13 +10181,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10200,13 +10200,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10328,13 +10328,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10347,13 +10347,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10500,13 +10500,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10519,13 +10519,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10601,6 +10601,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -10610,8 +10611,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -10633,13 +10633,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10652,13 +10652,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10766,13 +10766,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10785,13 +10785,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -10913,13 +10913,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -10932,13 +10932,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -11064,13 +11064,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -11083,13 +11083,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -11165,6 +11165,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -11174,8 +11175,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -11197,13 +11197,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -11216,13 +11216,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -11330,13 +11330,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -11349,13 +11349,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -11477,13 +11477,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -11496,13 +11496,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -11774,6 +11774,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -11782,8 +11783,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -11914,6 +11914,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -11922,8 +11923,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -12010,6 +12010,7 @@ "messageTraits" : { "messageTrait 1" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -12019,8 +12020,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -12042,13 +12042,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -12061,13 +12061,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -12189,13 +12189,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -12208,13 +12208,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -12324,13 +12324,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -12343,13 +12343,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -12611,22 +12611,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -12658,6 +12658,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -12666,8 +12667,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -12757,13 +12757,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -12776,13 +12776,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json index 980f7dd1..ee8b9769 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json @@ -28,6 +28,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -37,17 +38,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -69,13 +69,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -88,13 +88,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -170,6 +170,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -179,8 +180,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -202,13 +202,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -221,13 +221,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -335,13 +335,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -354,13 +354,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -482,13 +482,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -501,13 +501,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -654,13 +654,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -673,13 +673,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -755,6 +755,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -764,8 +765,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -787,13 +787,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -806,13 +806,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -920,13 +920,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -939,13 +939,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1067,13 +1067,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1086,13 +1086,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1218,13 +1218,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1237,13 +1237,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1319,6 +1319,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1328,8 +1329,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -1351,13 +1351,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1370,13 +1370,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1484,13 +1484,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1503,13 +1503,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1631,13 +1631,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1650,13 +1650,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1874,22 +1874,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json index 26a76ca4..26ba2e35 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json @@ -28,6 +28,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -37,17 +38,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -69,13 +69,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -88,13 +88,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -170,6 +170,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -179,8 +180,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -202,13 +202,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -221,13 +221,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -335,13 +335,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -354,13 +354,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -482,13 +482,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -501,13 +501,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -654,13 +654,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -673,13 +673,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -755,6 +755,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -764,8 +765,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -787,13 +787,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -806,13 +806,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -920,13 +920,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -939,13 +939,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1067,13 +1067,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1086,13 +1086,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1218,13 +1218,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1237,13 +1237,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1319,6 +1319,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1328,8 +1329,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -1351,13 +1351,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1370,13 +1370,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1484,13 +1484,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1503,13 +1503,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1631,13 +1631,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1650,13 +1650,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1874,22 +1874,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json index 8d957300..b46b9cac 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json @@ -1,5 +1,6 @@ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -9,17 +10,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -41,13 +41,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -60,13 +60,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -142,6 +142,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -151,8 +152,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -174,13 +174,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -193,13 +193,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -307,13 +307,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -326,13 +326,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -454,13 +454,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -473,13 +473,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json index 259359b0..02e8b9d8 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json @@ -46,13 +46,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -65,13 +65,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -147,6 +147,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -156,8 +157,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -179,13 +179,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -198,13 +198,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -312,13 +312,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -331,13 +331,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -459,13 +459,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -478,13 +478,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json index e9cc1898..d6e27026 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json @@ -24,13 +24,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -43,13 +43,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -125,6 +125,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -134,8 +135,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -157,13 +157,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -176,13 +176,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -290,13 +290,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -309,13 +309,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -437,13 +437,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -456,13 +456,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json index 9b8b6659..bb367ffe 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json @@ -1,5 +1,6 @@ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -9,8 +10,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -32,13 +32,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -51,13 +51,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json index 9b200c67..c2dd50c7 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json @@ -34,13 +34,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -53,13 +53,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json index 4f57eafb..7bd1b597 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json @@ -21,13 +21,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -40,13 +40,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index e61e81aa..97bca058 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -1,6 +1,7 @@ { "schemas" : { "Category" : { + "type" : "object", "properties" : { "id" : { "format" : "int64", @@ -9,8 +10,7 @@ "name" : { "type" : "string" } - }, - "type" : "object" + } }, "Tag" : { "schemaFormat" : "application/json", @@ -172,6 +172,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -181,17 +182,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -213,13 +213,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -232,13 +232,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -314,6 +314,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -323,8 +324,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -346,13 +346,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -365,13 +365,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -479,13 +479,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -498,13 +498,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -626,13 +626,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -645,13 +645,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -798,13 +798,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -817,13 +817,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -899,6 +899,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -908,8 +909,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -931,13 +931,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -950,13 +950,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1064,13 +1064,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1083,13 +1083,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1211,13 +1211,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1230,13 +1230,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1362,13 +1362,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1381,13 +1381,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1463,6 +1463,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -1472,8 +1473,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -1495,13 +1495,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1514,13 +1514,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1628,13 +1628,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1647,13 +1647,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -1775,13 +1775,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -1794,13 +1794,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2018,22 +2018,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -2089,6 +2089,7 @@ }, "message" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2098,17 +2099,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2130,13 +2130,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2149,13 +2149,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2231,6 +2231,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2240,8 +2241,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2263,13 +2263,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2282,13 +2282,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2396,13 +2396,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2415,13 +2415,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2543,13 +2543,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2562,13 +2562,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2715,13 +2715,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2734,13 +2734,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2816,6 +2816,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -2825,8 +2826,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -2848,13 +2848,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -2867,13 +2867,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -2981,13 +2981,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3000,13 +3000,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3128,13 +3128,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3147,13 +3147,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3279,13 +3279,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3298,13 +3298,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3380,6 +3380,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -3389,8 +3390,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -3412,13 +3412,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3431,13 +3431,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3545,13 +3545,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3564,13 +3564,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3692,13 +3692,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -3711,13 +3711,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -3935,22 +3935,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -4036,6 +4036,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4044,8 +4045,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4176,6 +4176,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4184,8 +4185,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4315,6 +4315,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4323,8 +4324,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4485,6 +4485,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4493,8 +4494,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4625,6 +4625,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4633,8 +4634,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4764,6 +4764,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -4772,8 +4773,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -4918,6 +4918,7 @@ "messages" : { "message 1" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -4927,17 +4928,16 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "payload" : { + "type" : "object", "properties" : { "metric" : { "description" : "Metric set by application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -4959,13 +4959,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -4978,13 +4978,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5060,6 +5060,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5069,8 +5070,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -5092,13 +5092,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5111,13 +5111,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5225,13 +5225,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5244,13 +5244,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5372,13 +5372,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5391,13 +5391,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5544,13 +5544,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5563,13 +5563,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5645,6 +5645,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -5654,8 +5655,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -5677,13 +5677,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5696,13 +5696,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5810,13 +5810,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5829,13 +5829,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -5957,13 +5957,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -5976,13 +5976,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6108,13 +6108,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6127,13 +6127,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6209,6 +6209,7 @@ } ], "traits" : [ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -6218,8 +6219,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -6241,13 +6241,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6260,13 +6260,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6374,13 +6374,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6393,13 +6393,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6521,13 +6521,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -6540,13 +6540,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -6818,6 +6818,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -6826,8 +6827,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -6958,6 +6958,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -6966,8 +6967,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -7054,6 +7054,7 @@ "messageTraits" : { "messageTrait 1" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", @@ -7063,8 +7064,7 @@ "description" : "Unique identifier for a given instance of the publishing application", "type" : "string" } - }, - "type" : "object" + } }, "correlationId" : { "description" : "Default Correlation ID", @@ -7086,13 +7086,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7105,13 +7105,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7233,13 +7233,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7252,13 +7252,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7368,13 +7368,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7387,13 +7387,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, @@ -7655,22 +7655,22 @@ "ws" : { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" } @@ -7702,6 +7702,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -7710,8 +7711,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -7801,13 +7801,13 @@ }, "anypointmq" : { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1" }, @@ -7820,13 +7820,13 @@ }, "http" : { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json index 84a1c8be..3e489169 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json @@ -54,6 +54,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -62,8 +63,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -194,6 +194,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -202,8 +203,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -333,6 +333,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -341,8 +342,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json index 0b1d8b54..a50dbc19 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json @@ -53,6 +53,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -61,8 +62,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -193,6 +193,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -201,8 +202,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, @@ -332,6 +332,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -340,8 +341,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json index 2e55b916..ba5c25b6 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json @@ -50,6 +50,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -58,8 +59,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json index 121562da..5e1d3d73 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json @@ -49,6 +49,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -57,8 +58,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0" }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json index f5e50f72..f0c5c5dc 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json @@ -1,22 +1,22 @@ { "method" : "GET", "query" : { + "type" : "object", "properties" : { "ref" : { "description" : "Referral.", "type" : "string" } - }, - "type" : "object" + } }, "headers" : { + "type" : "object", "properties" : { "Authentication" : { "description" : "Authentication token", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json index c1d0c443..35dee45d 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json @@ -1,12 +1,12 @@ { "headers" : { + "type" : "object", "properties" : { "correlationId" : { "description" : "Correlation ID set by application", "type" : "string" } - }, - "type" : "object" + } }, "bindingVersion" : "0.0.1", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json index bf5b150e..436e5391 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/http/httpMessageBinding - extended.json @@ -1,12 +1,12 @@ { "headers" : { + "type" : "object", "properties" : { "Content-Type" : { "type" : "string", "enum" : [ "application/json" ] } - }, - "type" : "object" + } }, "bindingVersion" : "0.1.0", "x-number" : 0, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json index 0966386c..70152613 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json @@ -2,6 +2,7 @@ "type" : "request", "method" : "GET", "query" : { + "type" : "object", "required" : [ "companyId" ], "properties" : { "companyId" : { @@ -10,8 +11,7 @@ "minimum" : 1 } }, - "additionalProperties" : false, - "type" : "object" + "additionalProperties" : false }, "bindingVersion" : "0.1.0", "x-number" : 0, From 6b3dbbd985decf8d1fc88e684a704df07aa77bdb Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 00:28:06 +0400 Subject: [PATCH 07/44] refactor(schemas): update JSON Schema Keywords for Applying Subschemas Conditionally --- .../java/com/asyncapi/v3/schema/Schema.java | 118 ++++++++---------- 1 file changed, 51 insertions(+), 67 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index fa54a041..f48394fe 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -509,6 +509,57 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("propertyNames") public Schema 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 Schema ifValue; + + /** + * This keyword's value MUST be a valid JSON Schema. + *

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

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

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

+ * This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. + * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection + * purposes, in such cases. + */ + @Nullable + @JsonProperty("else") + public Schema elseValue; + /* Schema Annotations @@ -678,73 +729,6 @@ as assertions (Section 3.2). While no special effort is required to @JsonProperty private String contentMediaType; - /* - Validation. - */ - - /* - Keywords for Applying Subschemas Conditionally - - These keywords work together to implement conditional application of - a subschema based on the outcome of another subschema. - - These keywords MUST NOT interact with each other across subschema - boundaries. In other words, an "if" in one branch of an "allOf" MUST - NOT have an impact on a "then" or "else" in another branch. - - There is no default behavior for any of these keywords when they are - not present. In particular, they MUST NOT be treated as if present - with an empty schema, and when "if" is not present, both "then" and - "else" MUST be entirely ignored. - */ - - /** - * This keyword's value MUST be a valid JSON Schema. - *

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

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

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

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

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

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

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

- * This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. - * Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection - * purposes, in such cases. - */ - @JsonProperty("else") - @Nullable - public Schema elseValue; - /* Keywords for Applying Subschemas With Boolean Logic */ From 5c06bb0255793c03c2d1d9c6628eef66cf272eab Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 00:32:47 +0400 Subject: [PATCH 08/44] refactor(schemas): update JSON Schema String-Encoding Non-JSON Data --- .../java/com/asyncapi/v3/schema/Schema.java | 91 ++++++++----------- 1 file changed, 37 insertions(+), 54 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index f48394fe..b07ef898 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -560,6 +560,43 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("else") public Schema elseValue; + /* + 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 + 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 + private String contentMediaType; + /* Schema Annotations @@ -675,60 +712,6 @@ information for documentation and user interface display purposes. @JsonProperty public List examples; - /* - String-Encoding Non-JSON Data - - Foreword - - Properties defined in this section indicate that an instance contains - non-JSON data encoded in a JSON string. They describe the type of - content and how it is encoded. - - These properties provide additional information required to interpret - JSON data as rich multimedia documents. - - Implementation Requirements - - The content keywords function as both annotations (Section 3.3) and - as assertions (Section 3.2). While no special effort is required to - implement them as annotations conveying how applications can - interpret the data in the string, implementing validation of - conformance to the media type and encoding is non-trivial. - - Implementations MAY support the "contentMediaType" and - "contentEncoding" keywords as validation assertions. Should they - choose to do so, they SHOULD offer an option to disable validation - for these keywords. - */ - - /** - * If the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and - * decoded using the encoding named by this property. RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property. - *

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

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

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

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

- * If the "contentEncoding" property is not present, but the instance value is a string, then the value of this property SHOULD specify a - * text document type, and the character set SHOULD be the character set into which the JSON string value was decoded (for which the default - * is Unicode). - */ - @Nullable - @JsonProperty - private String contentMediaType; - /* Keywords for Applying Subschemas With Boolean Logic */ From d4ed60d2a638b1408f04ca4f2e0118a5b03ca336 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 00:43:01 +0400 Subject: [PATCH 09/44] refactor(schemas): update JSON Schema Schema Re-Use With "definitions" --- .../java/com/asyncapi/v3/schema/Schema.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index b07ef898..4a7c0043 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -597,6 +597,40 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty 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 From acd17893ea7bb4cc42df18d3dda95af2215ab8da Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:28:51 +0400 Subject: [PATCH 10/44] refactor(schemas): update JSON Schema Schema Annotations --- .../java/com/asyncapi/v3/schema/Schema.java | 123 ++-- .../v3/3.0.0/model/asyncapi - extended.json | 544 +++++++++--------- .../model/channel/channel - extended.json | 92 +-- .../channel with reference - extended.json | 92 +-- .../channel/message/message - extended.json | 36 +- .../channel/message/message 2 - extended.json | 24 +- .../message with reference - extended.json | 24 +- .../message/messageTrait - extended.json | 12 +- .../message/messageTrait 2 - extended.json | 4 +- ...essageTrait with reference - extended.json | 4 +- .../components/components - extended.json | 336 +++++------ .../model/operation/operation - extended.json | 12 +- .../operation with reference - extended.json | 12 +- .../operation/operationTrait - extended.json | 4 +- ...rationTrait with reference - extended.json | 4 +- .../webSocketsChannelBinding - extended.json | 8 +- .../anypointMQMessageBinding - extended.json | 4 +- .../http/httpOperationBinding - extended.json | 4 +- 18 files changed, 672 insertions(+), 667 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 4a7c0043..fc3264e7 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -633,117 +633,122 @@ Validation Keywords for Numeric Instances (number and integer) /* Schema Annotations - - Schema validation is a useful mechanism for annotating instance data - with additional information. The rules for determining when and how - annotations are associated with an instance are outlined in section - 3.3. - - These general-purpose annotation keywords provide commonly used - information for documentation and user interface display purposes. - They are not intended to form a comprehensive set of features. - Rather, additional vocabularies can be defined for more complex - annotation-based applications. */ /** - * The value of these keyword MUST be a string. - *

+ * 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 + @JsonProperty("title") public String title; /** - * The value of these keyword MUST be a string. - *

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

+ * 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 + @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. - *

+ * There are no restrictions placed on the value of this keyword. + * When multiple occurrences of this keyword are applicable to a single sub-instance, + * implementations SHOULD remove duplicates. + *

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

- * This property definition was adjusted to the AsyncAPI Specification. - * The default value represents what would be assumed by the consumer of the input as the value of the schema if one - * is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at - * the same level. For example, of type is string, then default can be "foo" but cannot be 1. + *

+ * 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. - *

+ * 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 + *

+ * 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 + *

+ * 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 + @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. - *

+ * 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 + *

+ * 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 + @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 + * 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. + * 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 + @JsonProperty("examples") public List examples; /* diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index 51e854c2..68237819 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -259,12 +259,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -272,8 +272,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -300,8 +300,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -401,12 +401,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -433,8 +433,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -566,8 +566,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -713,8 +713,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -885,8 +885,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -986,12 +986,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1018,8 +1018,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1151,8 +1151,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1298,8 +1298,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1449,8 +1449,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1550,12 +1550,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1582,8 +1582,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1715,8 +1715,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1862,8 +1862,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2105,8 +2105,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -2114,8 +2114,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -2176,12 +2176,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2189,8 +2189,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -2217,8 +2217,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2318,12 +2318,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2350,8 +2350,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2483,8 +2483,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2630,8 +2630,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2802,8 +2802,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2903,12 +2903,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2935,8 +2935,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3068,8 +3068,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3215,8 +3215,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3366,8 +3366,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3467,12 +3467,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -3499,8 +3499,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3632,8 +3632,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3779,8 +3779,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -4022,8 +4022,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -4031,8 +4031,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -4124,9 +4124,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4264,9 +4264,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4403,9 +4403,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4573,9 +4573,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4713,9 +4713,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4852,9 +4852,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -5131,12 +5131,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5144,8 +5144,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -5172,8 +5172,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5273,12 +5273,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5305,8 +5305,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5438,8 +5438,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5585,8 +5585,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5757,8 +5757,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5858,12 +5858,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5890,8 +5890,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6023,8 +6023,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6170,8 +6170,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6321,8 +6321,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6422,12 +6422,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -6454,8 +6454,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6587,8 +6587,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6734,8 +6734,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6977,8 +6977,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -6986,8 +6986,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -7048,12 +7048,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7061,8 +7061,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -7089,8 +7089,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7190,12 +7190,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7222,8 +7222,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7355,8 +7355,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7502,8 +7502,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7674,8 +7674,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7775,12 +7775,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7807,8 +7807,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7940,8 +7940,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8087,8 +8087,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8238,8 +8238,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8339,12 +8339,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -8371,8 +8371,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8504,8 +8504,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8651,8 +8651,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -8894,8 +8894,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -8903,8 +8903,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -8996,9 +8996,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9136,9 +9136,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9275,9 +9275,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9445,9 +9445,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9585,9 +9585,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9724,9 +9724,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -9877,12 +9877,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -9890,8 +9890,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -9918,8 +9918,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10019,12 +10019,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -10051,8 +10051,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10184,8 +10184,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10331,8 +10331,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10503,8 +10503,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10604,12 +10604,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -10636,8 +10636,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10769,8 +10769,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -10916,8 +10916,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11067,8 +11067,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11168,12 +11168,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -11200,8 +11200,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11333,8 +11333,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11480,8 +11480,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -11778,9 +11778,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -11918,9 +11918,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -12013,12 +12013,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -12045,8 +12045,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12192,8 +12192,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12327,8 +12327,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -12614,8 +12614,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -12623,8 +12623,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -12662,9 +12662,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -12760,8 +12760,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json index ee8b9769..8dfec121 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json @@ -31,12 +31,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -72,8 +72,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -173,12 +173,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -205,8 +205,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -338,8 +338,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -485,8 +485,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -657,8 +657,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -758,12 +758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -790,8 +790,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -923,8 +923,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1070,8 +1070,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1221,8 +1221,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1322,12 +1322,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1354,8 +1354,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1487,8 +1487,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1634,8 +1634,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1877,8 +1877,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -1886,8 +1886,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json index 26ba2e35..3987e55b 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json @@ -31,12 +31,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -72,8 +72,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -173,12 +173,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -205,8 +205,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -338,8 +338,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -485,8 +485,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -657,8 +657,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -758,12 +758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -790,8 +790,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -923,8 +923,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1070,8 +1070,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1221,8 +1221,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1322,12 +1322,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1354,8 +1354,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1487,8 +1487,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1634,8 +1634,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1877,8 +1877,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -1886,8 +1886,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json index b46b9cac..24bd16f1 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json @@ -3,12 +3,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -16,8 +16,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -44,8 +44,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -145,12 +145,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -177,8 +177,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -310,8 +310,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -457,8 +457,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json index 02e8b9d8..60830214 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json @@ -49,8 +49,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -150,12 +150,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -182,8 +182,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -315,8 +315,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -462,8 +462,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json index d6e27026..57740845 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json @@ -27,8 +27,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -128,12 +128,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -160,8 +160,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -293,8 +293,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -440,8 +440,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json index bb367ffe..df3c310d 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait - extended.json @@ -3,12 +3,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -35,8 +35,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json index c2dd50c7..2a93f9e3 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json @@ -37,8 +37,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json index 7bd1b597..13f3cffc 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait with reference - extended.json @@ -24,8 +24,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index 97bca058..d60e022d 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -175,12 +175,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -188,8 +188,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -216,8 +216,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -317,12 +317,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -349,8 +349,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -482,8 +482,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -801,8 +801,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -902,12 +902,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -934,8 +934,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1067,8 +1067,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1214,8 +1214,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1365,8 +1365,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1466,12 +1466,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -1498,8 +1498,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1631,8 +1631,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -1778,8 +1778,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2021,8 +2021,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -2030,8 +2030,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -2092,12 +2092,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2105,8 +2105,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -2133,8 +2133,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2234,12 +2234,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2266,8 +2266,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2399,8 +2399,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2546,8 +2546,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2718,8 +2718,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2819,12 +2819,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -2851,8 +2851,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -2984,8 +2984,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3131,8 +3131,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3282,8 +3282,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3383,12 +3383,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -3415,8 +3415,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3548,8 +3548,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3695,8 +3695,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -3938,8 +3938,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -3947,8 +3947,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -4040,9 +4040,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4180,9 +4180,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4319,9 +4319,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4489,9 +4489,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4629,9 +4629,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4768,9 +4768,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -4921,12 +4921,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -4934,8 +4934,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } }, @@ -4962,8 +4962,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5063,12 +5063,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5095,8 +5095,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5228,8 +5228,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5375,8 +5375,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5547,8 +5547,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5648,12 +5648,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -5680,8 +5680,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5813,8 +5813,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -5960,8 +5960,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6111,8 +6111,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6212,12 +6212,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -6244,8 +6244,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6377,8 +6377,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6524,8 +6524,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -6822,9 +6822,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -6962,9 +6962,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -7057,12 +7057,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } }, @@ -7089,8 +7089,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7236,8 +7236,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7371,8 +7371,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, @@ -7658,8 +7658,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -7667,8 +7667,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, @@ -7706,9 +7706,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -7804,8 +7804,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json index 3e489169..76102126 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation - extended.json @@ -58,9 +58,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -198,9 +198,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -337,9 +337,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json index a50dbc19..6526f625 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operation with reference - extended.json @@ -57,9 +57,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -197,9 +197,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false @@ -336,9 +336,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json index ba5c25b6..b12fa47a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait - extended.json @@ -54,9 +54,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json index 5e1d3d73..4cb84973 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/operation/operationTrait with reference - extended.json @@ -53,9 +53,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false diff --git a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json index f0c5c5dc..cc6e6930 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/channel/ws/webSocketsChannelBinding - extended.json @@ -4,8 +4,8 @@ "type" : "object", "properties" : { "ref" : { - "description" : "Referral.", - "type" : "string" + "type" : "string", + "description" : "Referral." } } }, @@ -13,8 +13,8 @@ "type" : "object", "properties" : { "Authentication" : { - "description" : "Authentication token", - "type" : "string" + "type" : "string", + "description" : "Authentication token" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json index 35dee45d..e137e19d 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/message/anypointmq/anypointMQMessageBinding - extended.json @@ -3,8 +3,8 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" } } }, diff --git a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json index 70152613..4b10d04b 100644 --- a/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/binding/operation/http/httpOperationBinding - extended.json @@ -6,9 +6,9 @@ "required" : [ "companyId" ], "properties" : { "companyId" : { - "description" : "The Id of the company.", "type" : "number", - "minimum" : 1 + "minimum" : 1, + "description" : "The Id of the company." } }, "additionalProperties" : false From 4f83aab2c2f6375e6fbf5cac35c61858dec3ff9f Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:30:02 +0400 Subject: [PATCH 11/44] refactor(schemas): update JSON Schema remove AsyncAPI properties --- .../java/com/asyncapi/v3/schema/Schema.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index fc3264e7..81b29218 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -807,31 +807,4 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty public Object format; - /* - In addition to the JSON Schema fields, the following AsyncAPI vocabulary fields MAY be used for further schema documentation: - */ - /** - * Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between - * other schema that inherit this schema. - *

- * The property name used MUST be defined at this schema and it MUST be in the required property list. - * When used, the value MUST be the name of this schema or any schema that inherits it. See Composition and Inheritance for more details. - */ - @Nullable - @JsonProperty - public String discriminator; - /** - * Additional external documentation for this schema. - */ - @Nullable - @JsonProperty - public ExternalDocumentation externalDocs; - - /** - * Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. - */ - @Nullable - @JsonProperty - public Boolean deprecated; - } From 39c346247bd793e15f0460aff6478c6086012b45 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:34:20 +0400 Subject: [PATCH 12/44] refactor(schemas): update JSON Schema Semantic Validation With "format" --- .../java/com/asyncapi/v3/schema/Schema.java | 17 ++++++++++------- .../v3/3.0.0/model/asyncapi - extended.json | 4 ++-- .../model/components/components - extended.json | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 81b29218..72de9d1b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -794,17 +794,20 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty public Schema not; - // Fields defined in AsyncAPI below - /* - The following properties are taken from the JSON Schema definition but their definitions were adjusted to the AsyncAPI Specification. + Semantic Validation With "format" */ + /** - * See Data Type Formats for further details. - * While relying on JSON Schema's defined formats, the AsyncAPI Specification offers a few additional predefined formats. + * 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 - public Object format; + @JsonProperty("format") + public String format; } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index 68237819..023e3710 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -4960,8 +4960,8 @@ "type" : "object", "properties" : { "id" : { - "format" : "int64", - "type" : "integer" + "type" : "integer", + "format" : "int64" }, "name" : { "type" : "string" diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index d60e022d..91ac9c2d 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -4,8 +4,8 @@ "type" : "object", "properties" : { "id" : { - "format" : "int64", - "type" : "integer" + "type" : "integer", + "format" : "int64" }, "name" : { "type" : "string" From bf4c0997861e8cb540cc7a40d30865ba8813bc1c Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:38:37 +0400 Subject: [PATCH 13/44] refactor(schemas): update JSON Schema Keywords for Applying Subschemas With Boolean Logic --- .../java/com/asyncapi/v3/schema/Schema.java | 100 ++++++++++-------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 72de9d1b..938874b3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -560,6 +560,63 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("else") public Schema elseValue; + /* + Keywords for Applying Subschemas With Boolean Logic + */ + + /** + * This keyword's value MUST be a non-empty array. + *

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

+ * An instance validates successfully against this keyword if it validates successfully against all schemas defined + * by this keyword's value. + * + * @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 Schema not; + /* String-Encoding Non-JSON Data */ @@ -751,49 +808,6 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("examples") public List examples; - /* - Keywords for Applying Subschemas With Boolean Logic - */ - - /** - * This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. - *

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

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

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

- * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. - */ - @Nullable - @JsonProperty - public Schema not; - /* Semantic Validation With "format" */ From b317bbabdd8e99f5c2be2f7968dced8d13ccf696 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:39:26 +0400 Subject: [PATCH 14/44] refactor(schemas): update JSON Schema Semantic Validation With "format" --- .../java/com/asyncapi/v3/schema/Schema.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 938874b3..4e76a4b3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -617,6 +617,22 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("not") public Schema 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 */ @@ -808,20 +824,4 @@ Validation Keywords for Numeric Instances (number and integer) @JsonProperty("examples") public List examples; - /* - 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; - } From 4cfc67f57157af6b1500ff8101595d2a14ecc989 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:39:47 +0400 Subject: [PATCH 15/44] refactor(schemas): update JSON Schema String-Encoding Non-JSON Data --- .../src/main/java/com/asyncapi/v3/schema/Schema.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 4e76a4b3..9e0d3c0b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -649,7 +649,7 @@ Validation Keywords for Numeric Instances (number and integer) * @see contentEncoding */ @Nullable - @JsonProperty + @JsonProperty("contentEncoding") private String contentEncoding; /** @@ -667,7 +667,7 @@ Validation Keywords for Numeric Instances (number and integer) * @see contentMediaType */ @Nullable - @JsonProperty + @JsonProperty("contentMediaType") private String contentMediaType; /* From 39019992a94959973479b895a5c279ba1d8b87c1 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 01:42:44 +0400 Subject: [PATCH 16/44] refactor(schemas): JSON Schema Draft 07 --- .../main/java/com/asyncapi/v3/schema/Schema.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java index 9e0d3c0b..1d2a6cf7 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/Schema.java @@ -3,7 +3,6 @@ import com.asyncapi.v3.jackson.SchemaItemsDeserializer; import com.asyncapi.v3.ExtendableObject; import com.asyncapi.v3.jackson.schema.SchemasAdditionalPropertiesDeserializer; -import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -15,21 +14,8 @@ import java.util.List; import java.util.Map; -// TODO: Finish. Not all properties are present. -// TODO: Write tests - /** - * The Schema Object allows the definition of input and output data types. These types can be objects, - * but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 07. - *
- * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. - * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. - *

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

- * New properties may appear in this class after community requests. + * JSON Schema Draft 07 * * @see Draft 07 JSON Schema * @see Draft 07 JSON Schema Validation From 09393d87d50c7d97e9dda0b4fb6201d89ef2083a Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sun, 31 Mar 2024 02:26:31 +0400 Subject: [PATCH 17/44] refactor(schemas): split Schema to Json and AsyncAPI Schemas --- .../message/MessageHeadersDeserializer.java | 6 +- .../message/MessagePayloadDeserializer.java | 6 +- .../ComponentsSchemasDeserializer.java | 6 +- .../_0_0/model/channel/message/Message.java | 8 +- .../model/channel/message/MessageTrait.java | 4 +- .../v3/_0_0/model/component/Components.java | 6 +- .../channel/ws/WebSocketsChannelBinding.java | 6 +- .../anypointmq/AnypointMQMessageBinding.java | 4 +- .../message/http/HTTPMessageBinding.java | 4 +- .../message/kafka/KafkaMessageBinding.java | 4 +- .../operation/http/HTTPOperationBinding.java | 4 +- .../kafka/KafkaOperationBinding.java | 6 +- .../v3/jackson/SchemaItemsDeserializer.java | 7 +- ...hemaAdditionalPropertiesDeserializer.java} | 6 +- .../AsyncAPISchemaItemsDeserializer.java | 23 + .../schema/JsonSchemaItemsDeserializer.java | 12 + .../asyncapi/v3/schema/AsyncAPISchema.java | 867 ++++++++++++++++++ .../schema/{Schema.java => JsonSchema.java} | 46 +- .../asyncapi/v3/schema/MultiFormatSchema.java | 6 +- .../v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt | 44 +- .../examples/v3/_0_0/AnyOfAsyncAPI.kt | 16 +- .../v3/_0_0/ApplicationHeadersAsyncAPI.kt | 20 +- .../examples/v3/_0_0/CorrelationIdAsyncAPI.kt | 16 +- .../v3/_0_0/GitterStreamingAsyncAPI.kt | 14 +- ...equestReplyMessageFilterInReplyAsyncAPI.kt | 144 +-- ...ketRequestReplyMultipleChannelsAsyncAPI.kt | 144 +-- .../examples/v3/_0_0/MercureAsyncAPI.kt | 14 +- .../asyncapi/examples/v3/_0_0/NotAsyncAPI.kt | 8 +- .../examples/v3/_0_0/OneOfAsyncAPI.kt | 16 +- .../v3/_0_0/OperationSecurityAsyncAPI.kt | 46 +- .../examples/v3/_0_0/RpcClientAsyncAPI.kt | 12 +- .../examples/v3/_0_0/RpcServerAsyncAPI.kt | 12 +- .../examples/v3/_0_0/SimpleAsyncAPI.kt | 8 +- .../examples/v3/_0_0/SlackRtmAsyncAPI.kt | 530 +++++------ .../v3/_0_0/StreetlightsKafkaAsyncAPI.kt | 28 +- .../v3/_0_0/StreetlightsMQTTAsyncAPI.kt | 26 +- .../StreetlightsOperationSecurityAsyncAPI.kt | 28 +- .../v3/_0_0/WebsocketGeminiAsyncAPI.kt | 66 +- .../_0_0/model/channel/message/MessageTest.kt | 12 +- .../model/channel/message/MessageTraitTest.kt | 8 +- .../message/MessageWithArrayPayloadTest.kt | 10 +- .../v3/_0_0/model/component/ComponentsTest.kt | 8 +- .../ws/WebSocketsChannelBindingTest.kt | 10 +- .../AnypointMQMessageBindingTest.kt | 6 +- .../message/http/HTTPMessageBindingTest.kt | 6 +- .../message/kafka/KafkaMessageBindingTest.kt | 4 +- .../http/HTTPOperationBindingTest.kt | 6 +- .../kafka/KafkaOperationBindingTest.kt | 6 +- 48 files changed, 1599 insertions(+), 700 deletions(-) rename asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/{SchemasAdditionalPropertiesDeserializer.java => AsyncAPISchemaAdditionalPropertiesDeserializer.java} (84%) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaItemsDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaItemsDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/{Schema.java => JsonSchema.java} (96%) 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()) From 30f86e197311c738ec08fe09bb17be4e351d15d0 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 2 Apr 2024 02:31:15 +0400 Subject: [PATCH 18/44] fix(json-schema): defaultValue, properties, constValue now can have any value + tests --- .../JsonSchemaAnyValueDeserializer.java | 79 +++++ .../JsonSchemaPropertiesDeserializer.java | 36 +++ .../com/asyncapi/v3/schema/JsonSchema.java | 7 +- .../com/asyncapi/v3/schema/ReadSchemaTest.kt | 32 ++ .../v3/schema/json/ArraysSchemaTest.kt | 52 ++++ .../v3/schema/json/ComplexObjectTest.kt | 63 ++++ .../json/ConditionalValidationIfElse.kt | 62 ++++ .../com/asyncapi/v3/schema/json/ConstTest.kt | 227 ++++++++++++++ .../asyncapi/v3/schema/json/DefaultTest.kt | 230 ++++++++++++++ .../json/Draft07CoreSchemaMetaSchemaTest.kt | 292 ++++++++++++++++++ .../v3/schema/json/EnumeratedValuesTest.kt | 29 ++ .../com/asyncapi/v3/schema/json/PersonTest.kt | 40 +++ .../v3/schema/json/RegexPatternTest.kt | 28 ++ .../json/v3/schema/json/arrays.schema.json | 34 ++ .../v3/schema/json/complex-object.schema.json | 41 +++ ...conditional-validation-if-else.schema.json | 39 +++ .../json/v3/schema/json/const/bigdecimal.json | 11 + .../json/v3/schema/json/const/biginteger.json | 11 + .../json/v3/schema/json/const/boolean.json | 8 + .../json/v3/schema/json/const/double.json | 11 + .../json/v3/schema/json/const/float.json | 11 + .../json/v3/schema/json/const/int.json | 11 + .../json/v3/schema/json/const/null.json | 5 + .../json/v3/schema/json/const/object.json | 8 + .../v3/schema/json/default/bigdecimal.json | 11 + .../v3/schema/json/default/biginteger.json | 11 + .../json/v3/schema/json/default/boolean.json | 8 + .../json/v3/schema/json/default/double.json | 11 + .../json/v3/schema/json/default/float.json | 11 + .../json/v3/schema/json/default/int.json | 11 + .../json/v3/schema/json/default/null.json | 5 + .../json/v3/schema/json/default/object.json | 8 + .../draft-07-core-schema-meta-schema.json | 172 +++++++++++ .../schema/json/enumerated-values.schema.json | 11 + .../json/v3/schema/json/person.schema.json | 21 ++ .../v3/schema/json/regex-pattern.schema.json | 12 + 36 files changed, 1658 insertions(+), 1 deletion(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java new file mode 100644 index 00000000..4f64e333 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java @@ -0,0 +1,79 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.JsonSchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +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.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Pavel Bodiachevskii + */ +public class JsonSchemaAnyValueDeserializer extends JsonDeserializer { + + @Override + public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsList((ArrayNode) jsonNode, objectCodec); + case BOOLEAN: + return jsonNode.asBoolean(); + case NUMBER: + return jsonParser.readValueAs(Number.class); + case OBJECT: + return jsonParser.readValueAs(JsonSchema.class); + case STRING: + return jsonParser.readValueAs(String.class); + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + List list = new ArrayList<>(); + for (JsonNode childNode : arrayNode) { + list.add(chooseKnownPojo(childNode, objectCodec)); + } + + return list; + } + + private Number readNumber(JsonNode jsonNode, JsonParser jsonParser) throws IOException { + if (jsonNode.isBigDecimal()) { + return jsonParser.readValueAs(BigDecimal.class); + } + + if (jsonNode.isBigInteger()) { + return jsonParser.readValueAs(BigInteger.class); + } + + return jsonParser.readValueAs(Number.class); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java new file mode 100644 index 00000000..71402943 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaPropertiesDeserializer.java @@ -0,0 +1,36 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.JsonSchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; + +/** + * @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) + * @author GraviteeSource Team + */ +public class JsonSchemaPropertiesDeserializer extends JsonDeserializer { + + @Override + public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + if (jsonNode.isBoolean()) { + return jsonNode.asBoolean(); + } else { + return jsonParser.readValueAs(JsonSchema.class); + } + } + } +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java index 426d7671..fd24a5a3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java @@ -1,6 +1,8 @@ package com.asyncapi.v3.schema; +import com.asyncapi.v3.jackson.schema.JsonSchemaAnyValueDeserializer; import com.asyncapi.v3.jackson.schema.JsonSchemaItemsDeserializer; +import com.asyncapi.v3.jackson.schema.JsonSchemaPropertiesDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -123,6 +125,7 @@ public class JsonSchema { @Nullable @JsonProperty("const") @JsonPropertyDescription("JSON Schema const value") + @JsonDeserialize(using = JsonSchemaAnyValueDeserializer.class) public Object constValue; /* @@ -404,7 +407,8 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("properties") - public Map properties; + @JsonDeserialize(contentUsing = JsonSchemaPropertiesDeserializer.class) + public Map properties; /** * The value of "patternProperties" MUST be an object. @@ -731,6 +735,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("default") + @JsonDeserialize(using = JsonSchemaAnyValueDeserializer.class) public Object defaultValue; /** diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt new file mode 100644 index 00000000..0439ae6c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt @@ -0,0 +1,32 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.ClasspathUtils +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +abstract class ReadSchemaTest { + + protected val objectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + protected abstract fun schemaClass(): Class + + protected abstract fun schemaToReadPath(): String + + protected abstract fun buildSchema(): SchemaType + + @Test + @DisplayName("Read: compare hand crafted schema with parsed schema") + fun compareObjectWithParsedJson() { + val model = ClasspathUtils.readAsString(schemaToReadPath()) + + Assertions.assertEquals( + objectMapper.readValue(model, schemaClass()), + buildSchema() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt new file mode 100644 index 00000000..d60a00ca --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt @@ -0,0 +1,52 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest + +class ArraysSchemaTest: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/arrays.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/arrays.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .description("A representation of a person, company, organization, or place") + .type("object") + .properties(mapOf( + Pair("fruits", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), + Pair("vegetables", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().ref("#/definitions/veggie").build()) + .build() + ) + )) + .definitions(mapOf( + Pair("veggie", JsonSchema.builder() + .type("object") + .required(listOf("veggieName", "veggieLike")) + .properties(mapOf( + Pair("veggieName", JsonSchema.builder() + .type("string") + .description("The name of the vegetable.") + .build() + ), + Pair("veggieLike", JsonSchema.builder() + .type("boolean") + .description("Do I like this vegetable?") + .build() + ) + )) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt new file mode 100644 index 00000000..4af01d04 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt @@ -0,0 +1,63 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest +import java.math.BigDecimal + +class ComplexObjectTest: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/complex-object.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/complex-object.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Complex Object") + .type("object") + .properties(mapOf( + Pair("name", JsonSchema.builder() + .type("string") + .build() + ), + Pair("age", JsonSchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("address", JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("street", JsonSchema.builder() + .type("string") + .build() + ), + Pair("city", JsonSchema.builder() + .type("string") + .build() + ), + Pair("state", JsonSchema.builder() + .type("string") + .build() + ), + Pair("postalCode", JsonSchema.builder() + .type("string") + .pattern("\\d{5}") + .build() + ) + )) + .required(listOf("street", "city", "state", "postalCode")) + .build() + ), + Pair("hobbies", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), + )) + .required(listOf("name", "age")) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt new file mode 100644 index 00000000..af3887c5 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest + +class ConditionalValidationIfElse: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/conditional-validation-if-else.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/conditional-validation-if-else.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Conditional Validation with If-Else") + .type("object") + .properties(mapOf( + Pair("isMember", JsonSchema.builder() + .type("boolean") + .build() + ), + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .build() + ) + )) + .required(listOf("isMember")) + .ifValue(JsonSchema.builder() + .properties(mapOf( + Pair("isMember", JsonSchema.builder() + .constValue(true) + .build() + ), + )) + .build() + ) + .thenValue(JsonSchema.builder() + .properties(mapOf( + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .minLength(10) + .maxLength(10) + .build() + ), + )) + .build() + ) + .elseValue(JsonSchema.builder() + .properties(mapOf( + Pair("membershipNumber", JsonSchema.builder() + .type("string") + .minLength(15) + .build() + ), + )) + .build() + ) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt new file mode 100644 index 00000000..87b67e61 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt @@ -0,0 +1,227 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.JsonSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.type.CollectionType +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test +import java.math.BigDecimal +import java.math.BigInteger + +class ConstTest { + + private val objectMapper = ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) + + private val schemasArray: CollectionType = objectMapper.typeFactory.constructCollectionType(List::class.java, JsonSchema::class.java) + + fun objectClass() = JsonSchema::class.java + + @Test + @Disabled("Requires: DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS") + @DisplayName("BigDecimal") + fun compareBigDecimalWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/bigdecimal.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(BigDecimal.valueOf(-214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648)) + .build(), + JsonSchema.builder() + .constValue(BigDecimal.valueOf(123456789021474836471234567890214748364712345678902147483647.123456789021474836471234567890214748364712345678902147483647)) + .build(), + JsonSchema.builder() + .constValue(BigDecimal.valueOf(214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647)) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is BigDecimal, + assertionMessage(BigDecimal::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("BigInteger") + fun compareBigIntegerWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/biginteger.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(BigInteger("-214748364821474836482147483648")) + .build(), + JsonSchema.builder() + .constValue(BigInteger("12345678902147483647")) + .build(), + JsonSchema.builder() + .constValue(BigInteger("214748364721474836472147483647")) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is BigInteger, + assertionMessage(BigInteger::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Boolean") + fun compareBooleanWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/boolean.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(false) + .build(), + JsonSchema.builder() + .constValue(true) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is Boolean, + assertionMessage(Boolean::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Double") + fun compareDoubleWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/double.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(-4.9E-324) + .build(), + JsonSchema.builder() + .constValue(123.456) + .build(), + JsonSchema.builder() + .constValue(1.7976931348623157E308) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is Double, + assertionMessage(Double::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @Disabled("Required param. Collision with double on parsing") + @DisplayName("Float") + fun compareFloatWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/double.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(-1.4E-45) + .build(), + JsonSchema.builder() + .constValue(1234567890.1234567890) + .build(), + JsonSchema.builder() + .constValue(3.4028235E38) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is Float, + assertionMessage(Float::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Int") + fun compareIntWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/int.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(-2147483648) + .build(), + JsonSchema.builder() + .constValue(0) + .build(), + JsonSchema.builder() + .constValue(2147483647) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is Int, + assertionMessage(Int::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Null") + fun compareNullWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/null.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(null) + .build() + ) + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Object") + fun compareObjectWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/object.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .constValue(JsonSchema.builder() + .type("string") + .constValue("abc") + .build() + ) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.constValue!! is JsonSchema, + assertionMessage(JsonSchema::class.java, value.constValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + private fun assertionMessage(expectedClass: Class<*>, value: Any): String { + return "MUST be parsed as ${expectedClass.name}: $value but was ${value::class.java.name}" + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt new file mode 100644 index 00000000..afe84f5b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt @@ -0,0 +1,230 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.JsonSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.type.CollectionType +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test +import java.math.BigDecimal +import java.math.BigInteger + +class DefaultTest { + + private val objectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + private val schemasArray: CollectionType = objectMapper.typeFactory.constructCollectionType(List::class.java, JsonSchema::class.java) + + fun objectClass() = JsonSchema::class.java + + @Test + @Disabled("Requires: DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS") + @DisplayName("BigDecimal") + fun compareBigDecimalWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/bigdecimal.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(BigDecimal("-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648")) + .build(), + JsonSchema.builder() + .defaultValue(BigDecimal("1.123456789021474836471234567890214748364712345678902147483647")) + .build(), + JsonSchema.builder() + .defaultValue(BigDecimal("2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647")) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is BigDecimal, + assertionMessage(BigDecimal::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("BigInteger") + fun compareBigIntegerWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/biginteger.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(BigInteger("-214748364821474836482147483648")) + .build(), + JsonSchema.builder() + .defaultValue(BigInteger("12345678902147483647")) + .build(), + JsonSchema.builder() + .defaultValue(BigInteger("214748364721474836472147483647")) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is BigInteger, + assertionMessage(BigInteger::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Boolean") + fun compareBooleanWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/boolean.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(false) + .build(), + JsonSchema.builder() + .defaultValue(true) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is Boolean, + assertionMessage(Boolean::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Double") + fun compareDoubleWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/double.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(-4.9E-324) + .build(), + JsonSchema.builder() + .defaultValue(123.456) + .build(), + JsonSchema.builder() + .defaultValue(1.7976931348623157E308) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is Double, + assertionMessage(Double::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @Disabled("Required param. Collision with double on parsing") + @DisplayName("Float") + fun compareFloatWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/float.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(-1.1234567890) + .build(), + JsonSchema.builder() + .defaultValue(0.123f) + .build(), + JsonSchema.builder() + .defaultValue(3.4028235E38f) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is Float, + assertionMessage(Float::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Int") + fun compareIntWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/int.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(-2147483648) + .build(), + JsonSchema.builder() + .defaultValue(0) + .build(), + JsonSchema.builder() + .defaultValue(2147483647) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is Int, + assertionMessage(Int::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Null") + fun compareNullWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/null.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(null) + .build() + ) + + Assertions.assertEquals(values, expectedValues) + } + + @Test + @DisplayName("Object") + fun compareObjectWithParsedJson() { + val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/object.json") + val values: List = objectMapper.readValue(jsonString, schemasArray) + val expectedValues = listOf( + JsonSchema.builder() + .defaultValue(JsonSchema.builder() + .type("string") + .constValue("abc") + .build() + ) + .build() + ) + + for (value: JsonSchema in values) { + Assertions.assertTrue( + value.defaultValue!! is JsonSchema, + assertionMessage(JsonSchema::class.java, value.defaultValue!!) + ) + } + + Assertions.assertEquals(values, expectedValues) + } + + private fun assertionMessage(expectedClass: Class<*>, value: Any): String { + return "MUST be parsed as ${expectedClass.name}: $value but was ${value::class.java.name}" + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt new file mode 100644 index 00000000..0ce488bf --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt @@ -0,0 +1,292 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.JsonSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test +import java.math.BigDecimal + +class Draft07CoreSchemaMetaSchemaTest { + + private val objectMapper = ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) + + fun baseObjectJson() = "/json/v3/schema/json/draft-07-core-schema-meta-schema.json" + + fun objectClass() = JsonSchema::class.java + + fun build(): JsonSchema { + return JsonSchema.builder() + .schema("http://json-schema.org/draft-07/schema#") + .id("http://json-schema.org/draft-07/schema#") + .title("Core schema meta-schema") + .definitions(mapOf( + Pair("schemaArray", JsonSchema.builder() + .type("array") + .minItems(1) + .items(JsonSchema.builder().ref("#").build()) + .build() + ), + Pair("nonNegativeInteger", JsonSchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("nonNegativeIntegerDefault0", JsonSchema.builder() + .allOf(listOf( + JsonSchema.builder().ref("#/definitions/nonNegativeInteger").build(), + JsonSchema.builder().defaultValue(0).build() + )) + .build() + ), + Pair("simpleTypes", JsonSchema.builder() + .enumValue(listOf( + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + )) + .build() + ), + Pair("stringArray", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .uniqueItems(true) + .defaultValue(emptyList()) + .build() + ) + )) + .type(listOf("object", "boolean")) + .properties(mapOf( + Pair("\$id", JsonSchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$schema", JsonSchema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("\$ref", JsonSchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$comment", JsonSchema.builder() + .type("string") + .build() + ), + Pair("title", JsonSchema.builder() + .type("string") + .build() + ), + Pair("description", JsonSchema.builder() + .type("string") + .build() + ), + Pair("default", true), + Pair("readOnly", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("writeOnly", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("examples", JsonSchema.builder() + .type("array") + .items(true) + .build() + ), + Pair("multipleOf", JsonSchema.builder() + .type("number") + .exclusiveMinimum(BigDecimal.ZERO) + .build() + ), + Pair("maximum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMaximum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("minimum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMinimum", JsonSchema.builder() + .type("number") + .build() + ), + Pair("maxLength", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minLength", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("pattern", JsonSchema.builder() + .type("string") + .format("regex") + .build() + ), + Pair("additionalItems", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("items", JsonSchema.builder() + .anyOf(listOf( + JsonSchema.builder().ref("#").build(), + JsonSchema.builder().ref("#/definitions/schemaArray").build(), + )) + .defaultValue(true) + .build() + ), + Pair("maxItems", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minItems", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("uniqueItems", JsonSchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("contains", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("maxProperties", JsonSchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minProperties", JsonSchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("required", JsonSchema.builder() + .ref("#/definitions/stringArray") + .build() + ), + Pair("additionalProperties", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("definitions", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("properties", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("patternProperties", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().ref("#").build()) + .propertyNames(JsonSchema.builder().format("regex").build()) + .defaultValue(JsonSchema()) + .build() + ), + Pair("dependencies", JsonSchema.builder() + .type("object") + .additionalProperties(JsonSchema.builder().anyOf(listOf( + JsonSchema.builder().ref("#").build(), + JsonSchema.builder().ref("#/definitions/stringArray").build(), + )).build()) + .build() + ), + Pair("propertyNames", JsonSchema.builder().ref("#").build()), + Pair("const", true), + Pair("enum", JsonSchema.builder() + .type("array") + .items(true) + .minItems(1) + .uniqueItems(true) + .build() + ), + Pair("type", JsonSchema.builder() + .anyOf(listOf( + JsonSchema.builder().ref("#/definitions/simpleTypes").build(), + JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().ref("#/definitions/simpleTypes").build()) + .minItems(1) + .uniqueItems(true) + .build() + )) + .build() + ), + Pair("format", JsonSchema.builder() + .type("string") + .build() + ), + Pair("contentMediaType", JsonSchema.builder() + .type("string") + .build() + ), + Pair("contentEncoding", JsonSchema.builder() + .type("string") + .build() + ), + Pair("if", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("then", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("else", JsonSchema.builder() + .ref("#") + .build() + ), + Pair("allOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("anyOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("oneOf", JsonSchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("not", JsonSchema.builder() + .ref("#") + .build() + ), + )) + .defaultValue(true) + .build() + } + + @Test + @DisplayName("Compare hand crafted object with parsed json") + fun compareObjectWithParsedJson() { + val model = ClasspathUtils.readAsString(baseObjectJson()) + + Assertions.assertEquals( + objectMapper.readValue(model, objectClass()), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt new file mode 100644 index 00000000..9f7ad4a3 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt @@ -0,0 +1,29 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest + +class EnumeratedValuesTest: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/enumerated-values.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/enumerated-values.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Enumerated Values") + .type("object") + .properties(mapOf( + Pair("data", JsonSchema.builder() + .enumValue(listOf( + 42, true, "hello", null, listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt new file mode 100644 index 00000000..bfe08677 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt @@ -0,0 +1,40 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest +import java.math.BigDecimal + +class PersonTest: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/person.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/person.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Person") + .type("object") + .properties(mapOf( + Pair("firstName", JsonSchema.builder() + .type("string") + .description("The person's first name.") + .build() + ), + Pair("lastName", JsonSchema.builder() + .type("string") + .description("The person's last name.") + .build() + ), + Pair("age", JsonSchema.builder() + .type("integer") + .description("Age in years which must be equal to or greater than zero.") + .minimum(BigDecimal.ZERO) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt new file mode 100644 index 00000000..18245a74 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json + +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.ReadSchemaTest + +class RegexPatternTest: ReadSchemaTest() { + + override fun schemaClass() = JsonSchema::class.java + + override fun schemaToReadPath() = "/json/v3/schema/json/regex-pattern.schema.json" + + override fun buildSchema(): JsonSchema { + return JsonSchema.builder() + .id("https://example.com/regex-pattern.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Regular Expression Pattern") + .type("object") + .properties(mapOf( + Pair("code", JsonSchema.builder() + .type("string") + .pattern("^[A-Z]{3}-\\d{3}$") + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json new file mode 100644 index 00000000..88e59e27 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/arrays.schema.json @@ -0,0 +1,34 @@ +{ + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json new file mode 100644 index 00000000..07a25a4f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/complex-object.schema.json @@ -0,0 +1,41 @@ +{ + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..e6285588 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/conditional-validation-if-else.schema.json @@ -0,0 +1,39 @@ +{ + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json new file mode 100644 index 00000000..39588384 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json @@ -0,0 +1,11 @@ +[ + { + "const": -214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648 + }, + { + "const": 123456789021474836471234567890214748364712345678902147483647.123456789021474836471234567890214748364712345678902147483647 + }, + { + "const": 214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json new file mode 100644 index 00000000..58c491e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json @@ -0,0 +1,11 @@ +[ + { + "const": -214748364821474836482147483648 + }, + { + "const": 12345678902147483647 + }, + { + "const": 214748364721474836472147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json new file mode 100644 index 00000000..8aced380 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json @@ -0,0 +1,8 @@ +[ + { + "const": false + }, + { + "const": true + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json new file mode 100644 index 00000000..39b90e3b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json @@ -0,0 +1,11 @@ +[ + { + "const": -4.9E-324 + }, + { + "const": 123.456 + }, + { + "const": 1.7976931348623157E308 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json new file mode 100644 index 00000000..545ea19b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json @@ -0,0 +1,11 @@ +[ + { + "const": 1.4E-45 + }, + { + "const": 1234567890.1234567890 + }, + { + "const": 3.4028235E38 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json new file mode 100644 index 00000000..f11d60bb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json @@ -0,0 +1,11 @@ +[ + { + "const": -2147483648 + }, + { + "const": 0 + }, + { + "const": 2147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json new file mode 100644 index 00000000..778a3475 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json @@ -0,0 +1,5 @@ +[ + { + "const": null + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json new file mode 100644 index 00000000..f905ed37 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json @@ -0,0 +1,8 @@ +[ + { + "const": { + "type": "string", + "const": "abc" + } + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json new file mode 100644 index 00000000..9850c521 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json @@ -0,0 +1,11 @@ +[ + { + "default": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648 + }, + { + "default": 1.123456789021474836471234567890214748364712345678902147483647 + }, + { + "default": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json new file mode 100644 index 00000000..75183ff6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json @@ -0,0 +1,11 @@ +[ + { + "default": -214748364821474836482147483648 + }, + { + "default": 12345678902147483647 + }, + { + "default": 214748364721474836472147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json new file mode 100644 index 00000000..e34bc4fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json @@ -0,0 +1,8 @@ +[ + { + "default": false + }, + { + "default": true + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json new file mode 100644 index 00000000..1f169274 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json @@ -0,0 +1,11 @@ +[ + { + "default": -4.9E-324 + }, + { + "default": 123.456 + }, + { + "default": 1.7976931348623157E308 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json new file mode 100644 index 00000000..1d993a0f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json @@ -0,0 +1,11 @@ +[ + { + "default": -1.1234567890 + }, + { + "default": 0.123 + }, + { + "default": 3.4028235E38 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json new file mode 100644 index 00000000..c97ab553 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json @@ -0,0 +1,11 @@ +[ + { + "default": -2147483648 + }, + { + "default": 0 + }, + { + "default": 2147483647 + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json new file mode 100644 index 00000000..f32c4b28 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json @@ -0,0 +1,5 @@ +[ + { + "default": null + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json new file mode 100644 index 00000000..29772bd3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json @@ -0,0 +1,8 @@ +[ + { + "default": { + "type": "string", + "const": "abc" + } + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..bfb8b8a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,172 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json new file mode 100644 index 00000000..11f1b90b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/enumerated-values.schema.json @@ -0,0 +1,11 @@ +{ + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json new file mode 100644 index 00000000..bcab4804 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/person.schema.json @@ -0,0 +1,21 @@ +{ + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json new file mode 100644 index 00000000..82e34caf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/regex-pattern.schema.json @@ -0,0 +1,12 @@ +{ + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } +} \ No newline at end of file From a350a1a1215d83aaf9362fff83bfb7bb6e727d7a Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 2 Apr 2024 21:55:30 +0400 Subject: [PATCH 19/44] feat(schemas): examples can be any type + tests for AsyncAPI and Json Schemas --- .../AsyncAPISchemaAnyValueDeserializer.java | 15 + .../JsonSchemaAnyValueDeserializer.java | 70 +---- .../schema/SchemaAnyValueDeserializer.java | 66 ++++ .../asyncapi/v3/schema/AsyncAPISchema.java | 7 +- .../com/asyncapi/v3/schema/JsonSchema.java | 1 + .../v3/schema/ReadJsonPropertiesTest.kt | 100 ++++++ .../asyncapi/v3/schema/ReadJsonSchemaTest.kt | 73 +++++ .../com/asyncapi/v3/schema/ReadSchemaTest.kt | 32 -- .../com/asyncapi/v3/schema/SchemaProvider.kt | 9 + .../v3/schema/json/ArraysSchemaTest.kt | 51 +++- .../v3/schema/json/ComplexObjectTest.kt | 61 +++- .../json/ConditionalValidationIfElse.kt | 61 +++- .../com/asyncapi/v3/schema/json/ConstTest.kt | 227 -------------- .../asyncapi/v3/schema/json/DefaultTest.kt | 230 -------------- .../json/Draft07CoreSchemaMetaSchemaTest.kt | 286 ++++++++++++++++-- .../v3/schema/json/EnumeratedValuesTest.kt | 28 +- .../com/asyncapi/v3/schema/json/PersonTest.kt | 38 ++- .../v3/schema/json/RegexPatternTest.kt | 27 +- .../ConstDefaultExamplesArrayTest.kt | 91 ++++++ ...nstDefaultExamplesBigDecimalMaximumTest.kt | 28 ++ ...nstDefaultExamplesBigDecimalMinimumTest.kt | 28 ++ .../ConstDefaultExamplesBigDecimalTest.kt | 28 ++ ...nstDefaultExamplesBigIntegerMaximumTest.kt | 28 ++ ...nstDefaultExamplesBigIntegerMinimumTest.kt | 28 ++ .../ConstDefaultExamplesBigIntegerTest.kt | 28 ++ .../ConstDefaultExamplesBooleanFalseTest.kt | 27 ++ .../ConstDefaultExamplesBooleanTrueTest.kt | 27 ++ .../ConstDefaultExamplesDoubleMaximumTest.kt | 27 ++ .../ConstDefaultExamplesDoubleMinimumTest.kt | 27 ++ .../ConstDefaultExamplesDoubleTest.kt | 27 ++ .../ConstDefaultExamplesIntMaximumTest.kt | 27 ++ .../ConstDefaultExamplesIntMinimumTest.kt | 27 ++ .../properties/ConstDefaultExamplesIntTest.kt | 28 ++ .../ConstDefaultExamplesNullTest.kt | 27 ++ .../ConstDefaultExamplesObjectTest.kt | 35 +++ .../json/v3/schema/json/const/bigdecimal.json | 11 - .../json/v3/schema/json/const/biginteger.json | 11 - .../json/v3/schema/json/const/boolean.json | 8 - .../json/v3/schema/json/const/double.json | 11 - .../json/v3/schema/json/const/float.json | 11 - .../json/v3/schema/json/const/int.json | 11 - .../json/v3/schema/json/const/null.json | 5 - .../json/v3/schema/json/const/object.json | 8 - .../v3/schema/json/default/bigdecimal.json | 11 - .../v3/schema/json/default/biginteger.json | 11 - .../json/v3/schema/json/default/boolean.json | 8 - .../json/v3/schema/json/default/double.json | 11 - .../json/v3/schema/json/default/float.json | 11 - .../json/v3/schema/json/default/int.json | 11 - .../json/v3/schema/json/default/null.json | 5 - .../json/v3/schema/json/default/object.json | 8 - .../json/v3/schema/json/properties/array.json | 106 +++++++ .../json/properties/bigdecimal-maximum.json | 5 + .../json/properties/bigdecimal-minimum.json | 5 + .../v3/schema/json/properties/bigdecimal.json | 5 + .../json/properties/biginteger-maximum.json | 5 + .../json/properties/biginteger-minimum.json | 5 + .../v3/schema/json/properties/biginteger.json | 5 + .../schema/json/properties/boolean-false.json | 5 + .../schema/json/properties/boolean-true.json | 5 + .../json/properties/double-maximum.json | 5 + .../json/properties/double-minimum.json | 5 + .../v3/schema/json/properties/double.json | 5 + .../schema/json/properties/float-maximum.json | 5 + .../schema/json/properties/float-minimum.json | 5 + .../json/v3/schema/json/properties/float.json | 5 + .../schema/json/properties/int-maximum.json | 5 + .../schema/json/properties/int-minimum.json | 5 + .../json/v3/schema/json/properties/int.json | 5 + .../json/v3/schema/json/properties/null.json | 5 + .../v3/schema/json/properties/object.json | 16 + 71 files changed, 1510 insertions(+), 774 deletions(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt delete mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt delete mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt delete mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json delete mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java new file mode 100644 index 00000000..6934993a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/AsyncAPISchemaAnyValueDeserializer.java @@ -0,0 +1,15 @@ +package com.asyncapi.v3.jackson.schema; + +import com.asyncapi.v3.schema.AsyncAPISchema; + +/** + * @author Pavel Bodiachevskii + */ +public class AsyncAPISchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { + + @Override + public Class schemaClass() { + return AsyncAPISchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java index 4f64e333..cd25811b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/JsonSchemaAnyValueDeserializer.java @@ -1,79 +1,15 @@ package com.asyncapi.v3.jackson.schema; import com.asyncapi.v3.schema.JsonSchema; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.ObjectCodec; -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.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; /** * @author Pavel Bodiachevskii */ -public class JsonSchemaAnyValueDeserializer extends JsonDeserializer { +public class JsonSchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { @Override - public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { - ObjectCodec objectCodec = p.getCodec(); - JsonNode node = objectCodec.readTree(p); - - return chooseKnownPojo(node, objectCodec); - } - - private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { - try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { - JsonNodeType nodeType = jsonNode.getNodeType(); - - switch (nodeType) { - case ARRAY: - return readAsList((ArrayNode) jsonNode, objectCodec); - case BOOLEAN: - return jsonNode.asBoolean(); - case NUMBER: - return jsonParser.readValueAs(Number.class); - case OBJECT: - return jsonParser.readValueAs(JsonSchema.class); - case STRING: - return jsonParser.readValueAs(String.class); - case BINARY: - case POJO: - case MISSING: - case NULL: - return null; - } - - return null; - } - } - - private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { - List list = new ArrayList<>(); - for (JsonNode childNode : arrayNode) { - list.add(chooseKnownPojo(childNode, objectCodec)); - } - - return list; - } - - private Number readNumber(JsonNode jsonNode, JsonParser jsonParser) throws IOException { - if (jsonNode.isBigDecimal()) { - return jsonParser.readValueAs(BigDecimal.class); - } - - if (jsonNode.isBigInteger()) { - return jsonParser.readValueAs(BigInteger.class); - } - - return jsonParser.readValueAs(Number.class); + public Class schemaClass() { + return JsonSchema.class; } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java new file mode 100644 index 00000000..09ca14d0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/SchemaAnyValueDeserializer.java @@ -0,0 +1,66 @@ +package com.asyncapi.v3.jackson.schema; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Pavel Bodiachevskii + */ +public abstract class SchemaAnyValueDeserializer extends JsonDeserializer { + + abstract public Class schemaClass(); + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsList((ArrayNode) jsonNode, objectCodec); + case BOOLEAN: + return jsonNode.asBoolean(); + case NUMBER: + return jsonParser.readValueAs(Number.class); + case OBJECT: + return jsonParser.readValueAs(schemaClass()); + case STRING: + return jsonParser.readValueAs(String.class); + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + List list = new ArrayList<>(); + for (JsonNode childNode : arrayNode) { + list.add(chooseKnownPojo(childNode, objectCodec)); + } + + return list; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java index df48cf9f..10125385 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java @@ -3,6 +3,7 @@ import com.asyncapi.v3.ExtendableObject; import com.asyncapi.v3._0_0.jackson.model.ExternalDocumentationDeserializer; import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAdditionalPropertiesDeserializer; +import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAnyValueDeserializer; import com.asyncapi.v3.jackson.schema.AsyncAPISchemaItemsDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; @@ -139,6 +140,7 @@ public class AsyncAPISchema extends ExtendableObject { @Nullable @JsonProperty("const") @JsonPropertyDescription("JSON Schema const value") + @JsonDeserialize(using = AsyncAPISchemaAnyValueDeserializer.class) public Object constValue; /* @@ -420,7 +422,8 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("properties") - public Map properties; + @JsonDeserialize(contentUsing = AsyncAPISchemaAdditionalPropertiesDeserializer.class) + public Map properties; /** * The value of "patternProperties" MUST be an object. @@ -751,6 +754,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("default") + @JsonDeserialize(using = AsyncAPISchemaAnyValueDeserializer.class) public Object defaultValue; /** @@ -824,6 +828,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("examples") + @JsonDeserialize(contentUsing = AsyncAPISchemaAnyValueDeserializer.class) public List examples; /* diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java index fd24a5a3..4feb3dbe 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java @@ -809,6 +809,7 @@ Validation Keywords for Numeric Instances (number and integer) */ @Nullable @JsonProperty("examples") + @JsonDeserialize(contentUsing = JsonSchemaAnyValueDeserializer.class) public List examples; } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt new file mode 100644 index 00000000..33127806 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonPropertiesTest.kt @@ -0,0 +1,100 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.properties.* +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.* +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.math.BigDecimal +import java.util.stream.Stream + +class ReadJsonPropertiesTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + private val bigDecimalObjectMapper: ObjectMapper = ObjectMapper() + .configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + fun compareSchemas(schemaToCompareWith: String, + schemaClass: Class<*>, + schemaProvider: SchemaProvider + ) { + val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) + val jsonSchema = if (schemaProvider.jsonSchema().defaultValue is BigDecimal) { + bigDecimalObjectMapper.readValue(jsonSchemaString, schemaClass) + } else { + objectMapper.readValue(jsonSchemaString, schemaClass) + } + val schemaToCheck: Any? = when (schemaClass) { + JsonSchema::class.java -> schemaProvider.jsonSchema() + AsyncAPISchema::class.java -> schemaProvider.asyncAPISchema() + else -> null + } + + Assertions.assertEquals(jsonSchema, schemaToCheck) + } + + @Nested + inner class JsonSchemaImplementation { + + @ArgumentsSource(Properties::class) + @ParameterizedTest(name = "Read: {0}") + fun readAnyTypeProperty(constPropertyToRead: String, schemaProvider: SchemaProvider) { + compareSchemas(constPropertyToRead, JsonSchema::class.java, schemaProvider) + } + + } + + @Nested + inner class AsyncAPISchemaImplementation { + + @ArgumentsSource(Properties::class) + @ParameterizedTest(name = "Read: {0}") + fun readAnyTypeProperty(constPropertyToRead: String, schemaProvider: SchemaProvider) { + compareSchemas(constPropertyToRead, AsyncAPISchema::class.java, schemaProvider) + } + + } + + class Properties: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/json/properties/bigdecimal.json", ConstDefaultExamplesBigDecimalTest()), + Arguments.of("/json/v3/schema/json/properties/bigdecimal-maximum.json", ConstDefaultExamplesBigDecimalMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/bigdecimal-minimum.json", ConstDefaultExamplesBigDecimalMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/biginteger.json", ConstDefaultExamplesBigIntegerTest()), + Arguments.of("/json/v3/schema/json/properties/biginteger-maximum.json", ConstDefaultExamplesBigIntegerMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/biginteger-minimum.json", ConstDefaultExamplesBigIntegerMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/boolean-false.json", ConstDefaultExamplesBooleanFalseTest()), + Arguments.of("/json/v3/schema/json/properties/boolean-true.json", ConstDefaultExamplesBooleanTrueTest()), + + Arguments.of("/json/v3/schema/json/properties/double.json", ConstDefaultExamplesDoubleTest()), + Arguments.of("/json/v3/schema/json/properties/double-maximum.json", ConstDefaultExamplesDoubleMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/double-minimum.json", ConstDefaultExamplesDoubleMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/int.json", ConstDefaultExamplesIntTest()), + Arguments.of("/json/v3/schema/json/properties/int-maximum.json", ConstDefaultExamplesIntMaximumTest()), + Arguments.of("/json/v3/schema/json/properties/int-minimum.json", ConstDefaultExamplesIntMinimumTest()), + + Arguments.of("/json/v3/schema/json/properties/null.json", ConstDefaultExamplesNullTest()), + + Arguments.of("/json/v3/schema/json/properties/object.json", ConstDefaultExamplesObjectTest()), + + Arguments.of("/json/v3/schema/json/properties/array.json", ConstDefaultExamplesArrayTest()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt new file mode 100644 index 00000000..5946e7b2 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadJsonSchemaTest.kt @@ -0,0 +1,73 @@ +package com.asyncapi.v3.schema + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.* +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.* +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class ReadJsonSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + fun compareSchemas(schemaToCompareWith: String, + schemaClass: Class<*>, + schemaProvider: SchemaProvider + ) { + val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) + val jsonSchema = objectMapper.readValue(jsonSchemaString, schemaClass) + val schemaToCheck: Any? = when (schemaClass) { + JsonSchema::class.java -> schemaProvider.jsonSchema() + AsyncAPISchema::class.java -> schemaProvider.asyncAPISchema() + else -> null + } + + Assertions.assertEquals(jsonSchema, schemaToCheck) + } + + @Nested + inner class JsonSchemaImplementation { + + @ArgumentsSource(JsonSchemas::class) + @ParameterizedTest(name = "Read: {0}") + fun readJsonSchema(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, JsonSchema::class.java, schemaProvider) + } + + } + + @Nested + inner class AsyncAPISchemaImplementation { + + @ArgumentsSource(JsonSchemas::class) + @ParameterizedTest(name = "Read: {0}") + fun readJsonSchema(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPISchema::class.java, schemaProvider) + } + + } + + class JsonSchemas: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/json/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/json/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/json/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/json/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/json/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/json/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/json/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt deleted file mode 100644 index 0439ae6c..00000000 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/ReadSchemaTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.asyncapi.v3.schema - -import com.asyncapi.v3.ClasspathUtils -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.databind.ObjectMapper -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test - -abstract class ReadSchemaTest { - - protected val objectMapper = ObjectMapper() - .setSerializationInclusion(JsonInclude.Include.NON_NULL) - - protected abstract fun schemaClass(): Class - - protected abstract fun schemaToReadPath(): String - - protected abstract fun buildSchema(): SchemaType - - @Test - @DisplayName("Read: compare hand crafted schema with parsed schema") - fun compareObjectWithParsedJson() { - val model = ClasspathUtils.readAsString(schemaToReadPath()) - - Assertions.assertEquals( - objectMapper.readValue(model, schemaClass()), - buildSchema() - ) - } - -} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt new file mode 100644 index 00000000..307ad9db --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -0,0 +1,9 @@ +package com.asyncapi.v3.schema + +interface SchemaProvider { + + fun jsonSchema(): JsonSchema + + fun asyncAPISchema(): AsyncAPISchema + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt index d60a00ca..f2becc41 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ArraysSchemaTest.kt @@ -1,15 +1,12 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider -class ArraysSchemaTest: ReadSchemaTest() { +class ArraysSchemaTest: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/arrays.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/arrays.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -49,4 +46,44 @@ class ArraysSchemaTest: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/arrays.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .description("A representation of a person, company, organization, or place") + .type("object") + .properties(mapOf( + Pair("fruits", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .build() + ), + Pair("vegetables", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().ref("#/definitions/veggie").build()) + .build() + ) + )) + .definitions(mapOf( + Pair("veggie", AsyncAPISchema.builder() + .type("object") + .required(listOf("veggieName", "veggieLike")) + .properties(mapOf( + Pair("veggieName", AsyncAPISchema.builder() + .type("string") + .description("The name of the vegetable.") + .build() + ), + Pair("veggieLike", AsyncAPISchema.builder() + .type("boolean") + .description("Do I like this vegetable?") + .build() + ) + )) + .build() + ) + )) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt index 4af01d04..cfe8b7ac 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ComplexObjectTest.kt @@ -1,16 +1,13 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider import java.math.BigDecimal -class ComplexObjectTest: ReadSchemaTest() { +class ComplexObjectTest: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/complex-object.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/complex-object.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -60,4 +57,54 @@ class ComplexObjectTest: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/complex-object.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Complex Object") + .type("object") + .properties(mapOf( + Pair("name", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("age", AsyncAPISchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("address", AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("street", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("city", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("state", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("postalCode", AsyncAPISchema.builder() + .type("string") + .pattern("\\d{5}") + .build() + ) + )) + .required(listOf("street", "city", "state", "postalCode")) + .build() + ), + Pair("hobbies", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .build() + ), + )) + .required(listOf("name", "age")) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt index af3887c5..c4e423bf 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConditionalValidationIfElse.kt @@ -1,15 +1,12 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider -class ConditionalValidationIfElse: ReadSchemaTest() { +class ConditionalValidationIfElse: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/conditional-validation-if-else.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/conditional-validation-if-else.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -59,4 +56,54 @@ class ConditionalValidationIfElse: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/conditional-validation-if-else.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Conditional Validation with If-Else") + .type("object") + .properties(mapOf( + Pair("isMember", AsyncAPISchema.builder() + .type("boolean") + .build() + ), + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .build() + ) + )) + .required(listOf("isMember")) + .ifValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("isMember", AsyncAPISchema.builder() + .constValue(true) + .build() + ), + )) + .build() + ) + .thenValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .minLength(10) + .maxLength(10) + .build() + ), + )) + .build() + ) + .elseValue(AsyncAPISchema.builder() + .properties(mapOf( + Pair("membershipNumber", AsyncAPISchema.builder() + .type("string") + .minLength(15) + .build() + ), + )) + .build() + ) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt deleted file mode 100644 index 87b67e61..00000000 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/ConstTest.kt +++ /dev/null @@ -1,227 +0,0 @@ -package com.asyncapi.v3.schema.json - -import com.asyncapi.v3.ClasspathUtils -import com.asyncapi.v3.schema.JsonSchema -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.type.CollectionType -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test -import java.math.BigDecimal -import java.math.BigInteger - -class ConstTest { - - private val objectMapper = ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) - - private val schemasArray: CollectionType = objectMapper.typeFactory.constructCollectionType(List::class.java, JsonSchema::class.java) - - fun objectClass() = JsonSchema::class.java - - @Test - @Disabled("Requires: DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS") - @DisplayName("BigDecimal") - fun compareBigDecimalWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/bigdecimal.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(BigDecimal.valueOf(-214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648)) - .build(), - JsonSchema.builder() - .constValue(BigDecimal.valueOf(123456789021474836471234567890214748364712345678902147483647.123456789021474836471234567890214748364712345678902147483647)) - .build(), - JsonSchema.builder() - .constValue(BigDecimal.valueOf(214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647)) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is BigDecimal, - assertionMessage(BigDecimal::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("BigInteger") - fun compareBigIntegerWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/biginteger.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(BigInteger("-214748364821474836482147483648")) - .build(), - JsonSchema.builder() - .constValue(BigInteger("12345678902147483647")) - .build(), - JsonSchema.builder() - .constValue(BigInteger("214748364721474836472147483647")) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is BigInteger, - assertionMessage(BigInteger::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Boolean") - fun compareBooleanWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/boolean.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(false) - .build(), - JsonSchema.builder() - .constValue(true) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is Boolean, - assertionMessage(Boolean::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Double") - fun compareDoubleWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/double.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(-4.9E-324) - .build(), - JsonSchema.builder() - .constValue(123.456) - .build(), - JsonSchema.builder() - .constValue(1.7976931348623157E308) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is Double, - assertionMessage(Double::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @Disabled("Required param. Collision with double on parsing") - @DisplayName("Float") - fun compareFloatWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/double.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(-1.4E-45) - .build(), - JsonSchema.builder() - .constValue(1234567890.1234567890) - .build(), - JsonSchema.builder() - .constValue(3.4028235E38) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is Float, - assertionMessage(Float::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Int") - fun compareIntWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/int.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(-2147483648) - .build(), - JsonSchema.builder() - .constValue(0) - .build(), - JsonSchema.builder() - .constValue(2147483647) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is Int, - assertionMessage(Int::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Null") - fun compareNullWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/null.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(null) - .build() - ) - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Object") - fun compareObjectWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/const/object.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .constValue(JsonSchema.builder() - .type("string") - .constValue("abc") - .build() - ) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.constValue!! is JsonSchema, - assertionMessage(JsonSchema::class.java, value.constValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - private fun assertionMessage(expectedClass: Class<*>, value: Any): String { - return "MUST be parsed as ${expectedClass.name}: $value but was ${value::class.java.name}" - } - -} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt deleted file mode 100644 index afe84f5b..00000000 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/DefaultTest.kt +++ /dev/null @@ -1,230 +0,0 @@ -package com.asyncapi.v3.schema.json - -import com.asyncapi.v3.ClasspathUtils -import com.asyncapi.v3.schema.JsonSchema -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.DeserializationFeature -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.type.CollectionType -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test -import java.math.BigDecimal -import java.math.BigInteger - -class DefaultTest { - - private val objectMapper = ObjectMapper() - .setSerializationInclusion(JsonInclude.Include.NON_NULL) - - private val schemasArray: CollectionType = objectMapper.typeFactory.constructCollectionType(List::class.java, JsonSchema::class.java) - - fun objectClass() = JsonSchema::class.java - - @Test - @Disabled("Requires: DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS") - @DisplayName("BigDecimal") - fun compareBigDecimalWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/bigdecimal.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(BigDecimal("-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648")) - .build(), - JsonSchema.builder() - .defaultValue(BigDecimal("1.123456789021474836471234567890214748364712345678902147483647")) - .build(), - JsonSchema.builder() - .defaultValue(BigDecimal("2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647")) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is BigDecimal, - assertionMessage(BigDecimal::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("BigInteger") - fun compareBigIntegerWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/biginteger.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(BigInteger("-214748364821474836482147483648")) - .build(), - JsonSchema.builder() - .defaultValue(BigInteger("12345678902147483647")) - .build(), - JsonSchema.builder() - .defaultValue(BigInteger("214748364721474836472147483647")) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is BigInteger, - assertionMessage(BigInteger::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Boolean") - fun compareBooleanWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/boolean.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(false) - .build(), - JsonSchema.builder() - .defaultValue(true) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is Boolean, - assertionMessage(Boolean::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Double") - fun compareDoubleWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/double.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(-4.9E-324) - .build(), - JsonSchema.builder() - .defaultValue(123.456) - .build(), - JsonSchema.builder() - .defaultValue(1.7976931348623157E308) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is Double, - assertionMessage(Double::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @Disabled("Required param. Collision with double on parsing") - @DisplayName("Float") - fun compareFloatWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/float.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(-1.1234567890) - .build(), - JsonSchema.builder() - .defaultValue(0.123f) - .build(), - JsonSchema.builder() - .defaultValue(3.4028235E38f) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is Float, - assertionMessage(Float::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Int") - fun compareIntWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/int.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(-2147483648) - .build(), - JsonSchema.builder() - .defaultValue(0) - .build(), - JsonSchema.builder() - .defaultValue(2147483647) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is Int, - assertionMessage(Int::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Null") - fun compareNullWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/null.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(null) - .build() - ) - - Assertions.assertEquals(values, expectedValues) - } - - @Test - @DisplayName("Object") - fun compareObjectWithParsedJson() { - val jsonString = ClasspathUtils.readAsString("/json/v3/schema/json/default/object.json") - val values: List = objectMapper.readValue(jsonString, schemasArray) - val expectedValues = listOf( - JsonSchema.builder() - .defaultValue(JsonSchema.builder() - .type("string") - .constValue("abc") - .build() - ) - .build() - ) - - for (value: JsonSchema in values) { - Assertions.assertTrue( - value.defaultValue!! is JsonSchema, - assertionMessage(JsonSchema::class.java, value.defaultValue!!) - ) - } - - Assertions.assertEquals(values, expectedValues) - } - - private fun assertionMessage(expectedClass: Class<*>, value: Any): String { - return "MUST be parsed as ${expectedClass.name}: $value but was ${value::class.java.name}" - } - -} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt index 0ce488bf..9906c4d3 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/Draft07CoreSchemaMetaSchemaTest.kt @@ -1,23 +1,13 @@ package com.asyncapi.v3.schema.json -import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.databind.ObjectMapper -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test +import com.asyncapi.v3.schema.SchemaProvider import java.math.BigDecimal -class Draft07CoreSchemaMetaSchemaTest { +class Draft07CoreSchemaMetaSchemaTest: SchemaProvider { - private val objectMapper = ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) - - fun baseObjectJson() = "/json/v3/schema/json/draft-07-core-schema-meta-schema.json" - - fun objectClass() = JsonSchema::class.java - - fun build(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .schema("http://json-schema.org/draft-07/schema#") .id("http://json-schema.org/draft-07/schema#") @@ -278,15 +268,265 @@ class Draft07CoreSchemaMetaSchemaTest { .build() } - @Test - @DisplayName("Compare hand crafted object with parsed json") - fun compareObjectWithParsedJson() { - val model = ClasspathUtils.readAsString(baseObjectJson()) - - Assertions.assertEquals( - objectMapper.readValue(model, objectClass()), - build() - ) + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .schema("http://json-schema.org/draft-07/schema#") + .id("http://json-schema.org/draft-07/schema#") + .title("Core schema meta-schema") + .definitions(mapOf( + Pair("schemaArray", AsyncAPISchema.builder() + .type("array") + .minItems(1) + .items(AsyncAPISchema.builder().ref("#").build()) + .build() + ), + Pair("nonNegativeInteger", AsyncAPISchema.builder() + .type("integer") + .minimum(BigDecimal.ZERO) + .build() + ), + Pair("nonNegativeIntegerDefault0", AsyncAPISchema.builder() + .allOf(listOf( + AsyncAPISchema.builder().ref("#/definitions/nonNegativeInteger").build(), + AsyncAPISchema.builder().defaultValue(0).build() + )) + .build() + ), + Pair("simpleTypes", AsyncAPISchema.builder() + .enumValue(listOf( + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + )) + .build() + ), + Pair("stringArray", AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().type("string").build()) + .uniqueItems(true) + .defaultValue(emptyList()) + .build() + ) + )) + .type(listOf("object", "boolean")) + .properties(mapOf( + Pair("\$id", AsyncAPISchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$schema", AsyncAPISchema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("\$ref", AsyncAPISchema.builder() + .type("string") + .format("uri-reference") + .build() + ), + Pair("\$comment", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("title", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("description", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("default", true), + Pair("readOnly", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("writeOnly", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("examples", AsyncAPISchema.builder() + .type("array") + .items(true) + .build() + ), + Pair("multipleOf", AsyncAPISchema.builder() + .type("number") + .exclusiveMinimum(BigDecimal.ZERO) + .build() + ), + Pair("maximum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMaximum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("minimum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("exclusiveMinimum", AsyncAPISchema.builder() + .type("number") + .build() + ), + Pair("maxLength", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minLength", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("pattern", AsyncAPISchema.builder() + .type("string") + .format("regex") + .build() + ), + Pair("additionalItems", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("items", AsyncAPISchema.builder() + .anyOf(listOf( + AsyncAPISchema.builder().ref("#").build(), + AsyncAPISchema.builder().ref("#/definitions/schemaArray").build(), + )) + .defaultValue(true) + .build() + ), + Pair("maxItems", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minItems", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("uniqueItems", AsyncAPISchema.builder() + .type("boolean") + .defaultValue(false) + .build() + ), + Pair("contains", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("maxProperties", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeInteger") + .build() + ), + Pair("minProperties", AsyncAPISchema.builder() + .ref("#/definitions/nonNegativeIntegerDefault0") + .build() + ), + Pair("required", AsyncAPISchema.builder() + .ref("#/definitions/stringArray") + .build() + ), + Pair("additionalProperties", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("definitions", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("properties", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("patternProperties", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().ref("#").build()) + .propertyNames(AsyncAPISchema.builder().format("regex").build()) + .defaultValue(AsyncAPISchema()) + .build() + ), + Pair("dependencies", AsyncAPISchema.builder() + .type("object") + .additionalProperties(AsyncAPISchema.builder().anyOf(listOf( + AsyncAPISchema.builder().ref("#").build(), + AsyncAPISchema.builder().ref("#/definitions/stringArray").build(), + )).build()) + .build() + ), + Pair("propertyNames", AsyncAPISchema.builder().ref("#").build()), + Pair("const", true), + Pair("enum", AsyncAPISchema.builder() + .type("array") + .items(true) + .minItems(1) + .uniqueItems(true) + .build() + ), + Pair("type", AsyncAPISchema.builder() + .anyOf(listOf( + AsyncAPISchema.builder().ref("#/definitions/simpleTypes").build(), + AsyncAPISchema.builder() + .type("array") + .items(AsyncAPISchema.builder().ref("#/definitions/simpleTypes").build()) + .minItems(1) + .uniqueItems(true) + .build() + )) + .build() + ), + Pair("format", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("contentMediaType", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("contentEncoding", AsyncAPISchema.builder() + .type("string") + .build() + ), + Pair("if", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("then", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("else", AsyncAPISchema.builder() + .ref("#") + .build() + ), + Pair("allOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("anyOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("oneOf", AsyncAPISchema.builder() + .ref("#/definitions/schemaArray") + .build() + ), + Pair("not", AsyncAPISchema.builder() + .ref("#") + .build() + ), + )) + .defaultValue(true) + .build() } } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt index 9f7ad4a3..f9af8303 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/EnumeratedValuesTest.kt @@ -1,15 +1,12 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider -class EnumeratedValuesTest: ReadSchemaTest() { +class EnumeratedValuesTest: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/enumerated-values.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/enumerated-values.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -26,4 +23,21 @@ class EnumeratedValuesTest: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/enumerated-values.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Enumerated Values") + .type("object") + .properties(mapOf( + Pair("data", AsyncAPISchema.builder() + .enumValue(listOf( + 42, true, "hello", null, listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt index bfe08677..63f25de1 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/PersonTest.kt @@ -1,16 +1,13 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider import java.math.BigDecimal -class PersonTest: ReadSchemaTest() { +class PersonTest: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/person.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/person.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -37,4 +34,31 @@ class PersonTest: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/person.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Person") + .type("object") + .properties(mapOf( + Pair("firstName", AsyncAPISchema.builder() + .type("string") + .description("The person's first name.") + .build() + ), + Pair("lastName", AsyncAPISchema.builder() + .type("string") + .description("The person's last name.") + .build() + ), + Pair("age", AsyncAPISchema.builder() + .type("integer") + .description("Age in years which must be equal to or greater than zero.") + .minimum(BigDecimal.ZERO) + .build() + ) + )) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt index 18245a74..4334d690 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/RegexPatternTest.kt @@ -1,15 +1,12 @@ package com.asyncapi.v3.schema.json +import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.schema.JsonSchema -import com.asyncapi.v3.schema.ReadSchemaTest +import com.asyncapi.v3.schema.SchemaProvider -class RegexPatternTest: ReadSchemaTest() { +class RegexPatternTest: SchemaProvider { - override fun schemaClass() = JsonSchema::class.java - - override fun schemaToReadPath() = "/json/v3/schema/json/regex-pattern.schema.json" - - override fun buildSchema(): JsonSchema { + override fun jsonSchema(): JsonSchema { return JsonSchema.builder() .id("https://example.com/regex-pattern.schema.json") .schema("http://json-schema.org/draft-07/schema#") @@ -25,4 +22,20 @@ class RegexPatternTest: ReadSchemaTest() { .build() } + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .id("https://example.com/regex-pattern.schema.json") + .schema("http://json-schema.org/draft-07/schema#") + .title("Regular Expression Pattern") + .type("object") + .properties(mapOf( + Pair("code", AsyncAPISchema.builder() + .type("string") + .pattern("^[A-Z]{3}-\\d{3}$") + .build() + ) + )) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt new file mode 100644 index 00000000..064164bc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesArrayTest.kt @@ -0,0 +1,91 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesArrayTest: SchemaProvider { + + private val jsonValue = JsonSchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + JsonSchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3, + JsonSchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + JsonSchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + + private val asyncapiValue = AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + AsyncAPISchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3, + AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .examples(listOf( + AsyncAPISchema.builder().type("string").constValue("abc").build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + )) + .build() + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(listOf(jsonValue)) + .defaultValue(listOf(jsonValue)) + .examples(listOf( + jsonValue, + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(listOf(asyncapiValue)) + .defaultValue(listOf(asyncapiValue)) + .examples(listOf( + asyncapiValue, + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt new file mode 100644 index 00000000..cb6af518 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMaximumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalMaximumTest: SchemaProvider { + + private val value = BigDecimal("2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt new file mode 100644 index 00000000..5a7c7446 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalMinimumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalMinimumTest: SchemaProvider { + + private val value = BigDecimal("-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt new file mode 100644 index 00000000..e3ce747c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigDecimalTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class ConstDefaultExamplesBigDecimalTest: SchemaProvider { + + private val value = BigDecimal("1.123456789021474836471234567890214748364712345678902147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt new file mode 100644 index 00000000..deeebe36 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMaximumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerMaximumTest: SchemaProvider { + + private val value = BigInteger("214748364721474836472147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt new file mode 100644 index 00000000..dcffc9bd --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerMinimumTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerMinimumTest: SchemaProvider { + + private val value = BigInteger("-214748364821474836482147483648") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt new file mode 100644 index 00000000..2ca5695b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBigIntegerTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigInteger + +class ConstDefaultExamplesBigIntegerTest: SchemaProvider { + + private val value = BigInteger("12345678902147483647") + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt new file mode 100644 index 00000000..099ee50d --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanFalseTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesBooleanFalseTest: SchemaProvider { + + private val value = false + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt new file mode 100644 index 00000000..bdd98dc2 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesBooleanTrueTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesBooleanTrueTest: SchemaProvider { + + private val value = true + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt new file mode 100644 index 00000000..7968adbd --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMaximumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleMaximumTest: SchemaProvider { + + private val value: Double = 1.7976931348623157E308 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt new file mode 100644 index 00000000..e4d0420e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleMinimumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleMinimumTest: SchemaProvider { + + private val value: Double = -4.9E-324 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt new file mode 100644 index 00000000..1c887d63 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesDoubleTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesDoubleTest: SchemaProvider { + + private val value: Double = 123.456 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt new file mode 100644 index 00000000..02d07659 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMaximumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntMaximumTest: SchemaProvider { + + private val value: Int = 2147483647 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt new file mode 100644 index 00000000..e3cfeea5 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntMinimumTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntMinimumTest: SchemaProvider { + + private val value: Int = -2147483648 + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt new file mode 100644 index 00000000..d6e677e9 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesIntTest.kt @@ -0,0 +1,28 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesIntTest: SchemaProvider { + + private val value: Int = 0 + + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt new file mode 100644 index 00000000..ff007981 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesNullTest.kt @@ -0,0 +1,27 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesNullTest: SchemaProvider { + + private val value = null + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(value) + .defaultValue(value) + .examples(listOf(value)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt new file mode 100644 index 00000000..56e24799 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/json/properties/ConstDefaultExamplesObjectTest.kt @@ -0,0 +1,35 @@ +package com.asyncapi.v3.schema.json.properties + +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.SchemaProvider + +class ConstDefaultExamplesObjectTest: SchemaProvider { + + private val jsonValue = JsonSchema.builder() + .type("string") + .constValue("abc") + .build() + + private val asyncapiValue = AsyncAPISchema.builder() + .type("string") + .constValue("abc") + .build() + + override fun jsonSchema(): JsonSchema { + return JsonSchema.builder() + .constValue(jsonValue) + .defaultValue(jsonValue) + .examples(listOf(jsonValue)) + .build() + } + + override fun asyncAPISchema(): AsyncAPISchema { + return AsyncAPISchema.builder() + .constValue(asyncapiValue) + .defaultValue(asyncapiValue) + .examples(listOf(asyncapiValue)) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json deleted file mode 100644 index 39588384..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/bigdecimal.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "const": -214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648 - }, - { - "const": 123456789021474836471234567890214748364712345678902147483647.123456789021474836471234567890214748364712345678902147483647 - }, - { - "const": 214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json deleted file mode 100644 index 58c491e1..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/biginteger.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "const": -214748364821474836482147483648 - }, - { - "const": 12345678902147483647 - }, - { - "const": 214748364721474836472147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json deleted file mode 100644 index 8aced380..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/boolean.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "const": false - }, - { - "const": true - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json deleted file mode 100644 index 39b90e3b..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/double.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "const": -4.9E-324 - }, - { - "const": 123.456 - }, - { - "const": 1.7976931348623157E308 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json deleted file mode 100644 index 545ea19b..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/float.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "const": 1.4E-45 - }, - { - "const": 1234567890.1234567890 - }, - { - "const": 3.4028235E38 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json deleted file mode 100644 index f11d60bb..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/int.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "const": -2147483648 - }, - { - "const": 0 - }, - { - "const": 2147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json deleted file mode 100644 index 778a3475..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/null.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "const": null - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json deleted file mode 100644 index f905ed37..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/const/object.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "const": { - "type": "string", - "const": "abc" - } - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json deleted file mode 100644 index 9850c521..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/bigdecimal.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "default": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648 - }, - { - "default": 1.123456789021474836471234567890214748364712345678902147483647 - }, - { - "default": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json deleted file mode 100644 index 75183ff6..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/biginteger.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "default": -214748364821474836482147483648 - }, - { - "default": 12345678902147483647 - }, - { - "default": 214748364721474836472147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json deleted file mode 100644 index e34bc4fe..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/boolean.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "default": false - }, - { - "default": true - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json deleted file mode 100644 index 1f169274..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/double.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "default": -4.9E-324 - }, - { - "default": 123.456 - }, - { - "default": 1.7976931348623157E308 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json deleted file mode 100644 index 1d993a0f..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/float.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "default": -1.1234567890 - }, - { - "default": 0.123 - }, - { - "default": 3.4028235E38 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json deleted file mode 100644 index c97ab553..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/int.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "default": -2147483648 - }, - { - "default": 0 - }, - { - "default": 2147483647 - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json deleted file mode 100644 index f32c4b28..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/null.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "default": null - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json deleted file mode 100644 index 29772bd3..00000000 --- a/asyncapi-core/src/test/resources/json/v3/schema/json/default/object.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "default": { - "type": "string", - "const": "abc" - } - } -] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json new file mode 100644 index 00000000..fc113a02 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/array.json @@ -0,0 +1,106 @@ +{ + "const": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + } + ], + "default": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + } + ], + "examples": [ + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3, + { + "type": "string", + "const": "abc", + "examples": [ + { + "type": "string", + "const": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + } + ] + ] + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json new file mode 100644 index 00000000..032583ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647, + "default": 2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647, + "examples": [2.214748364721474836472147483647214748364721474836472147483647214748364721474836472147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json new file mode 100644 index 00000000..c68594d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648, + "default": -2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648, + "examples": [-2.214748364821474836482147483648214748364821474836482147483648214748364821474836482147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json new file mode 100644 index 00000000..980cdec4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/bigdecimal.json @@ -0,0 +1,5 @@ +{ + "const": 1.123456789021474836471234567890214748364712345678902147483647, + "default": 1.123456789021474836471234567890214748364712345678902147483647, + "examples": [1.123456789021474836471234567890214748364712345678902147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json new file mode 100644 index 00000000..1043bf67 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 214748364721474836472147483647, + "default": 214748364721474836472147483647, + "examples": [214748364721474836472147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json new file mode 100644 index 00000000..963dc327 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -214748364821474836482147483648, + "default": -214748364821474836482147483648, + "examples": [-214748364821474836482147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json new file mode 100644 index 00000000..62fabf8b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/biginteger.json @@ -0,0 +1,5 @@ +{ + "const": 12345678902147483647, + "default": 12345678902147483647, + "examples": [12345678902147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json new file mode 100644 index 00000000..45ceebb8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-false.json @@ -0,0 +1,5 @@ +{ + "const": false, + "default": false, + "examples": [false] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json new file mode 100644 index 00000000..58ac5c98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/boolean-true.json @@ -0,0 +1,5 @@ +{ + "const": true, + "default": true, + "examples": [true] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json new file mode 100644 index 00000000..7bcc4bbc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 1.7976931348623157E308, + "default": 1.7976931348623157E308, + "examples": [1.7976931348623157E308] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json new file mode 100644 index 00000000..569f14fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -4.9E-324, + "default": -4.9E-324, + "examples": [-4.9E-324] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json new file mode 100644 index 00000000..7840b2cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/double.json @@ -0,0 +1,5 @@ +{ + "const": 123.456, + "default": 123.456, + "examples": [123.456] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json new file mode 100644 index 00000000..4e921565 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 3.4028234, + "default": 3.4028234, + "examples": [3.4028234] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json new file mode 100644 index 00000000..f684d466 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -0.000001, + "default": -0.000001, + "examples": [-0.000001] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json new file mode 100644 index 00000000..181f520d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/float.json @@ -0,0 +1,5 @@ +{ + "const": 1.1234567, + "default": 1.1234567, + "examples": [1.1234567] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json new file mode 100644 index 00000000..1283cc6f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-maximum.json @@ -0,0 +1,5 @@ +{ + "const": 2147483647, + "default": 2147483647, + "examples": [2147483647] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json new file mode 100644 index 00000000..e6527f86 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int-minimum.json @@ -0,0 +1,5 @@ +{ + "const": -2147483648, + "default": -2147483648, + "examples": [-2147483648] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json new file mode 100644 index 00000000..2a5a4b6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/int.json @@ -0,0 +1,5 @@ +{ + "const": 0, + "default": 0, + "examples": [0] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json new file mode 100644 index 00000000..88f688df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/null.json @@ -0,0 +1,5 @@ +{ + "const": null, + "default": null, + "examples": [null] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json new file mode 100644 index 00000000..f1d4fbba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/json/properties/object.json @@ -0,0 +1,16 @@ +{ + "const": { + "type": "string", + "const": "abc" + }, + "default": { + "type": "string", + "const": "abc" + }, + "examples": [ + { + "type": "string", + "const": "abc" + } + ] +} \ No newline at end of file From 8c3fbbab9d839a6ac6deb7811aa285121237a588 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 2 Apr 2024 23:20:09 +0400 Subject: [PATCH 20/44] build: 1.0.0-RC-SNAPSHOT --- CHANGELOG.md | 2 ++ asyncapi-core/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8903129..e605ac62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.0-EAP-3] - TBA + ## [1.0.0-EAP-3] - 2024-03-10 Kudos to: diff --git a/asyncapi-core/pom.xml b/asyncapi-core/pom.xml index ad3d103a..47158ee3 100644 --- a/asyncapi-core/pom.xml +++ b/asyncapi-core/pom.xml @@ -6,7 +6,7 @@ asyncapi com.asyncapi - 1.0.0-EAP-3 + 1.0.0-RC-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index d833a672..29ac8613 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.asyncapi asyncapi - 1.0.0-EAP-3 + 1.0.0-RC-SNAPSHOT AsyncAPI From 46b5e87c7dffce973730633ab1796c2b13514b09 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Thu, 4 Apr 2024 20:40:33 +0400 Subject: [PATCH 21/44] feat(openapi) OpenAPI Schema https://github.com/asyncapi/jasyncapi/issues/185 --- ...chemaAdditionalPropertiesDeserializer.java | 36 + .../OpenAPISchemaAnyValueDeserializer.java | 16 + .../v3/schema/openapi/Discriminator.java | 55 ++ .../schema/openapi/ExternalDocumentation.java | 47 + .../v3/schema/openapi/OpenAPISchema.java | 920 ++++++++++++++++++ .../com/asyncapi/v3/schema/openapi/XML.java | 90 ++ .../com/asyncapi/v3/schema/SchemaProvider.kt | 8 +- .../v3/schema/openapi/OpenAPISchemaTest.kt | 142 +++ .../asyncapi/v3/schema/openapi/SchemaTest.kt | 168 ++++ .../properties/ExampleEnumDefaultArrayTest.kt | 43 + .../properties/ExampleEnumDefaultNullTest.kt | 18 + .../openapi/discriminator-propertyname.json | 3 + .../json/v3/schema/openapi/discriminator.json | 7 + .../openapi/externaldocumentation-url.json | 3 + .../schema/openapi/externaldocumentation.json | 4 + .../v3/schema/openapi/properties/array.json | 65 ++ .../v3/schema/openapi/properties/null.json | 5 + .../json/v3/schema/openapi/schema.json | 174 ++++ .../json/v3/schema/openapi/xml-attribute.json | 3 + .../schema/openapi/xml-name-replacement.json | 3 + .../openapi/xml-prefix-and-namespace.json | 4 + .../json/v3/schema/openapi/xml-wrapped.json | 3 + .../resources/json/v3/schema/openapi/xml.json | 7 + 23 files changed, 1822 insertions(+), 2 deletions(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java new file mode 100644 index 00000000..e9470ce5 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java @@ -0,0 +1,36 @@ +package com.asyncapi.v3.jackson.schema.openapi; + +import com.asyncapi.v3.schema.openapi.OpenAPISchema; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; + +/** + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +public class OpenAPISchemaAdditionalPropertiesDeserializer extends JsonDeserializer { + + @Override + public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + if (jsonNode.isBoolean()) { + return jsonNode.asBoolean(); + } else { + return jsonParser.readValueAs(OpenAPISchema.class); + } + } + } +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java new file mode 100644 index 00000000..b881e1ba --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java @@ -0,0 +1,16 @@ +package com.asyncapi.v3.jackson.schema.openapi; + +import com.asyncapi.v3.jackson.schema.SchemaAnyValueDeserializer; +import com.asyncapi.v3.schema.openapi.OpenAPISchema; + +/** + * @author Pavel Bodiachevskii + */ +public class OpenAPISchemaAnyValueDeserializer extends SchemaAnyValueDeserializer { + + @Override + public Class schemaClass() { + return OpenAPISchema.class; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java new file mode 100644 index 00000000..5ebb1431 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java @@ -0,0 +1,55 @@ +package com.asyncapi.v3.schema.openapi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +/** + * When request bodies or response payloads may be one of a number of different schemas, + * a discriminator object can be used to aid in serialization, deserialization, and validation. + *

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

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

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

+ * The name of the property in the payload that will hold the discriminator value. + */ + @NotNull + @JsonProperty("propertyName") + @JsonPropertyDescription("The name of the property in the payload that will hold the discriminator value.") + public String propertyName; + + /** + * An object to hold mappings between payload values and schema names or references. + */ + @Nullable + @JsonProperty("mapping") + @JsonPropertyDescription("An object to hold mappings between payload values and schema names or references.") + public Map mapping; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java new file mode 100644 index 00000000..1f58895b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java @@ -0,0 +1,47 @@ +package com.asyncapi.v3.schema.openapi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Allows referencing an external resource for extended documentation. + * + * @see Schema Object + * @see ExternalDocumentation + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ExternalDocumentation { + + /** + * A short description of the target documentation. + *

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

+ * The URL for the target documentation. Value MUST be in the format of a URL. + */ + @NotNull + @JsonProperty("url") + @JsonPropertyDescription("The URL for the target documentation.") + public String url; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java new file mode 100644 index 00000000..19c57b67 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java @@ -0,0 +1,920 @@ +package com.asyncapi.v3.schema.openapi; + +import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAdditionalPropertiesDeserializer; +import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAnyValueDeserializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * The Schema Object allows the definition of input and output data types. + *

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

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

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

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

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

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

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

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

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

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

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

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

+ * OpenAPI defines the following basic types: + *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ * For example, the following declaration — + *

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

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

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

{@code
+     * paths:
+     *   /items:
+     *     get:
+     *       parameters:
+     *         - in: query
+     *           name: sort
+     *           description: Sort order
+     *           schema:
+     *             type: string
+     *             enum: [asc, desc]
+     * }
+ * + * A nullable enum can be defined as follows: + *
{@code
+     * type: string
+     * nullable: true  # <---
+     * enum:
+     *   - asc
+     *   - desc
+     *   - null        # <--- without quotes, i.e. null not "null"
+     * }
+ * + * @see Enums + */ + @Nullable + @JsonProperty("enum") + @JsonDeserialize(contentUsing = OpenAPISchemaAnyValueDeserializer.class) + public List enumValue; + + /** + * Default value. + */ + @Nullable + @JsonProperty("default") + @JsonDeserialize(using = OpenAPISchemaAnyValueDeserializer.class) + public Object defaultValue; + + /** + * {@link Discriminator} + */ + @Nullable + @JsonProperty("discriminator") + public Discriminator discriminator; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java new file mode 100644 index 00000000..3cb9d85f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java @@ -0,0 +1,90 @@ +package com.asyncapi.v3.schema.openapi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +/** + * XML + * + * @see XML Object + * @see XML + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class XML { + + /** + * Replaces the name of the element/attribute used for the described schema property. + *

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

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

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

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

+ * Signifies whether the array is wrapped: + *

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

+ * Default value is false. + *

+ * The definition takes effect only when defined alongside type being array (outside the items). + * + * @see XML Fixed Fields: wrapped + */ + public Boolean wrapped; + +} diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt index 307ad9db..e4ee8ea2 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -1,9 +1,13 @@ package com.asyncapi.v3.schema +import com.asyncapi.v3.schema.openapi.OpenAPISchema + interface SchemaProvider { - fun jsonSchema(): JsonSchema + fun jsonSchema(): JsonSchema = JsonSchema() + + fun asyncAPISchema(): AsyncAPISchema = AsyncAPISchema() - fun asyncAPISchema(): AsyncAPISchema + fun openAPISchema(): OpenAPISchema = OpenAPISchema() } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt new file mode 100644 index 00000000..618fe5ad --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt @@ -0,0 +1,142 @@ +package com.asyncapi.v3.schema.openapi + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.properties.ExampleEnumDefaultArrayTest +import com.asyncapi.v3.schema.openapi.properties.ExampleEnumDefaultNullTest +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class OpenAPISchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + + @Nested + inner class XMLTest { + + @ArgumentsSource(XMLs::class) + @ParameterizedTest(name = "Read: {0}") + fun read(xmlToRead: String, xmlToCheck: XML) { + val xmlString = ClasspathUtils.readAsString(xmlToRead) + val xml = objectMapper.readValue(xmlString, XML::class.java) + + Assertions.assertEquals(xml, xmlToCheck) + } + + } + + @Nested + inner class DiscriminatorTest { + + @ArgumentsSource(Discriminators::class) + @ParameterizedTest(name = "Read: {0}") + fun read(discriminatorToRead: String, discriminatorToCheck: Discriminator) { + val discriminatorString = ClasspathUtils.readAsString(discriminatorToRead) + val discriminator = objectMapper.readValue(discriminatorString, Discriminator::class.java) + + Assertions.assertEquals(discriminator, discriminatorToCheck) + } + + } + + @Nested + inner class ExternalDocumentationTest { + + @ArgumentsSource(ExternalDocumentations::class) + @ParameterizedTest(name = "Read: {0}") + fun read(discriminatorToRead: String, externalDocumentationToCheck: ExternalDocumentation) { + val externalDocumentationString = ClasspathUtils.readAsString(discriminatorToRead) + val externalDocumentation = objectMapper.readValue(externalDocumentationString, ExternalDocumentation::class.java) + + Assertions.assertEquals(externalDocumentation, externalDocumentationToCheck) + } + + } + + @Nested + inner class SchemaTest { + + @ArgumentsSource(Schemas::class) + @ParameterizedTest(name = "Read: {0}") + fun read(schemaToRead: String, schemaToCheck: SchemaProvider) { + val externalDocumentationString = ClasspathUtils.readAsString(schemaToRead) + val externalDocumentation = objectMapper.readValue(externalDocumentationString, OpenAPISchema::class.java) + + Assertions.assertEquals(externalDocumentation, schemaToCheck.openAPISchema()) + } + + } + + class XMLs: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/xml.json", XML( + "animal", "http://example.com/schema/sample", "sample", true, true + )), + Arguments.of("/json/v3/schema/openapi/xml-attribute.json", XML.builder().attribute(true).build()), + Arguments.of("/json/v3/schema/openapi/xml-name-replacement.json", XML.builder().name("animal").build()), + Arguments.of("/json/v3/schema/openapi/xml-prefix-and-namespace.json", XML.builder() + .namespace("http://example.com/schema/sample") + .prefix("sample").build() + ), + Arguments.of("/json/v3/schema/openapi/xml-wrapped.json", XML.builder().wrapped(true).build()), + ) + } + + } + + class Discriminators: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/discriminator.json", Discriminator.builder() + .propertyName("pet_type") + .mapping(mapOf( + Pair("dog", "#/components/schemas/Dog"), + Pair("monster", "https://gigantic-server.com/schemas/Monster/schema.json"), + )).build() + ), + Arguments.of("/json/v3/schema/openapi/discriminator-propertyname.json", Discriminator.builder().propertyName("pet_type").build()), + ) + } + + } + + class ExternalDocumentations: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/externaldocumentation.json", ExternalDocumentation( + "Find more info here", "https://example.com" + )), + Arguments.of("/json/v3/schema/openapi/externaldocumentation-url.json", ExternalDocumentation( + null, "https://example.com" + )), + ) + } + + } + + class Schemas: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/openapi/schema.json", SchemaTest()), + Arguments.of("/json/v3/schema/openapi/properties/array.json", ExampleEnumDefaultArrayTest()), + Arguments.of("/json/v3/schema/openapi/properties/null.json", ExampleEnumDefaultNullTest()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt new file mode 100644 index 00000000..e75fa004 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt @@ -0,0 +1,168 @@ +package com.asyncapi.v3.schema.openapi + +import com.asyncapi.v3.schema.SchemaProvider +import java.math.BigDecimal + +class SchemaTest: SchemaProvider { + + override fun openAPISchema(): OpenAPISchema { + return OpenAPISchema.builder() + .name("schema name") + .title("schema title") + .multipleOf(BigDecimal(2.5)) + .maximum(BigDecimal(100)) + .exclusiveMaximum(true) + .minimum(BigDecimal(0)) + .exclusiveMinimum(true) + .maxLength(3) + .minLength(20) + .pattern("^\\d{3}-\\d{2}-\\d{4}$") + .maxItems(10) + .minItems(1) + .uniqueItems(true) + .maxProperties(10) + .minProperties(2) + .required(listOf("id", "username")) + .type("object") + .allOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/Pet").build(), + OpenAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("hunts", OpenAPISchema.builder().type("boolean").build()), + Pair("age", OpenAPISchema.builder().type("integer").build()) + )) + .build() + )) + .anyOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/PetByAge").build(), + OpenAPISchema.builder() + .name("Pet by age") + .type("object") + .properties(mapOf( + Pair("age", OpenAPISchema.builder().type("integer").build()), + Pair("nickname", OpenAPISchema.builder().type("string").build()) + )) + .build(), + OpenAPISchema.builder().ref("#/components/schemas/PetByType").build(), + OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + )) + .oneOf(listOf( + OpenAPISchema.builder().ref("#/components/schemas/PetByAge").build(), + OpenAPISchema.builder() + .name("Pet by age") + .type("object") + .properties(mapOf( + Pair("age", OpenAPISchema.builder().type("integer").build()), + Pair("nickname", OpenAPISchema.builder().type("string").build()) + )) + .build(), + OpenAPISchema.builder().ref("#/components/schemas/PetByType").build(), + OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + )) + .not(OpenAPISchema.builder() + .name("Pet by type") + .type("object") + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog")) + .build()) + , + Pair("hunts", OpenAPISchema.builder().type("boolean").build()) + )) + .required(listOf("pet_type")) + .build() + ) + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog", "Owl")) + .build() + ), + Pair("hunts", OpenAPISchema.builder() + .type("boolean") + .build() + ) + )) + .additionalProperties(OpenAPISchema.builder() + .properties(mapOf( + Pair("pet_type", OpenAPISchema.builder() + .type("string") + .enumValue(listOf("Cat", "Dog", "Owl")) + .additionalProperties(false) + .build() + ) + )) + .additionalProperties(OpenAPISchema.builder() + .properties(mapOf( + Pair("hunts", OpenAPISchema.builder() + .type("boolean") + .build() + ) + )) + .build() + ) + .build() + ) + .description("schema description") + .format("uri") + .ref("#/components/example/ref") + .nullable(true) + .readOnly(true) + .writeOnly(true) + .example(OpenAPISchema.builder() + .type("string") + .enumValue(listOf("approved", "pending", "closed", "new")) + .example("approved") + .build() + ) + .externalDocs(ExternalDocumentation( + "external docs description", + "https://example.docs/this" + )) + .deprecated(true) + .xml(XML( + "animal", + "http://example.com/schema/sample", + "sample", + true, + true + )) + .enumValue(listOf("asc", "desc", null)) + .defaultValue(listOf("asc", "desc", null)) + .discriminator(Discriminator( + "pet_type", + mapOf( + Pair("dog", "#/components/schemas/Dog"), + Pair("monster", "https://gigantic-server.com/schemas/Monster/schema.json"), + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt new file mode 100644 index 00000000..e4c435ac --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt @@ -0,0 +1,43 @@ +package com.asyncapi.v3.schema.openapi.properties + +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.OpenAPISchema + +class ExampleEnumDefaultArrayTest: SchemaProvider { + + private val value = listOf( + 42, + true, + "hello", + null, + listOf( + 1, + 2, + 3, + OpenAPISchema.builder() + .type("string") + .defaultValue("abc") + .example(listOf( + OpenAPISchema.builder() + .type("string") + .defaultValue("abc") + .build(), + 42, + true, + "hello", + null, + listOf(1, 2, 3) + )) + .build() + ) + ) + + override fun openAPISchema(): OpenAPISchema { + return OpenAPISchema.builder() + .example(value) + .enumValue(value) + .defaultValue(value) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt new file mode 100644 index 00000000..4e79cd5e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt @@ -0,0 +1,18 @@ +package com.asyncapi.v3.schema.openapi.properties + +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.OpenAPISchema + +class ExampleEnumDefaultNullTest: SchemaProvider { + + private val value = null + + override fun openAPISchema(): OpenAPISchema { + return OpenAPISchema.builder() + .example(value) + .enumValue(value) + .defaultValue(value) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json new file mode 100644 index 00000000..5db0d535 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator-propertyname.json @@ -0,0 +1,3 @@ +{ + "propertyName": "pet_type" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json new file mode 100644 index 00000000..e37ee7d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/discriminator.json @@ -0,0 +1,7 @@ +{ + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json new file mode 100644 index 00000000..1f125af4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation-url.json @@ -0,0 +1,3 @@ +{ + "url": "https://example.com" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json new file mode 100644 index 00000000..19ba32ce --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json @@ -0,0 +1,4 @@ +{ + "description": "Find more info here", + "url": "https://example.com" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json new file mode 100644 index 00000000..9a24444f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/array.json @@ -0,0 +1,65 @@ +{ + "example": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ], + "enum": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ], + "default": [ + 42, + true, + "hello", + null, + [1, 2, 3, { + "type": "string", + "default": "abc", + "example": [ + { + "type": "string", + "default": "abc" + }, + 42, + true, + "hello", + null, + [1, 2, 3] + ] + }] + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json new file mode 100644 index 00000000..8016ff6a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/properties/null.json @@ -0,0 +1,5 @@ +{ + "example": null, + "enum": null, + "default": null +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json new file mode 100644 index 00000000..f5f9add9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json @@ -0,0 +1,174 @@ +{ + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json new file mode 100644 index 00000000..73eaca92 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-attribute.json @@ -0,0 +1,3 @@ +{ + "attribute": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json new file mode 100644 index 00000000..68520200 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-name-replacement.json @@ -0,0 +1,3 @@ +{ + "name": "animal" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json new file mode 100644 index 00000000..d7a8bda6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-prefix-and-namespace.json @@ -0,0 +1,4 @@ +{ + "namespace": "http://example.com/schema/sample", + "prefix": "sample" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json new file mode 100644 index 00000000..7d4ad6f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml-wrapped.json @@ -0,0 +1,3 @@ +{ + "wrapped": true +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json new file mode 100644 index 00000000..d8eaf4dc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json @@ -0,0 +1,7 @@ +{ + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true +} \ No newline at end of file From 5e7e58b5ae1ffedd2d9e14973dcb19df630160ef Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 6 Apr 2024 12:52:47 +0400 Subject: [PATCH 22/44] feat(openapi) OpenAPI Schema extensions https://github.com/asyncapi/jasyncapi/issues/185 --- .../v3/schema/openapi/OpenAPISchema.java | 12 +++-- .../{ => properties}/Discriminator.java | 2 +- .../schema/openapi/properties/Extensions.java | 46 +++++++++++++++++++ .../ExternalDocumentation.java | 10 ++-- .../schema/openapi/{ => properties}/XML.java | 10 ++-- .../v3/schema/openapi/OpenAPISchemaTest.kt | 19 ++++---- .../asyncapi/v3/schema/openapi/SchemaTest.kt | 8 +++- .../schema/openapi/externaldocumentation.json | 3 +- .../json/v3/schema/openapi/schema.json | 3 +- .../resources/json/v3/schema/openapi/xml.json | 3 +- 10 files changed, 86 insertions(+), 30 deletions(-) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => properties}/Discriminator.java (97%) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => properties}/ExternalDocumentation.java (87%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => properties}/XML.java (94%) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java index 19c57b67..313094b0 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java @@ -2,12 +2,13 @@ import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAdditionalPropertiesDeserializer; import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAnyValueDeserializer; +import com.asyncapi.v3.schema.openapi.properties.Discriminator; +import com.asyncapi.v3.schema.openapi.properties.Extensions; +import com.asyncapi.v3.schema.openapi.properties.ExternalDocumentation; +import com.asyncapi.v3.schema.openapi.properties.XML; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; import org.jetbrains.annotations.Nullable; import java.math.BigDecimal; @@ -34,7 +35,8 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class OpenAPISchema { +@EqualsAndHashCode(callSuper = true) +public class OpenAPISchema extends Extensions { /** * Schema name. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java similarity index 97% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java index 5ebb1431..ca5ab32c 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/Discriminator.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.openapi; +package com.asyncapi.v3.schema.openapi.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java new file mode 100644 index 00000000..042bd076 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java @@ -0,0 +1,46 @@ +package com.asyncapi.v3.schema.openapi.properties; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +/** + * @see Specification Extensions + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties({"extensions"}) +public class Extensions { + + private static final Pattern extensionPropertyNamePattern = Pattern.compile("^x-.*"); + + /** + * Extension fields in the form x-extension-field-name for the exposed API. + */ + @Nullable + @JsonAnyGetter + protected Map extensions; + + @JsonAnySetter + protected final void readExtensionProperty(String name, Object value) { + if (extensionPropertyNamePattern.matcher(name).matches()) { + if (extensions == null) { + extensions = new HashMap<>(); + } + + extensions.put(name, value); + } else { + throw new IllegalArgumentException(String.format("\"%s\" is not valid extension property", name)); + } + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java similarity index 87% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java index 1f58895b..e3cb9e9d 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/ExternalDocumentation.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java @@ -1,11 +1,8 @@ -package com.asyncapi.v3.schema.openapi; +package com.asyncapi.v3.schema.openapi.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -22,7 +19,8 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class ExternalDocumentation { +@EqualsAndHashCode(callSuper = true) +public class ExternalDocumentation extends Extensions { /** * A short description of the target documentation. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java similarity index 94% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java index 3cb9d85f..cfd5a0de 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/XML.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java @@ -1,11 +1,8 @@ -package com.asyncapi.v3.schema.openapi; +package com.asyncapi.v3.schema.openapi.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; import org.jetbrains.annotations.Nullable; /** @@ -21,7 +18,8 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class XML { +@EqualsAndHashCode(callSuper = true) +public class XML extends Extensions { /** * Replaces the name of the element/attribute used for the described schema property. diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt index 618fe5ad..13ccc763 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt @@ -2,8 +2,7 @@ package com.asyncapi.v3.schema.openapi import com.asyncapi.v3.ClasspathUtils import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.openapi.properties.ExampleEnumDefaultArrayTest -import com.asyncapi.v3.schema.openapi.properties.ExampleEnumDefaultNullTest +import com.asyncapi.v3.schema.openapi.properties.* import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import org.junit.jupiter.api.Assertions @@ -79,10 +78,13 @@ class OpenAPISchemaTest { class XMLs: ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream { + val extendedXML = XML( + "animal", "http://example.com/schema/sample", "sample", true, true + ) + extendedXML.extensions = mapOf(Pair("x-extension-property", "value")) + return Stream.of( - Arguments.of("/json/v3/schema/openapi/xml.json", XML( - "animal", "http://example.com/schema/sample", "sample", true, true - )), + Arguments.of("/json/v3/schema/openapi/xml.json", extendedXML), Arguments.of("/json/v3/schema/openapi/xml-attribute.json", XML.builder().attribute(true).build()), Arguments.of("/json/v3/schema/openapi/xml-name-replacement.json", XML.builder().name("animal").build()), Arguments.of("/json/v3/schema/openapi/xml-prefix-and-namespace.json", XML.builder() @@ -115,10 +117,11 @@ class OpenAPISchemaTest { class ExternalDocumentations: ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream { + val extendedExternalDocumentation = ExternalDocumentation("Find more info here", "https://example.com") + extendedExternalDocumentation.extensions = mapOf(Pair("x-extension-property", "value")) + return Stream.of( - Arguments.of("/json/v3/schema/openapi/externaldocumentation.json", ExternalDocumentation( - "Find more info here", "https://example.com" - )), + Arguments.of("/json/v3/schema/openapi/externaldocumentation.json", extendedExternalDocumentation), Arguments.of("/json/v3/schema/openapi/externaldocumentation-url.json", ExternalDocumentation( null, "https://example.com" )), diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt index e75fa004..c0c9f91f 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt @@ -1,12 +1,15 @@ package com.asyncapi.v3.schema.openapi import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.openapi.properties.Discriminator +import com.asyncapi.v3.schema.openapi.properties.ExternalDocumentation +import com.asyncapi.v3.schema.openapi.properties.XML import java.math.BigDecimal class SchemaTest: SchemaProvider { override fun openAPISchema(): OpenAPISchema { - return OpenAPISchema.builder() + val schema = OpenAPISchema.builder() .name("schema name") .title("schema title") .multipleOf(BigDecimal(2.5)) @@ -163,6 +166,9 @@ class SchemaTest: SchemaProvider { ) )) .build() + schema.extensions = mapOf(Pair("x-extension-property", "value")) + + return schema } } \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json index 19ba32ce..20aa0964 100644 --- a/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/externaldocumentation.json @@ -1,4 +1,5 @@ { "description": "Find more info here", - "url": "https://example.com" + "url": "https://example.com", + "x-extension-property": "value" } \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json index f5f9add9..0c529e6b 100644 --- a/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/schema.json @@ -170,5 +170,6 @@ "dog": "#/components/schemas/Dog", "monster": "https://gigantic-server.com/schemas/Monster/schema.json" } - } + }, + "x-extension-property": "value" } \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json index d8eaf4dc..dfe05fba 100644 --- a/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json +++ b/asyncapi-core/src/test/resources/json/v3/schema/openapi/xml.json @@ -3,5 +3,6 @@ "namespace": "http://example.com/schema/sample", "prefix": "sample", "attribute": true, - "wrapped": true + "wrapped": true, + "x-extension-property": "value" } \ No newline at end of file From 38b8219dedaaa71e16bcd79267e1ad4fc002c2e3 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Wed, 10 Apr 2024 21:09:55 +0400 Subject: [PATCH 23/44] feat(schemaFormat): support AsyncAPI, OpenAPI and Json Schemas https://github.com/asyncapi/jasyncapi/issues/185 --- .../message/MessageHeadersDeserializer.java | 2 +- .../message/MessagePayloadDeserializer.java | 2 +- .../ComponentsSchemasDeserializer.java | 2 +- .../_0_0/model/channel/message/Message.java | 5 +- .../model/channel/message/MessageTrait.java | 3 +- .../v3/_0_0/model/component/Components.java | 2 +- .../asyncapi/v3/schema/AsyncAPISchema.java | 1 + .../asyncapi/v3/schema/MultiFormatSchema.java | 66 -- .../multiformat/AsyncAPIFormatSchema.java | 53 ++ .../schema/multiformat/JsonFormatSchema.java | 44 ++ .../schema/multiformat/MultiFormatSchema.java | 145 ++++ .../multiformat/OpenAPIFormatSchema.java | 44 ++ .../v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt | 4 +- .../v3/_0_0/GitterStreamingAsyncAPI.kt | 284 ++++---- .../_0_0/model/channel/message/MessageTest.kt | 62 +- .../model/channel/message/MessageTraitTest.kt | 36 +- .../v3/_0_0/model/component/ComponentsTest.kt | 34 +- .../com/asyncapi/v3/schema/SchemaProvider.kt | 45 ++ .../multiformat/MultiFormatSchemaTest.kt | 678 ++++++++++++++++++ .../v3/3.0.0/model/asyncapi - extended.json | 190 ++--- .../json/v3/3.0.0/model/asyncapi.json | 2 +- .../model/channel/channel - extended.json | 36 +- .../channel with reference - extended.json | 36 +- .../channel/message/message - extended.json | 8 +- .../channel/message/message 2 - extended.json | 20 +- .../message with reference - extended.json | 8 +- .../message/messageTrait 2 - extended.json | 8 +- .../components/components - extended.json | 118 +-- .../components - wrongly extended.json | 2 +- .../v3/3.0.0/model/components/components.json | 2 +- .../asyncapi/2.0.0/arrays.schema.json | 37 + .../asyncapi/2.0.0/arrays.schema.yaml | 28 + .../asyncapi/2.0.0/complex-object.schema.json | 44 ++ .../asyncapi/2.0.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.0.0/enumerated-values.schema.json | 14 + .../2.0.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.0.0/person.schema.json | 24 + .../asyncapi/2.0.0/person.schema.yaml | 17 + .../asyncapi/2.0.0/regex-pattern.schema.json | 15 + .../asyncapi/2.0.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.1.0/arrays.schema.json | 37 + .../asyncapi/2.1.0/arrays.schema.yaml | 28 + .../asyncapi/2.1.0/complex-object.schema.json | 44 ++ .../asyncapi/2.1.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.1.0/enumerated-values.schema.json | 14 + .../2.1.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.1.0/person.schema.json | 24 + .../asyncapi/2.1.0/person.schema.yaml | 17 + .../asyncapi/2.1.0/regex-pattern.schema.json | 15 + .../asyncapi/2.1.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.2.0/arrays.schema.json | 37 + .../asyncapi/2.2.0/arrays.schema.yaml | 28 + .../asyncapi/2.2.0/complex-object.schema.json | 44 ++ .../asyncapi/2.2.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.2.0/enumerated-values.schema.json | 14 + .../2.2.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.2.0/person.schema.json | 24 + .../asyncapi/2.2.0/person.schema.yaml | 17 + .../asyncapi/2.2.0/regex-pattern.schema.json | 15 + .../asyncapi/2.2.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.3.0/arrays.schema.json | 37 + .../asyncapi/2.3.0/arrays.schema.yaml | 28 + .../asyncapi/2.3.0/complex-object.schema.json | 44 ++ .../asyncapi/2.3.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.3.0/enumerated-values.schema.json | 14 + .../2.3.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.3.0/person.schema.json | 24 + .../asyncapi/2.3.0/person.schema.yaml | 17 + .../asyncapi/2.3.0/regex-pattern.schema.json | 15 + .../asyncapi/2.3.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.4.0/arrays.schema.json | 37 + .../asyncapi/2.4.0/arrays.schema.yaml | 28 + .../asyncapi/2.4.0/complex-object.schema.json | 44 ++ .../asyncapi/2.4.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.4.0/enumerated-values.schema.json | 14 + .../2.4.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.4.0/person.schema.json | 24 + .../asyncapi/2.4.0/person.schema.yaml | 17 + .../asyncapi/2.4.0/regex-pattern.schema.json | 15 + .../asyncapi/2.4.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.5.0/arrays.schema.json | 37 + .../asyncapi/2.5.0/arrays.schema.yaml | 28 + .../asyncapi/2.5.0/complex-object.schema.json | 44 ++ .../asyncapi/2.5.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.5.0/enumerated-values.schema.json | 14 + .../2.5.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.5.0/person.schema.json | 24 + .../asyncapi/2.5.0/person.schema.yaml | 17 + .../asyncapi/2.5.0/regex-pattern.schema.json | 15 + .../asyncapi/2.5.0/regex-pattern.schema.yaml | 10 + .../asyncapi/2.6.0/arrays.schema.json | 37 + .../asyncapi/2.6.0/arrays.schema.yaml | 28 + .../asyncapi/2.6.0/complex-object.schema.json | 44 ++ .../asyncapi/2.6.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../2.6.0/enumerated-values.schema.json | 14 + .../2.6.0/enumerated-values.schema.yaml | 16 + .../asyncapi/2.6.0/person.schema.json | 24 + .../asyncapi/2.6.0/person.schema.yaml | 17 + .../asyncapi/2.6.0/regex-pattern.schema.json | 15 + .../asyncapi/2.6.0/regex-pattern.schema.yaml | 10 + .../asyncapi/3.0.0/arrays.schema.json | 37 + .../asyncapi/3.0.0/arrays.schema.yaml | 28 + .../asyncapi/3.0.0/complex-object.schema.json | 44 ++ .../asyncapi/3.0.0/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../3.0.0/enumerated-values.schema.json | 14 + .../3.0.0/enumerated-values.schema.yaml | 16 + .../asyncapi/3.0.0/person.schema.json | 24 + .../asyncapi/3.0.0/person.schema.yaml | 17 + .../asyncapi/3.0.0/regex-pattern.schema.json | 15 + .../asyncapi/3.0.0/regex-pattern.schema.yaml | 10 + .../multiformat/json/arrays.schema.json | 37 + .../multiformat/json/arrays.schema.yaml | 28 + .../json/complex-object.schema.json | 44 ++ .../json/complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../json/enumerated-values.schema.json | 14 + .../json/enumerated-values.schema.yaml | 16 + .../multiformat/json/person.schema.json | 24 + .../multiformat/json/person.schema.yaml | 17 + .../json/regex-pattern.schema.json | 15 + .../json/regex-pattern.schema.yaml | 10 + .../v3/schema/multiformat/openapi/schema.json | 178 +++++ .../v3/schema/multiformat/openapi/schema.yaml | 146 ++++ .../schemaFormat is empty/arrays.schema.json | 37 + .../schemaFormat is empty/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../schemaFormat is empty/person.schema.json | 24 + .../schemaFormat is empty/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../schemaFormat is null/arrays.schema.json | 37 + .../schemaFormat is null/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 + ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 +++++ .../draft-07-core-schema-meta-schema.yaml | 164 +++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../schemaFormat is null/person.schema.json | 24 + .../schemaFormat is null/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../without schemaFormat/arrays.schema.json | 36 + .../without schemaFormat/arrays.schema.yaml | 27 + .../complex-object.schema.json | 43 ++ .../complex-object.schema.yaml | 35 + ...conditional-validation-if-else.schema.json | 41 ++ ...conditional-validation-if-else.schema.yaml | 27 + .../draft-07-core-schema-meta-schema.json | 174 +++++ .../draft-07-core-schema-meta-schema.yaml | 163 +++++ .../enumerated-values.schema.json | 13 + .../enumerated-values.schema.yaml | 15 + .../without schemaFormat/person.schema.json | 23 + .../without schemaFormat/person.schema.yaml | 16 + .../regex-pattern.schema.json | 14 + .../regex-pattern.schema.yaml | 9 + 200 files changed, 9564 insertions(+), 488 deletions(-) delete mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml 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 57f23067..34d85cdc 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessageHeadersDeserializer.java @@ -2,7 +2,7 @@ import com.asyncapi.v3.Reference; import com.asyncapi.v3.schema.AsyncAPISchema; -import com.asyncapi.v3.schema.MultiFormatSchema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; 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 b56c85f3..2de3a298 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/channel/message/MessagePayloadDeserializer.java @@ -1,7 +1,7 @@ package com.asyncapi.v3._0_0.jackson.model.channel.message; import com.asyncapi.v3.Reference; -import com.asyncapi.v3.schema.MultiFormatSchema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.asyncapi.v3.schema.AsyncAPISchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; 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 e62d14be..675174bc 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/jackson/model/component/ComponentsSchemasDeserializer.java @@ -1,7 +1,7 @@ package com.asyncapi.v3._0_0.jackson.model.component; import com.asyncapi.v3.Reference; -import com.asyncapi.v3.schema.MultiFormatSchema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.asyncapi.v3.schema.AsyncAPISchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; 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 f4efc111..e739eece 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/Message.java @@ -11,6 +11,7 @@ import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.asyncapi.v3._0_0.model.Tag; import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -46,7 +47,7 @@ public class Message extends ExtendableObject { * MUST BE: *

    *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ @@ -63,7 +64,7 @@ public class Message extends ExtendableObject { * MUST BE: *
    *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java index 662f6ed2..a9199d62 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/channel/message/MessageTrait.java @@ -9,6 +9,7 @@ import com.asyncapi.v3._0_0.model.ExternalDocumentation; import com.asyncapi.v3._0_0.model.Tag; import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -46,7 +47,7 @@ public class MessageTrait extends ExtendableObject { * MUST BE: *
    *
  • {@link com.asyncapi.v3.schema.AsyncAPISchema}
  • - *
  • {@link com.asyncapi.v3.schema.MultiFormatSchema}
  • + *
  • {@link MultiFormatSchema}
  • *
  • {@link com.asyncapi.v3.Reference}
  • *
*/ diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java index bdf01759..9f56b473 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/_0_0/model/component/Components.java @@ -23,7 +23,7 @@ import com.asyncapi.v3.jackson.binding.message.MessageBindingsDeserializer; import com.asyncapi.v3.jackson.binding.operation.OperationBindingsDeserializer; import com.asyncapi.v3.jackson.binding.server.ServerBindingsDeserializer; -import com.asyncapi.v3.schema.MultiFormatSchema; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.asyncapi.v3.schema.AsyncAPISchema; import com.asyncapi.v3.security_scheme.SecurityScheme; import com.asyncapi.v3.ExtendableObject; 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 index 10125385..2ef8c200 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java @@ -5,6 +5,7 @@ import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAdditionalPropertiesDeserializer; import com.asyncapi.v3.jackson.schema.AsyncAPISchemaAnyValueDeserializer; import com.asyncapi.v3.jackson.schema.AsyncAPISchemaItemsDeserializer; +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java deleted file mode 100644 index 9304c07a..00000000 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/MultiFormatSchema.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.asyncapi.v3.schema; - -import com.asyncapi.v3.ExtendableObject; -import lombok.*; -import org.jetbrains.annotations.NotNull; - -/** - * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports - * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). - * - * @see Multi Format Schema - * @see Schema - * @author Pavel Bodiachevskii - * @version 3.0.0 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class MultiFormatSchema extends ExtendableObject { - - /** - * Required. - *

- * A string containing the name of the schema format that is used to define the information. - *

- * If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} - * where {{asyncapi}} matches the {@link com.asyncapi.v3._0_0.model.AsyncAPI#getAsyncapi()} version string. - *

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

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

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

- *

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

- *

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

- * Definition of the message payload. - *

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

- * It MUST match the schema format defined in {@link #getSchemaFormat()}, including the encoding type. E.g., Avro should be - * inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based - * schemas (e.g., Protobuf or XSD) MUST be inlined as a string. - */ - @NotNull - private Object schema; - -} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java new file mode 100644 index 00000000..cb3fdb15 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AsyncAPIFormatSchema.java @@ -0,0 +1,53 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class AsyncAPIFormatSchema extends MultiFormatSchema { + + public AsyncAPIFormatSchema(@NotNull AsyncAPISchema schema) { + super(schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public AsyncAPIFormatSchema( + @JsonProperty("schemaFormat") @Nullable String schemaFormat, + @JsonProperty("schema") @NotNull AsyncAPISchema schema + ) { + super(schemaFormat(schemaFormat), schema); + } + + @Override + public void setSchema(@NotNull AsyncAPISchema schema) { + super.setSchema(schema); + } + + @NotNull + public AsyncAPISchema getSchema() { + return super.getSchema(); + } + + @NotNull + private static String schemaFormat(@Nullable String schemaFormat) { + if (schemaFormat == null || schemaFormat.isEmpty()) { + return "application/vnd.aai.asyncapi+json;version=3.0.0"; + } + + return schemaFormat; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java new file mode 100644 index 00000000..8165167f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/JsonFormatSchema.java @@ -0,0 +1,44 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.JsonSchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class JsonFormatSchema extends MultiFormatSchema { + + public JsonFormatSchema(@NotNull JsonSchema schema) { + super("application/schema+json;version=draft-07", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public JsonFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull JsonSchema schema + ) { + super(schemaFormat, schema); + } + + @Override + public void setSchema(@NotNull JsonSchema schema) { + super.setSchema(schema); + } + + @NotNull + public JsonSchema getSchema() { + return super.getSchema(); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java new file mode 100644 index 00000000..edc9b939 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java @@ -0,0 +1,145 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.ExtendableObject; +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + defaultImpl = AsyncAPIFormatSchema.class, + property = "schemaFormat", + visible = true +) +@JsonSubTypes({ + @JsonSubTypes.Type(value = JsonFormatSchema.class, names = { + "application/schema+json;version=draft-07", + "application/schema+yaml;version=draft-07" + }), + @JsonSubTypes.Type(value = OpenAPIFormatSchema.class, names = { + "application/vnd.oai.openapi;version=3.0.0", + "application/vnd.oai.openapi+json;version=3.0.0", + "application/vnd.oai.openapi+yaml;version=3.0.0" + }), + @JsonSubTypes.Type(value = AsyncAPIFormatSchema.class, names = { + "application/vnd.aai.asyncapi;version=2.0.0", + "application/vnd.aai.asyncapi+json;version=2.0.0", + "application/vnd.aai.asyncapi+yaml;version=2.0.0", + "application/vnd.aai.asyncapi;version=2.1.0", + "application/vnd.aai.asyncapi+json;version=2.1.0", + "application/vnd.aai.asyncapi+yaml;version=2.1.0", + "application/vnd.aai.asyncapi;version=2.2.0", + "application/vnd.aai.asyncapi+json;version=2.2.0", + "application/vnd.aai.asyncapi+yaml;version=2.2.0", + "application/vnd.aai.asyncapi;version=2.3.0", + "application/vnd.aai.asyncapi+json;version=2.3.0", + "application/vnd.aai.asyncapi+yaml;version=2.3.0", + "application/vnd.aai.asyncapi;version=2.4.0", + "application/vnd.aai.asyncapi+json;version=2.4.0", + "application/vnd.aai.asyncapi+yaml;version=2.4.0", + "application/vnd.aai.asyncapi;version=2.5.0", + "application/vnd.aai.asyncapi+json;version=2.5.0", + "application/vnd.aai.asyncapi+yaml;version=2.5.0", + "application/vnd.aai.asyncapi;version=2.6.0", + "application/vnd.aai.asyncapi+json;version=2.6.0", + "application/vnd.aai.asyncapi+yaml;version=2.6.0", + "application/vnd.aai.asyncapi;version=3.0.0", + "application/vnd.aai.asyncapi+json;version=3.0.0", + "application/vnd.aai.asyncapi+yaml;version=3.0.0" + }) +}) +@EqualsAndHashCode(callSuper = true) +public class MultiFormatSchema extends ExtendableObject { + + public MultiFormatSchema(@NotNull Schema schema) { + this.schemaFormat = "application/vnd.aai.asyncapi+json;version=3.0.0"; + this.schema = schema; + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public MultiFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull Schema schema + ) { + this.schemaFormat = schemaFormat; + this.schema = schema; + } + + /** + * Required. + *

+ * A string containing the name of the schema format that is used to define the information. + *

+ * If schemaFormat is missing, it MUST default to application/vnd.aai.asyncapi+json;version={{asyncapi}} + * where {{asyncapi}} matches the {@link com.asyncapi.v3._0_0.model.AsyncAPI#getAsyncapi()} version string. + *

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

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

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

+ *

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

+ *

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

+ * Definition of the message payload. + *

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

+ * It MUST match the schema format defined in {@link #getSchemaFormat()}, including the encoding type. E.g., Avro should be + * inlined as either a YAML or JSON object instead of as a string to be parsed as YAML or JSON. Non-JSON-based + * schemas (e.g., Protobuf or XSD) MUST be inlined as a string. + */ + @NotNull + @JsonProperty("schema") + private Schema schema; + + public void setSchema(@NotNull Schema schema) { + this.schema = schema; + } + + @NotNull + public Schema getSchema() { + return schema; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java new file mode 100644 index 00000000..5df7f198 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java @@ -0,0 +1,44 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.openapi.OpenAPISchema; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class OpenAPIFormatSchema extends MultiFormatSchema { + + public OpenAPIFormatSchema(@NotNull OpenAPISchema schema) { + super("application/vnd.oai.openapi+json;version=3.0.0", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public OpenAPIFormatSchema( + @JsonProperty("schemaFormat") @NotNull String schemaFormat, + @JsonProperty("schema") @NotNull OpenAPISchema schema + ) { + super(schemaFormat, schema); + } + + @Override + public void setSchema(@NotNull OpenAPISchema schema) { + super.setSchema(schema); + } + + @NotNull + public OpenAPISchema getSchema() { + return super.getSchema(); + } + +} diff --git a/asyncapi-core/src/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 b7a3dffe..cf06e2f7 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt @@ -19,10 +19,12 @@ import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicCleanupPolicy import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicConfiguration import com.asyncapi.v3.binding.operation.kafka.KafkaOperationBinding import com.asyncapi.v3.binding.server.kafka.KafkaServerBinding -import com.asyncapi.v3.schema.MultiFormatSchema +import com.asyncapi.v3.schema.multiformat.MultiFormatSchema import com.asyncapi.v3.schema.AsyncAPISchema import com.asyncapi.v3.security_scheme.SecurityScheme +import org.junit.jupiter.api.Disabled +@Disabled("Implement Avro Schema") class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { override fun specificationLocation(): String = "/examples/v3.0.0/adeo-kafka-request-reply-asyncapi.yml" 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 64232863..c6880667 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/GitterStreamingAsyncAPI.kt @@ -12,8 +12,9 @@ import com.asyncapi.v3._0_0.model.operation.OperationAction import com.asyncapi.v3._0_0.model.server.Server import com.asyncapi.v3.binding.operation.http.HTTPOperationBinding import com.asyncapi.v3.binding.operation.http.HTTPOperationMethod -import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema import com.asyncapi.v3.security_scheme.http.HttpSecurityScheme class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { @@ -102,129 +103,156 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { .messages(mapOf( Pair("chatMessage", Message.builder() .summary("A message represents an individual chat message sent to a room. They are a sub-resource of a room.") - .payload(MultiFormatSchema( + .payload( + JsonFormatSchema( "application/schema+yaml;version=draft-07", - mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "string"), - Pair("description", "ID of the message."), - )), - Pair("text", mapOf( - Pair("type", "string"), - Pair("description", "Original message in plain-text/markdown."), - )), - Pair("html", mapOf( - Pair("type", "string"), - Pair("description", "HTML formatted message."), - )), - Pair("sent", mapOf( - Pair("type", "string"), - Pair("format", "date-time"), - Pair("description", "ISO formatted date of the message."), - )), - Pair("fromUser", mapOf( - Pair("type", "object"), - Pair("description", "User that sent the message."), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "string"), - Pair("description", "Gitter User ID."), - )), - Pair("username", mapOf( - Pair("type", "string"), - Pair("description", "Gitter/GitHub username."), - )), - Pair("displayName", mapOf( - Pair("type", "string"), - Pair("description", "Gitter/GitHub user real name."), - )), - Pair("url", mapOf( - Pair("type", "string"), - Pair("description", "Path to the user on Gitter."), - )), - Pair("avatarUrl", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI."), - )), - Pair("avatarUrlSmall", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI (small)."), - )), - Pair("avatarUrlMedium", mapOf( - Pair("type", "string"), - Pair("format", "uri"), - Pair("description", "User avatar URI (medium)."), - )), - Pair("v", mapOf( - Pair("type", "number"), - Pair("description", "Version."), - )), - Pair("gv", mapOf( - Pair("type", "string"), - Pair("description", "Stands for \"Gravatar version\" and is used for cache busting."), - )) - )), - )), - Pair("unread", mapOf( - Pair("type", "boolean"), - Pair("description", "Boolean that indicates if the current user has read the message."), - )), - Pair("readBy", mapOf( - Pair("type", "number"), - Pair("description", "Number of users that have read the message."), - )), - Pair("urls", mapOf( - Pair("type", "array"), - Pair("description", "List of URLs present in the message."), - Pair("items", mapOf( - Pair("type", "string"), - Pair("format", "uri") - )), - )), - Pair("mentions", mapOf( - Pair("type", "array"), - Pair("description", "List of @Mentions in the message."), - Pair("items", mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("screenName", mapOf(Pair("type", "string"))), - Pair("userId", mapOf(Pair("type", "string"))), - Pair("userIds", mapOf( - Pair("type", "array"), - Pair("items", mapOf(Pair("type", "string"))), - )), - )) - )), - )), - Pair("issues", mapOf( - Pair("type", "array"), - Pair("description", "List of #Issues referenced in the message."), - Pair("items", mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("number", mapOf(Pair("type", "string"))) - )) - )), - )), - Pair("meta", mapOf( - Pair("type", "array"), - Pair("description", "Metadata. This is currently not used for anything."), - Pair("items", emptyMap()), - )), - Pair("v", mapOf( - Pair("type", "number"), - Pair("description", "Version.") - )), - Pair("gv", mapOf( - Pair("type", "string"), - Pair("description", "Stands for \"Gravatar version\" and is used for cache busting.") + JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("string") + .description("ID of the message.") + .build() + ), + Pair("text", JsonSchema.builder() + .type("string") + .description("Original message in plain-text/markdown.") + .build() + ), + Pair("html", JsonSchema.builder() + .type("string") + .description("HTML formatted message.") + .build() + ), + Pair("sent", JsonSchema.builder() + .type("string") + .format("date-time") + .description("ISO formatted date of the message.") + .build() + ), + Pair("fromUser", JsonSchema.builder() + .type("object") + .description("User that sent the message.") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("string") + .description("Gitter User ID.") + .build() + ), + Pair("username", JsonSchema.builder() + .type("string") + .description("Gitter/GitHub username.") + .build() + ), + Pair("displayName", JsonSchema.builder() + .type("string") + .description("Gitter/GitHub user real name.") + .build() + ), + Pair("url", JsonSchema.builder() + .type("string") + .description("Path to the user on Gitter.") + .build() + ), + Pair("avatarUrl", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI.") + .build() + ), + Pair("avatarUrlSmall", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI (small).") + .build() + ), + Pair("avatarUrlMedium", JsonSchema.builder() + .type("string") + .format("uri") + .description("User avatar URI (medium).") + .build() + ), + Pair("v", JsonSchema.builder() + .type("number") + .description("Version.") + .build() + ), + Pair("gv", JsonSchema.builder() + .type("string") + .description("Stands for \"Gravatar version\" and is used for cache busting.") + .build() + ), + )) + .build() + ), + Pair("unread", JsonSchema.builder() + .type("boolean") + .description("Boolean that indicates if the current user has read the message.") + .build() + ), + Pair("readBy", JsonSchema.builder() + .type("number") + .description("Number of users that have read the message.") + .build() + ), + Pair("urls", JsonSchema.builder() + .type("array") + .description("List of URLs present in the message.") + .items(JsonSchema.builder() + .type("string") + .format("uri") + .build() + ) + .build() + ), + Pair("mentions", JsonSchema.builder() + .type("array") + .description("List of @Mentions in the message.") + .items(JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("screenName", JsonSchema.builder().type("string").build()), + Pair("userId", JsonSchema.builder().type("string").build()), + Pair("userIds", JsonSchema.builder() + .type("array") + .items(JsonSchema.builder().type("string").build()) + .build() + ), )) - )), - ) + .build() + ) + .build() + ), + Pair("issues", JsonSchema.builder() + .type("array") + .description("List of #Issues referenced in the message.") + .items(JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("number", JsonSchema.builder().type("string").build()), + )) + .build() + ) + .build() + ), + Pair("meta", JsonSchema.builder() + .type("array") + .description("Metadata. This is currently not used for anything.") + .items(JsonSchema.builder().build()) + .build() + ), + Pair("v", JsonSchema.builder() + .type("number") + .description("Version.") + .build() + ), + Pair("gv", JsonSchema.builder() + .type("string") + .description("Stands for \"Gravatar version\" and is used for cache busting.") + .build() + ), + )) + .build() )) .bindings(mapOf( Pair("http", HTTPMessageBinding.builder() @@ -249,12 +277,12 @@ class GitterStreamingAsyncAPI: AbstractExampleValidationTest() { .build()), Pair("heartbeat", Message.builder() .summary("Its purpose is to keep the connection alive.") - .payload(MultiFormatSchema( - "application/schema+yaml;version=draft-07", - mapOf( - Pair("type", "string"), - Pair("enum", listOf("\r\n")), - ) + .payload(JsonFormatSchema( + "application/schema+yaml;version=draft-07", + JsonSchema.builder() + .type("string") + .enumValue(listOf("\r\n")) + .build() )) .bindings(mapOf( Pair("http", HTTPMessageBinding.builder() 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 3363eb0a..f54d28e9 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTest.kt @@ -4,8 +4,6 @@ import com.asyncapi.v3.Reference import com.asyncapi.v3.SerDeTest import com.asyncapi.v3._0_0.model.ExternalDocumentation import com.asyncapi.v3._0_0.model.Tag -import com.asyncapi.v3.schema.AsyncAPISchema -import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest import com.asyncapi.v3.binding.message.googlepubsub.GooglePubSubMessageBindingTest @@ -13,6 +11,8 @@ import com.asyncapi.v3.binding.message.http.HTTPMessageBindingTest import com.asyncapi.v3.binding.message.ibmmq.IBMMQMessageBindingTest import com.asyncapi.v3.binding.message.kafka.KafkaMessageBindingTest import com.asyncapi.v3.binding.message.mqtt.MQTTMessageBindingTest +import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema class MessageTestWithSchema: SerDeTest() { @@ -180,43 +180,37 @@ class MessageTestWithMultiFormatSchema: SerDeTest() { override fun build(): Message { return Message.builder() - .headers(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "correlationId", - mapOf( - Pair("description", "Correlation ID set by application"), - Pair("type", "string") - ) + .headers(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("correlationId", AsyncAPISchema.builder() + .type("string") + .description("Correlation ID set by application") + .build() ), - Pair( - "applicationInstanceId", - mapOf( - Pair("description", "Unique identifier for a given instance of the publishing application"), - Pair("type", "string") - ) + Pair("applicationInstanceId", AsyncAPISchema.builder() + .type("string") + .description("Unique identifier for a given instance of the publishing application") + .build() ) )) - )).build() - ) - .payload(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "metric", - mapOf( - Pair("description", "Metric set by application"), - Pair("type", "string") - ) + .build() + )) + .payload(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("metric", AsyncAPISchema.builder() + .type("string") + .description("Metric set by application") + .build() ) )) - )).build() - ) + .build() + )) .correlationId(Reference("#/components/messages/message-correlation-id")) .contentType("application/json") .name("UserSignup") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt index 3fae68ce..1a8e246e 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/channel/message/MessageTraitTest.kt @@ -5,7 +5,6 @@ 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.AsyncAPISchema -import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.binding.message.amqp.AMQPMessageBindingTest import com.asyncapi.v3.binding.message.anypointmq.AnypointMQMessageBindingTest import com.asyncapi.v3.binding.message.googlepubsub.GooglePubSubMessageBindingTest @@ -13,6 +12,7 @@ import com.asyncapi.v3.binding.message.http.HTTPMessageBindingTest import com.asyncapi.v3.binding.message.ibmmq.IBMMQMessageBindingTest import com.asyncapi.v3.binding.message.kafka.KafkaMessageBindingTest import com.asyncapi.v3.binding.message.mqtt.MQTTMessageBindingTest +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema class MessageTraitTestWithSchema: SerDeTest() { @@ -150,28 +150,24 @@ class MessageTraitTestWithMultiFormatSchema: SerDeTest() { override fun build(): MessageTrait { return MessageTrait.builder() - .headers(MultiFormatSchema.builder() - .schemaFormat("application/vnd.aai.asyncapi+json;version=3.0.0") - .schema(linkedMapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair( - "correlationId", - mapOf( - Pair("description", "Correlation ID set by application"), - Pair("type", "string") - ) + .headers(AsyncAPIFormatSchema( + "application/vnd.aai.asyncapi+json;version=3.0.0", + AsyncAPISchema.builder() + .type("object") + .properties(mapOf( + Pair("correlationId", AsyncAPISchema.builder() + .type("string") + .description("Correlation ID set by application") + .build() ), - Pair( - "applicationInstanceId", - mapOf( - Pair("description", "Unique identifier for a given instance of the publishing application"), - Pair("type", "string") - ) + Pair("applicationInstanceId", AsyncAPISchema.builder() + .type("string") + .description("Unique identifier for a given instance of the publishing application") + .build() ) )) - )).build() - ) + .build() + )) .correlationId(Reference("#/components/messages/message-correlation-id")) .contentType("application/json") .name("UserSignup") diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt index 25f6c3c5..8d85f021 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/_0_0/model/component/ComponentsTest.kt @@ -18,9 +18,10 @@ import com.asyncapi.v3._0_0.model.operation.reply.OperationReplyTest import com.asyncapi.v3._0_0.model.operation.reply.OperationReplyTestWithReference import com.asyncapi.v3._0_0.model.server.ServerTest import com.asyncapi.v3._0_0.model.server.ServerVariableTest -import com.asyncapi.v3.schema.MultiFormatSchema import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.JsonSchema import com.asyncapi.v3.schema.Type +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema import com.asyncapi.v3.security_scheme.ApiKeySecuritySchemeTest import com.asyncapi.v3.security_scheme.OpenIdConnectSecuritySchemeTest import com.asyncapi.v3.security_scheme.http.HttpApiKeySecuritySchemeTest @@ -57,24 +58,23 @@ class ComponentsTest: SerDeTest() { )) .build() ), - Pair( - "Tag", - MultiFormatSchema.builder() - .schemaFormat("application/json") - .schema(mapOf( - Pair("type", "object"), - Pair("properties", mapOf( - Pair("id", mapOf( - Pair("type", "integer"), - Pair("format", "int64") - )), - Pair("name", mapOf( - Pair("type", "string") - )) - )) + Pair("Tag", JsonFormatSchema( + "application/schema+json;version=draft-07", + JsonSchema.builder() + .type("object") + .properties(mapOf( + Pair("id", JsonSchema.builder() + .type("integer") + .format("int64") + .build() + ), + Pair("name", JsonSchema.builder() + .type("string") + .build() + ) )) .build() - ), + )), Pair("User", Reference("#/components/schemas/user")) )) .servers(mapOf( diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt index e4ee8ea2..e24b7cf8 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -1,13 +1,58 @@ package com.asyncapi.v3.schema +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema import com.asyncapi.v3.schema.openapi.OpenAPISchema interface SchemaProvider { fun jsonSchema(): JsonSchema = JsonSchema() + fun jsonFormatSchemaJson(): JsonFormatSchema = JsonFormatSchema(jsonSchema()) + + fun jsonFormatSchemaYaml(): JsonFormatSchema = JsonFormatSchema("application/schema+yaml;version=draft-07", jsonSchema()) + fun asyncAPISchema(): AsyncAPISchema = AsyncAPISchema() + fun asyncAPIFormatSchemaJsonV2_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_1_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_1_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_2_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_2_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_3_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_3_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_4_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_4_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_5_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_5_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV2_6_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV2_6_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaJsonV3_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema(asyncAPISchema()) + + fun asyncAPIFormatSchemaYamlV3_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", asyncAPISchema()) + + fun asyncAPIFormatSchemaEmptySchemaFormat(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", asyncAPISchema()) + fun openAPISchema(): OpenAPISchema = OpenAPISchema() + fun openAPIFormatSchemaJson(): OpenAPIFormatSchema = OpenAPIFormatSchema(openAPISchema()) + + fun openAPIFormatSchemaYaml(): OpenAPIFormatSchema = OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.0", openAPISchema()) + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt new file mode 100644 index 00000000..c28e238a --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -0,0 +1,678 @@ +package com.asyncapi.v3.schema.multiformat + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.SchemaProvider +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.openapi.SchemaTest +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class MultiFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + schemaToCompareWith: String, + schemaClass: Class<*>, + schemaToCheck: Schema + ) { + val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) + val jsonSchema = objectMapper.readValue(jsonSchemaString, schemaClass) + + Assertions.assertEquals(jsonSchema, schemaToCheck) + } + + @Nested + inner class AsyncAPISchema { + + @Nested + @DisplayName("2.0.0") + inner class V2_0_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_0_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_0_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_0_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_0_0()) + } + + } + + @Nested + @DisplayName("2.1.0") + inner class V2_1_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_1_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_1_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_1_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_1_0()) + } + + } + + @Nested + @DisplayName("2.2.0") + inner class V2_2_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_2_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_2_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_2_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_2_0()) + } + + } + + @Nested + @DisplayName("2.3.0") + inner class V2_3_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_3_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_3_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_3_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_3_0()) + } + + } + + @Nested + @DisplayName("2.4.0") + inner class V2_4_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_4_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_4_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_4_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_4_0()) + } + + } + + @Nested + @DisplayName("2.5.0") + inner class V2_5_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_5_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_5_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_5_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_5_0()) + } + + } + + @Nested + @DisplayName("2.6.0") + inner class V2_6_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV2_6_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_6_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV2_6_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_6_0()) + } + + } + + @Nested + @DisplayName("3.0.0") + inner class V3_0_0 { + + @ArgumentsSource(AsyncAPISchemasJsonFormatV3_0_0::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV3_0_0()) + } + + @ArgumentsSource(AsyncAPISchemasYamlFormatV3_0_0::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV3_0_0()) + } + + } + + @Nested + @DisplayName("MultiFormatSchema with empty schemaFormat is AsyncAPI Schema") + inner class EmptySchemaFormat { + + @ArgumentsSource(JsonSchemasWithEmptySchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + @ArgumentsSource(YamlSchemasWithEmptySchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + } + + @Nested + @DisplayName("MultiFormatSchema with null schemaFormat is AsyncAPI Schema") + inner class NullSchemaFormat { + + @ArgumentsSource(JsonSchemasWithNullSchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + @ArgumentsSource(YamlSchemasWithNullSchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + } + + @Nested + @DisplayName("MultiFormatSchema without schemaFormat is AsyncAPI Schema") + inner class WithoutSchemaFormat { + + @ArgumentsSource(JsonSchemasWithoutSchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + @ArgumentsSource(YamlSchemasWithoutSchemaFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) + } + + } + + } + + @Nested + inner class JsonSchema { + + @ArgumentsSource(JsonSchemasJsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, JsonFormatSchema::class.java, schemaProvider.jsonFormatSchemaJson()) + } + + @ArgumentsSource(JsonSchemasYamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, JsonFormatSchema::class.java, schemaProvider.jsonFormatSchemaYaml()) + } + + } + + @Nested + inner class OpenAPISchema { + + @ArgumentsSource(OpenAPISchemasJsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, OpenAPIFormatSchema::class.java, schemaProvider.openAPIFormatSchemaJson()) + } + + @ArgumentsSource(OpenAPISchemasYamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { + compareSchemas(schemaToCompareWith, OpenAPIFormatSchema::class.java, schemaProvider.openAPIFormatSchemaYaml()) + } + + } + + class JsonSchemasJsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/json/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/json/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/json/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/json/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/json/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class JsonSchemasYamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/json/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/json/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/json/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/json/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/json/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_0_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_0_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_1_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_1_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_2_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_2_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_3_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_3_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_4_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_4_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_5_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_5_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV2_6_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV2_6_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasJsonFormatV3_0_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class AsyncAPISchemasYamlFormatV3_0_0: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class OpenAPISchemasJsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/schema.json", SchemaTest()), + ) + } + + } + + class OpenAPISchemasYamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/schema.yaml", SchemaTest()), + ) + } + + } + + class JsonSchemasWithEmptySchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class YamlSchemasWithEmptySchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class JsonSchemasWithNullSchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class YamlSchemasWithNullSchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + + class JsonSchemasWithoutSchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/person.schema.json", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json", RegexPatternTest()) + ) + } + + } + + class YamlSchemasWithoutSchemaFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml", ArraysSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml", ComplexObjectTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml", EnumeratedValuesTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml", PersonTest()), + Arguments.of("/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml", RegexPatternTest()) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json index 023e3710..28da7797 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi - extended.json @@ -681,12 +681,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -841,12 +841,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -857,8 +857,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -1266,12 +1266,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1830,12 +1830,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2598,12 +2598,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2758,12 +2758,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2774,8 +2774,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -3183,12 +3183,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3747,12 +3747,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -4969,7 +4969,7 @@ } }, "Tag" : { - "schemaFormat" : "application/json", + "schemaFormat" : "application/schema+json;version=draft-07", "schema" : { "type" : "object", "properties" : { @@ -5553,12 +5553,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5713,12 +5713,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5729,8 +5729,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -6138,12 +6138,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -6702,12 +6702,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7470,12 +7470,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7630,12 +7630,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7646,8 +7646,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -8055,12 +8055,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -8619,12 +8619,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10299,12 +10299,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10459,12 +10459,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -10475,8 +10475,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -10884,12 +10884,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -11448,12 +11448,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -12160,12 +12160,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json index b4eafd4e..cacc25aa 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/asyncapi.json @@ -5289,7 +5289,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json index 8dfec121..a74df3c7 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel - extended.json @@ -453,12 +453,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -613,12 +613,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -1038,12 +1038,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1602,12 +1602,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json index 3987e55b..14181083 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/channel with reference - extended.json @@ -453,12 +453,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -613,12 +613,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -629,8 +629,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -1038,12 +1038,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1602,12 +1602,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json index 24bd16f1..4fd445a2 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message - extended.json @@ -425,12 +425,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json index 60830214..188d3afd 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message 2 - extended.json @@ -5,12 +5,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -21,8 +21,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -430,12 +430,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json index 57740845..6887c72e 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/message with reference - extended.json @@ -408,12 +408,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json index 2a93f9e3..b46b615a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/channel/message/messageTrait 2 - extended.json @@ -5,12 +5,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json index 91ac9c2d..d937e849 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - extended.json @@ -13,7 +13,7 @@ } }, "Tag" : { - "schemaFormat" : "application/json", + "schemaFormat" : "application/schema+json;version=draft-07", "schema" : { "type" : "object", "properties" : { @@ -597,12 +597,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -757,12 +757,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -773,8 +773,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -1182,12 +1182,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -1746,12 +1746,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2514,12 +2514,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2674,12 +2674,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -2690,8 +2690,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -3099,12 +3099,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -3663,12 +3663,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5343,12 +5343,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5503,12 +5503,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -5519,8 +5519,8 @@ "type" : "object", "properties" : { "metric" : { - "description" : "Metric set by application", - "type" : "string" + "type" : "string", + "description" : "Metric set by application" } } } @@ -5928,12 +5928,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -6492,12 +6492,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } @@ -7204,12 +7204,12 @@ "type" : "object", "properties" : { "correlationId" : { - "description" : "Correlation ID set by application", - "type" : "string" + "type" : "string", + "description" : "Correlation ID set by application" }, "applicationInstanceId" : { - "description" : "Unique identifier for a given instance of the publishing application", - "type" : "string" + "type" : "string", + "description" : "Unique identifier for a given instance of the publishing application" } } } diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json index f91bdf04..dcab9a3a 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components - wrongly extended.json @@ -13,7 +13,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json index 1274a6fe..acb016d5 100644 --- a/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json +++ b/asyncapi-core/src/test/resources/json/v3/3.0.0/model/components/components.json @@ -13,7 +13,7 @@ } }, "Tag": { - "schemaFormat": "application/json", + "schemaFormat": "application/schema+json;version=draft-07", "schema": { "type": "object", "properties": { diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json new file mode 100644 index 00000000..9ccbb273 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml new file mode 100644 index 00000000..1afafa81 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json new file mode 100644 index 00000000..a001806a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml new file mode 100644 index 00000000..8c65ccae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..ee97cf42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..1520bf39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..e533100a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..efb6bd2d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json new file mode 100644 index 00000000..8c3617dd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..f53f8753 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json new file mode 100644 index 00000000..bebe6b8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml new file mode 100644 index 00000000..71534348 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json new file mode 100644 index 00000000..457d226f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..c1740aa8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json new file mode 100644 index 00000000..50dbeaa0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml new file mode 100644 index 00000000..6107245a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json new file mode 100644 index 00000000..db4a273c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml new file mode 100644 index 00000000..26e5fd2a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..3ba6a3ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..feae34f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8dcfbb5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..837afff7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json new file mode 100644 index 00000000..2af936ae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..67327cc2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json new file mode 100644 index 00000000..5a79affa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml new file mode 100644 index 00000000..e807fb03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json new file mode 100644 index 00000000..007ccad2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.1.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..c3910508 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.1.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json new file mode 100644 index 00000000..264f7d6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml new file mode 100644 index 00000000..258fb97e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json new file mode 100644 index 00000000..5caad998 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml new file mode 100644 index 00000000..ef014b39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..7b728fe2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..1ceb3beb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8b5f2609 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..f4ad81f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json new file mode 100644 index 00000000..f9ca8f1a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..ce5eaacf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json new file mode 100644 index 00000000..b07da134 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml new file mode 100644 index 00000000..4d7d73c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json new file mode 100644 index 00000000..1ac0bc74 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.2.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..ca7c0701 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.2.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json new file mode 100644 index 00000000..9513fe7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml new file mode 100644 index 00000000..fd174ebc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json new file mode 100644 index 00000000..2c841b8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml new file mode 100644 index 00000000..e1461688 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..2c5cdecc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..3325a556 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..b8b6c860 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..f556d218 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json new file mode 100644 index 00000000..f3f97174 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..5dce443b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json new file mode 100644 index 00000000..ce3e0096 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml new file mode 100644 index 00000000..51e43a18 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json new file mode 100644 index 00000000..c2a9940b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.3.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..37d087a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.3.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json new file mode 100644 index 00000000..280c0614 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml new file mode 100644 index 00000000..c7c58076 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json new file mode 100644 index 00000000..b807c9fc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml new file mode 100644 index 00000000..0f2e0105 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..a2afa001 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..4af79118 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..32f234d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..3bd11767 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json new file mode 100644 index 00000000..5c17f3d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..7eebfbfe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json new file mode 100644 index 00000000..03476640 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml new file mode 100644 index 00000000..0efcef97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json new file mode 100644 index 00000000..77d1e1f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.4.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..f09b3f68 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.4.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json new file mode 100644 index 00000000..fb471dbd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml new file mode 100644 index 00000000..3574a0a6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json new file mode 100644 index 00000000..ea84f354 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml new file mode 100644 index 00000000..49956775 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..d8f8acd3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..f09f8ed6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..7b3cb572 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..1b1a2229 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json new file mode 100644 index 00000000..431a85d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..01941c5a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json new file mode 100644 index 00000000..f649404c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml new file mode 100644 index 00000000..f6329c14 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json new file mode 100644 index 00000000..a379376c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.5.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..8a05265e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.5.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json new file mode 100644 index 00000000..2817c994 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml new file mode 100644 index 00000000..c6966532 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json new file mode 100644 index 00000000..6706c171 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml new file mode 100644 index 00000000..8950a9e4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..a5ae0ae1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..037b3033 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..25f2a1fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b1a866fb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json new file mode 100644 index 00000000..5e4e2062 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..f1cb6f96 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json new file mode 100644 index 00000000..3330f54c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml new file mode 100644 index 00000000..6852fff7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json new file mode 100644 index 00000000..9075ed0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=2.6.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..c869b0a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json new file mode 100644 index 00000000..bd28415b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml new file mode 100644 index 00000000..aca4d1dd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json new file mode 100644 index 00000000..c059144d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml new file mode 100644 index 00000000..b76367b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..2a8de809 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0d2a990f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..fd630b0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..9b26361a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json new file mode 100644 index 00000000..3a7c9893 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml new file mode 100644 index 00000000..d855d235 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json new file mode 100644 index 00000000..1017da7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml new file mode 100644 index 00000000..adc25975 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json new file mode 100644 index 00000000..761dd145 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml new file mode 100644 index 00000000..dc2322f6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json new file mode 100644 index 00000000..ab24f72d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml new file mode 100644 index 00000000..c6f5727f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json new file mode 100644 index 00000000..52498a01 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml new file mode 100644 index 00000000..e6c75d55 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..4c658616 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0247faed --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..a85d880c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..53e3b503 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json new file mode 100644 index 00000000..ffb3ffd3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml new file mode 100644 index 00000000..a43c5da7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json new file mode 100644 index 00000000..beb597a2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml new file mode 100644 index 00000000..58ca8fd1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json new file mode 100644 index 00000000..ed0390cc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/schema+json;version=draft-07", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml new file mode 100644 index 00000000..0cc26493 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/schema+yaml;version=draft-07 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json new file mode 100644 index 00000000..825a8c6b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.0", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml new file mode 100644 index 00000000..7f763b51 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.0 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json new file mode 100644 index 00000000..4296200b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml new file mode 100644 index 00000000..edbf68b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json new file mode 100644 index 00000000..1df1ed52 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml new file mode 100644 index 00000000..c01793c5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..bb8a59af --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a5dc86c0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..6a072113 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..a1f03214 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: '' +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json new file mode 100644 index 00000000..48de5bcd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml new file mode 100644 index 00000000..6de5e15c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json new file mode 100644 index 00000000..fe65ec3c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml new file mode 100644 index 00000000..616f30fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json new file mode 100644 index 00000000..c552edf0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml new file mode 100644 index 00000000..bc3b0d66 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: '' +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json new file mode 100644 index 00000000..b70a8a42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml new file mode 100644 index 00000000..e4085492 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json new file mode 100644 index 00000000..691250b7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml new file mode 100644 index 00000000..8ab3f7f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..71e03832 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a451fe31 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..585fa24b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": null, + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..d84611b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json new file mode 100644 index 00000000..9592d9c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml new file mode 100644 index 00000000..e469f812 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json new file mode 100644 index 00000000..6c4090d4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml new file mode 100644 index 00000000..13b9f8ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: null +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json new file mode 100644 index 00000000..05723bcd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": null, + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml new file mode 100644 index 00000000..231072ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json new file mode 100644 index 00000000..1549e74a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json @@ -0,0 +1,36 @@ +{ + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml new file mode 100644 index 00000000..7fdd32d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml @@ -0,0 +1,27 @@ +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json new file mode 100644 index 00000000..557c70b2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json @@ -0,0 +1,43 @@ +{ + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml new file mode 100644 index 00000000..bee67a7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml @@ -0,0 +1,35 @@ +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..227c33d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json @@ -0,0 +1,41 @@ +{ + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..7bf84a41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml @@ -0,0 +1,27 @@ +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..8f13271f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json @@ -0,0 +1,174 @@ +{ + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..c7d09fb8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,163 @@ +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json new file mode 100644 index 00000000..f063a090 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json @@ -0,0 +1,13 @@ +{ + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml new file mode 100644 index 00000000..7e3cfccc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml @@ -0,0 +1,15 @@ +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json new file mode 100644 index 00000000..bcbd21a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.json @@ -0,0 +1,23 @@ +{ + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml new file mode 100644 index 00000000..81836816 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml @@ -0,0 +1,16 @@ +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json new file mode 100644 index 00000000..2a928347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json @@ -0,0 +1,14 @@ +{ + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml new file mode 100644 index 00000000..017469c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml @@ -0,0 +1,9 @@ +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file From fc65b7309bbad95700798366c1edab2486895f6a Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 12 Apr 2024 23:20:30 +0400 Subject: [PATCH 24/44] feat(schemaFormat): support OpenAPI 3.0.1, 3.0.2, 3.0.3 https://github.com/asyncapi/jasyncapi/issues/185 --- .../schema/multiformat/MultiFormatSchema.java | 11 +- .../multiformat/MultiFormatSchemaTest.kt | 48 ++--- .../openapi/OpenAPIFormatSchemaTest.kt | 36 ++++ .../openapi/OpenAPIFormatSchemaV3_0_0Test.kt | 62 ++++++ .../openapi/OpenAPIFormatSchemaV3_0_1Test.kt | 64 +++++++ .../openapi/OpenAPIFormatSchemaV3_0_2Test.kt | 64 +++++++ .../openapi/OpenAPIFormatSchemaV3_0_3Test.kt | 64 +++++++ .../vnd.oai.openapi+json}/schema.json | 0 .../vnd.oai.openapi+yaml}/schema.yaml | 0 .../openapi/3.0.0/vnd.oai.openapi/schema.json | 178 ++++++++++++++++++ .../openapi/3.0.0/vnd.oai.openapi/schema.yaml | 146 ++++++++++++++ .../3.0.1/vnd.oai.openapi+json/schema.json | 178 ++++++++++++++++++ .../3.0.1/vnd.oai.openapi+yaml/schema.yaml | 146 ++++++++++++++ .../openapi/3.0.1/vnd.oai.openapi/schema.json | 178 ++++++++++++++++++ .../openapi/3.0.1/vnd.oai.openapi/schema.yaml | 146 ++++++++++++++ .../3.0.2/vnd.oai.openapi+json/schema.json | 178 ++++++++++++++++++ .../3.0.2/vnd.oai.openapi+yaml/schema.yaml | 146 ++++++++++++++ .../openapi/3.0.2/vnd.oai.openapi/schema.json | 178 ++++++++++++++++++ .../openapi/3.0.2/vnd.oai.openapi/schema.yaml | 146 ++++++++++++++ .../3.0.3/vnd.oai.openapi+json/schema.json | 178 ++++++++++++++++++ .../3.0.3/vnd.oai.openapi+yaml/schema.yaml | 146 ++++++++++++++ .../openapi/3.0.3/vnd.oai.openapi/schema.json | 178 ++++++++++++++++++ .../openapi/3.0.3/vnd.oai.openapi/schema.yaml | 146 ++++++++++++++ 23 files changed, 2586 insertions(+), 31 deletions(-) create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/{ => 3.0.0/vnd.oai.openapi+json}/schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/{ => 3.0.0/vnd.oai.openapi+yaml}/schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java index edc9b939..b5e2209a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java @@ -33,7 +33,16 @@ @JsonSubTypes.Type(value = OpenAPIFormatSchema.class, names = { "application/vnd.oai.openapi;version=3.0.0", "application/vnd.oai.openapi+json;version=3.0.0", - "application/vnd.oai.openapi+yaml;version=3.0.0" + "application/vnd.oai.openapi+yaml;version=3.0.0", + "application/vnd.oai.openapi;version=3.0.1", + "application/vnd.oai.openapi+json;version=3.0.1", + "application/vnd.oai.openapi+yaml;version=3.0.1", + "application/vnd.oai.openapi;version=3.0.2", + "application/vnd.oai.openapi+json;version=3.0.2", + "application/vnd.oai.openapi+yaml;version=3.0.2", + "application/vnd.oai.openapi;version=3.0.3", + "application/vnd.oai.openapi+json;version=3.0.3", + "application/vnd.oai.openapi+yaml;version=3.0.3" }), @JsonSubTypes.Type(value = AsyncAPIFormatSchema.class, names = { "application/vnd.aai.asyncapi;version=2.0.0", diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt index c28e238a..141d30a5 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -4,6 +4,10 @@ import com.asyncapi.v3.ClasspathUtils import com.asyncapi.v3.schema.SchemaProvider import com.asyncapi.v3.schema.json.* import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_1Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_2Test +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_3Test import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory @@ -257,17 +261,21 @@ class MultiFormatSchemaTest { @Nested inner class OpenAPISchema { - @ArgumentsSource(OpenAPISchemasJsonFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, OpenAPIFormatSchema::class.java, schemaProvider.openAPIFormatSchemaJson()) - } + @Nested + @DisplayName("3.0.0") + inner class V3_0_0: OpenAPIFormatSchemaV3_0_0Test() - @ArgumentsSource(OpenAPISchemasYamlFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, OpenAPIFormatSchema::class.java, schemaProvider.openAPIFormatSchemaYaml()) - } + @Nested + @DisplayName("3.0.1") + inner class V3_0_1: OpenAPIFormatSchemaV3_0_1Test() + + @Nested + @DisplayName("3.0.2") + inner class V3_0_2: OpenAPIFormatSchemaV3_0_2Test() + + @Nested + @DisplayName("3.0.3") + inner class V3_0_3: OpenAPIFormatSchemaV3_0_3Test() } @@ -559,26 +567,6 @@ class MultiFormatSchemaTest { } - class OpenAPISchemasJsonFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/openapi/schema.json", SchemaTest()), - ) - } - - } - - class OpenAPISchemasYamlFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/openapi/schema.yaml", SchemaTest()), - ) - } - - } - class JsonSchemasWithEmptySchemaFormat: ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream { diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt new file mode 100644 index 00000000..8acfbc49 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class OpenAPIFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + openAPIFormatSchemaToCompareWithFilePath: String, + schemaToCheck: OpenAPIFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(openAPIFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, OpenAPIFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) + + abstract fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt new file mode 100644 index 00000000..7238a76e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt @@ -0,0 +1,62 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.openapi.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_0Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.0", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.0", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.0", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.0", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt new file mode 100644 index 00000000..fb7bf3eb --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt @@ -0,0 +1,64 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat +import com.asyncapi.v3.schema.openapi.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_1Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.1", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.1", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.1", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.1", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt new file mode 100644 index 00000000..72865dbc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt @@ -0,0 +1,64 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat +import com.asyncapi.v3.schema.openapi.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_2Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.2", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.2", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.2", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.2", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt new file mode 100644 index 00000000..8a25911b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt @@ -0,0 +1,64 @@ +package com.asyncapi.v3.schema.multiformat.openapi + +import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat +import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat +import com.asyncapi.v3.schema.openapi.SchemaTest +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class OpenAPIFormatSchemaV3_0_3Test: OpenAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + openAPIFormatSchemaToCompareWithFilePath: String, + openAPIFormatSchema: OpenAPIFormatSchema + ) { + compareSchemas(openAPIFormatSchemaToCompareWithFilePath, openAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.3", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json", + OpenAPIFormatSchema("application/vnd.oai.openapi+json;version=3.0.3", SchemaTest().openAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi;version=3.0.3", SchemaTest().openAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml", + OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.3", SchemaTest().openAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+json/schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi+yaml/schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..ca6bfabe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.0", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..925a6a9f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.0/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.0 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..2b999879 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.1", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..4cfae2ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.1 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..31e84e7f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.1", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..cebd9e55 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.1/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.1 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..a9c24a6a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.2", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..13a0628d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.2 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..44cc0c8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.2", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..2da4a372 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.2/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.2 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json new file mode 100644 index 00000000..c61f20df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+json/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi+json;version=3.0.3", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml new file mode 100644 index 00000000..5b1e5f57 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi+yaml/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi+yaml;version=3.0.3 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json new file mode 100644 index 00000000..398c1e9f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.json @@ -0,0 +1,178 @@ +{ + "schemaFormat": "application/vnd.oai.openapi;version=3.0.3", + "schema": { + "name": "schema name", + "title": "schema title", + "multipleOf": 2.5, + "maximum": 100, + "exclusiveMaximum": true, + "minimum": 0, + "exclusiveMinimum": true, + "maxLength": 3, + "minLength": 20, + "pattern": "^\\d{3}-\\d{2}-\\d{4}$", + "maxItems": 10, + "minItems": 1, + "uniqueItems": true, + "maxProperties": 10, + "minProperties": 2, + "required": ["id", "username"], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/PetByAge" + }, + { + "name": "Pet by age", + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "nickname": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/PetByType" + }, + { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + } + ], + "not": { + "name": "Pet by type", + "type": "object", + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog"] + }, + "hunts": { + "type": "boolean" + } + }, + "required": ["pet_type"] + }, + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"] + }, + "hunts": { + "type": "boolean" + } + }, + "additionalProperties": { + "properties": { + "pet_type": { + "type": "string", + "enum": ["Cat", "Dog", "Owl"], + "additionalProperties": false + } + }, + "additionalProperties": { + "properties": { + "hunts": { + "type": "boolean" + } + } + } + }, + "description": "schema description", + "format": "uri", + "$ref": "#/components/example/ref", + "nullable": true, + "readOnly": true, + "writeOnly": true, + "example": { + "type": "string", + "enum": ["approved", "pending", "closed", "new"], + "example": "approved" + }, + "externalDocs": { + "description": "external docs description", + "url": "https://example.docs/this" + }, + "deprecated": true, + "xml": { + "name": "animal", + "namespace": "http://example.com/schema/sample", + "prefix": "sample", + "attribute": true, + "wrapped": true + }, + "enum": ["asc", "desc", null], + "default": ["asc", "desc", null], + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "monster": "https://gigantic-server.com/schemas/Monster/schema.json" + } + }, + "x-extension-property": "value" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml new file mode 100644 index 00000000..886578db --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/openapi/3.0.3/vnd.oai.openapi/schema.yaml @@ -0,0 +1,146 @@ +schemaFormat: application/vnd.oai.openapi;version=3.0.3 +schema: + name: schema name + title: schema title + multipleOf: 2.5 + maximum: 100 + exclusiveMaximum: true + minimum: 0 + exclusiveMinimum: true + maxLength: 3 + minLength: 20 + pattern: '^\d{3}-\d{2}-\d{4}$' + maxItems: 10 + minItems: 1 + uniqueItems: true + maxProperties: 10 + minProperties: 2 + required: + - id + - username + type: object + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + hunts: + type: boolean + age: + type: integer + anyOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + oneOf: + - $ref: '#/components/schemas/PetByAge' + - name: Pet by age + type: object + properties: + age: + type: integer + nickname: + type: string + - $ref: '#/components/schemas/PetByType' + - name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + not: + name: Pet by type + type: object + properties: + pet_type: + type: string + enum: + - Cat + - Dog + hunts: + type: boolean + required: + - pet_type + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + hunts: + type: boolean + additionalProperties: + properties: + pet_type: + type: string + enum: + - Cat + - Dog + - Owl + additionalProperties: false + additionalProperties: + properties: + hunts: + type: boolean + description: schema description + format: uri + $ref: '#/components/example/ref' + nullable: true + readOnly: true + writeOnly: true + example: + type: string + enum: + - approved + - pending + - closed + - new + example: approved + externalDocs: + description: external docs description + url: 'https://example.docs/this' + deprecated: true + xml: + name: animal + namespace: 'http://example.com/schema/sample' + prefix: sample + attribute: true + wrapped: true + enum: + - asc + - desc + - null + default: + - asc + - desc + - null + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + x-extension-property: value \ No newline at end of file From 86f6ff8aa490dbb8c410de077994eb8664efd42c Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 13 Apr 2024 01:04:53 +0400 Subject: [PATCH 25/44] tests(schemaFormat): new AsyncAPI Schema tests https://github.com/asyncapi/jasyncapi/issues/185 --- .../com/asyncapi/v3/schema/SchemaProvider.kt | 37 -- .../multiformat/MultiFormatSchemaTest.kt | 530 +----------------- .../asyncapi/AsyncAPIFormatSchemaTest.kt | 36 ++ .../AsyncAPIFormatSchemaV2_0_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_1_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_2_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_3_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_4_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_5_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV2_6_0Test.kt | 164 ++++++ .../AsyncAPIFormatSchemaV3_0_0Test.kt | 164 ++++++ .../asyncapi/EmptySchemaFormatTest.kt | 104 ++++ .../asyncapi/NullSchemaFormatTest.kt | 106 ++++ .../asyncapi/WithoutSchemaFormatTest.kt | 106 ++++ .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.0.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.0.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.0.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.0.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.1.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.1.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.1.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.1.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.2.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.2.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.2.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.2.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.3.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.3.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.3.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.3.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.4.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.4.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.4.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.4.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.5.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.5.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.5.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.5.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../2.6.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../2.6.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../2.6.0/vnd.aai.asyncapi/person.schema.json | 24 + .../2.6.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + .../arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../person.schema.json | 0 .../regex-pattern.schema.json | 0 .../arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 .../3.0.0/vnd.aai.asyncapi/arrays.schema.json | 37 ++ .../3.0.0/vnd.aai.asyncapi/arrays.schema.yaml | 28 + .../complex-object.schema.json | 44 ++ .../complex-object.schema.yaml | 36 ++ ...conditional-validation-if-else.schema.json | 42 ++ ...conditional-validation-if-else.schema.yaml | 28 + .../draft-07-core-schema-meta-schema.json | 175 ++++++ .../draft-07-core-schema-meta-schema.yaml | 164 ++++++ .../enumerated-values.schema.json | 14 + .../enumerated-values.schema.yaml | 16 + .../3.0.0/vnd.aai.asyncapi/person.schema.json | 24 + .../3.0.0/vnd.aai.asyncapi/person.schema.yaml | 17 + .../regex-pattern.schema.json | 15 + .../regex-pattern.schema.yaml | 10 + 238 files changed, 6876 insertions(+), 555 deletions(-) create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/{ => vnd.aai.asyncapi+yaml}/regex-pattern.schema.yaml (100%) create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt index e24b7cf8..6e5037c1 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -2,7 +2,6 @@ package com.asyncapi.v3.schema import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema import com.asyncapi.v3.schema.multiformat.JsonFormatSchema -import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema import com.asyncapi.v3.schema.openapi.OpenAPISchema interface SchemaProvider { @@ -15,44 +14,8 @@ interface SchemaProvider { fun asyncAPISchema(): AsyncAPISchema = AsyncAPISchema() - fun asyncAPIFormatSchemaJsonV2_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_1_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_1_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_2_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_2_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_3_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_3_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_4_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_4_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_5_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_5_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV2_6_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV2_6_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", asyncAPISchema()) - - fun asyncAPIFormatSchemaJsonV3_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema(asyncAPISchema()) - - fun asyncAPIFormatSchemaYamlV3_0_0(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", asyncAPISchema()) - fun asyncAPIFormatSchemaEmptySchemaFormat(): AsyncAPIFormatSchema = AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", asyncAPISchema()) fun openAPISchema(): OpenAPISchema = OpenAPISchema() - fun openAPIFormatSchemaJson(): OpenAPIFormatSchema = OpenAPIFormatSchema(openAPISchema()) - - fun openAPIFormatSchemaYaml(): OpenAPIFormatSchema = OpenAPIFormatSchema("application/vnd.oai.openapi+yaml;version=3.0.0", openAPISchema()) - } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt index 141d30a5..988ff06e 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -3,7 +3,7 @@ package com.asyncapi.v3.schema.multiformat import com.asyncapi.v3.ClasspathUtils import com.asyncapi.v3.schema.SchemaProvider import com.asyncapi.v3.schema.json.* -import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.multiformat.asyncapi.* import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_1Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_2Test @@ -43,201 +43,47 @@ class MultiFormatSchemaTest { @Nested @DisplayName("2.0.0") - inner class V2_0_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_0_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_0_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_0_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_0_0()) - } - - } + inner class V2_0_0: AsyncAPIFormatSchemaV2_0_0Test() @Nested @DisplayName("2.1.0") - inner class V2_1_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_1_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_1_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_1_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_1_0()) - } - - } + inner class V2_1_0: AsyncAPIFormatSchemaV2_1_0Test() @Nested @DisplayName("2.2.0") - inner class V2_2_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_2_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_2_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_2_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_2_0()) - } - - } + inner class V2_2_0: AsyncAPIFormatSchemaV2_2_0Test() @Nested @DisplayName("2.3.0") - inner class V2_3_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_3_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_3_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_3_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_3_0()) - } - - } + inner class V2_3_0: AsyncAPIFormatSchemaV2_3_0Test() @Nested @DisplayName("2.4.0") - inner class V2_4_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_4_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_4_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_4_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_4_0()) - } - - } + inner class V2_4_0: AsyncAPIFormatSchemaV2_4_0Test() @Nested @DisplayName("2.5.0") - inner class V2_5_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_5_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_5_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_5_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_5_0()) - } - - } + inner class V2_5_0: AsyncAPIFormatSchemaV2_5_0Test() @Nested @DisplayName("2.6.0") - inner class V2_6_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV2_6_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV2_6_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV2_6_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV2_6_0()) - } - - } + inner class V2_6_0: AsyncAPIFormatSchemaV2_6_0Test() @Nested @DisplayName("3.0.0") - inner class V3_0_0 { - - @ArgumentsSource(AsyncAPISchemasJsonFormatV3_0_0::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaJsonV3_0_0()) - } - - @ArgumentsSource(AsyncAPISchemasYamlFormatV3_0_0::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaYamlV3_0_0()) - } - - } + inner class V3_0_0: AsyncAPIFormatSchemaV3_0_0Test() @Nested @DisplayName("MultiFormatSchema with empty schemaFormat is AsyncAPI Schema") - inner class EmptySchemaFormat { - - @ArgumentsSource(JsonSchemasWithEmptySchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - @ArgumentsSource(YamlSchemasWithEmptySchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - } + inner class EmptySchemaFormat: EmptySchemaFormatTest() @Nested @DisplayName("MultiFormatSchema with null schemaFormat is AsyncAPI Schema") - inner class NullSchemaFormat { - - @ArgumentsSource(JsonSchemasWithNullSchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - @ArgumentsSource(YamlSchemasWithNullSchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - } + inner class NullSchemaFormat: NullSchemaFormatTest() @Nested @DisplayName("MultiFormatSchema without schemaFormat is AsyncAPI Schema") - inner class WithoutSchemaFormat { - - @ArgumentsSource(JsonSchemasWithoutSchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - @ArgumentsSource(YamlSchemasWithoutSchemaFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, AsyncAPIFormatSchema::class.java, schemaProvider.asyncAPIFormatSchemaEmptySchemaFormat()) - } - - } + inner class WithoutSchemaFormat: WithoutSchemaFormatTest() } @@ -311,356 +157,4 @@ class MultiFormatSchemaTest { } - class AsyncAPISchemasJsonFormatV2_0_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_0_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_1_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_1_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_2_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_2_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_3_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_3_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_4_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_4_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_5_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_5_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV2_6_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV2_6_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasJsonFormatV3_0_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class AsyncAPISchemasYamlFormatV3_0_0: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class JsonSchemasWithEmptySchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class YamlSchemasWithEmptySchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class JsonSchemasWithNullSchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class YamlSchemasWithNullSchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - - class JsonSchemasWithoutSchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class YamlSchemasWithoutSchemaFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt new file mode 100644 index 00000000..e076b795 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class AsyncAPIFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + openAPIFormatSchemaToCompareWithFilePath: String, + schemaToCheck: AsyncAPIFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(openAPIFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, AsyncAPIFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) + + abstract fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt new file mode 100644 index 00000000..6c70dda0 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_0_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_0_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt new file mode 100644 index 00000000..fde6fb5c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_1_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_1_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.1.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt new file mode 100644 index 00000000..205bdd81 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_2_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_2_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.2.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt new file mode 100644 index 00000000..da5fe7ad --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_3_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_3_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.3.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt new file mode 100644 index 00000000..c7063fbc --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_4_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_4_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.4.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt new file mode 100644 index 00000000..61424c32 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_5_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_5_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.5.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt new file mode 100644 index 00000000..97d059e6 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV2_6_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV2_6_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=2.6.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt new file mode 100644 index 00000000..1f432975 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/AsyncAPIFormatSchemaV3_0_0Test.kt @@ -0,0 +1,164 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AsyncAPIFormatSchemaV3_0_0Test: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+yaml;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ), + // + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt new file mode 100644 index 00000000..009363db --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/EmptySchemaFormatTest.kt @@ -0,0 +1,104 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class EmptySchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of("/json/v3/schema/multiformat/schemaFormat is empty/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is empty/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt new file mode 100644 index 00000000..043ae506 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/NullSchemaFormatTest.kt @@ -0,0 +1,106 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class NullSchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/schemaFormat is null/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt new file mode 100644 index 00000000..86333980 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/asyncapi/WithoutSchemaFormatTest.kt @@ -0,0 +1,106 @@ +package com.asyncapi.v3.schema.multiformat.asyncapi + +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class WithoutSchemaFormatTest: AsyncAPIFormatSchemaTest() { + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + asyncAPIFormatSchemaToCompareWithFilePath: String, + asyncAPIFormatSchema: AsyncAPIFormatSchema + ) { + compareSchemas(asyncAPIFormatSchemaToCompareWithFilePath, asyncAPIFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/arrays.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/person.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.json", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/arrays.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ArraysSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/complex-object.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ComplexObjectTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/conditional-validation-if-else.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", ConditionalValidationIfElse().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/draft-07-core-schema-meta-schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", Draft07CoreSchemaMetaSchemaTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/enumerated-values.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", EnumeratedValuesTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/person.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", PersonTest().asyncAPISchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/without schemaFormat/regex-pattern.schema.yaml", + AsyncAPIFormatSchema("application/vnd.aai.asyncapi+json;version=3.0.0", RegexPatternTest().asyncAPISchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..97eedf64 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..632b49d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..7ae73e9a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..3ba907f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..00718098 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0d0c000e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..82a762a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..6f461678 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..cc4258bb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..393802f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..5f7cf384 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..d09d8353 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..585622fd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..1955ae2a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..ad0c7262 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..5ccb47ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..c84e1acc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..376a3524 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..4147d48c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..bb86ceea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..0fe37492 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..c2f8118a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..08965325 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..9ddd01e6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..5f021a5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..e0b1e117 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..74ac68c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.1.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..1779619b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.1.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.1.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..30e20850 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..a4ee9e5e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..c2cd1d91 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..7b0e8f60 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..44248817 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..0ebfca00 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..d36d60a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..31afd8dc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..66ff5e01 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..b2680bf3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..eb1b4043 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..c8cf594c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..e43a5c42 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.2.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..06515671 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.2.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.2.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..a1ddba2e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..c8b469fa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..f3dc9004 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..d89e869f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..723296d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..cda0bd4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..fd942604 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..eac81525 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..15bc2a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..2cd2611f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..a638c9d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..a68efc39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..0ee9afce --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.3.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..5eb999f3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.3.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.3.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..ee453ee2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..ae29c1b4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..d66dab7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..31fbf610 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..18cad7f6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..48de1d4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..a185fc43 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b8d13d12 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..f5a24ba2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..85acde63 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..c02e8c0f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..16502a8a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..f14b0bf8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.4.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..3a9b47f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.4.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.4.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..038be9e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..545c2f6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..4eddf572 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..a79f3410 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..33c685e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..69b89f02 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..b7b68540 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..ef123b0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..55d9ee66 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..efe6b7df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..e4bebeee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..2360adc3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..a3bc197e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.5.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..3a2a7509 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.5.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.5.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..1e9aa24b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..972cbe24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..6062b663 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..433bc7ca --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..69de6026 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..a65a8a4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..1cf64c5e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..46b10757 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..2504bee4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..79a3224a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..23625df1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..4f7102c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..b6936391 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=2.6.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..b3afbf26 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/2.6.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=2.6.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi+yaml/regex-pattern.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json new file mode 100644 index 00000000..fde8915d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.json @@ -0,0 +1,37 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/arrays.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "A representation of a person, company, organization, or place", + "type": "object", + "properties": { + "fruits": { + "type": "array", + "items": { + "type": "string" + } + }, + "vegetables": { + "type": "array", + "items": { "$ref": "#/definitions/veggie" } + } + }, + "definitions": { + "veggie": { + "type": "object", + "required": [ "veggieName", "veggieLike" ], + "properties": { + "veggieName": { + "type": "string", + "description": "The name of the vegetable." + }, + "veggieLike": { + "type": "boolean", + "description": "Do I like this vegetable?" + } + } + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml new file mode 100644 index 00000000..d6d6df25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/arrays.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/arrays.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + description: 'A representation of a person, company, organization, or place' + type: object + properties: + fruits: + type: array + items: + type: string + vegetables: + type: array + items: + $ref: '#/definitions/veggie' + definitions: + veggie: + type: object + required: + - veggieName + - veggieLike + properties: + veggieName: + type: string + description: The name of the vegetable. + veggieLike: + type: boolean + description: Do I like this vegetable? \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json new file mode 100644 index 00000000..380d050e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.json @@ -0,0 +1,44 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/complex-object.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex Object", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "minimum": 0 + }, + "address": { + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "city": { + "type": "string" + }, + "state": { + "type": "string" + }, + "postalCode": { + "type": "string", + "pattern": "\\d{5}" + } + }, + "required": ["street", "city", "state", "postalCode"] + }, + "hobbies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "age"] + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml new file mode 100644 index 00000000..3dc936a0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/complex-object.schema.yaml @@ -0,0 +1,36 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/complex-object.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Complex Object + type: object + properties: + name: + type: string + age: + type: integer + minimum: 0 + address: + type: object + properties: + street: + type: string + city: + type: string + state: + type: string + postalCode: + type: string + pattern: '\d{5}' + required: + - street + - city + - state + - postalCode + hobbies: + type: array + items: + type: string + required: + - name + - age \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json new file mode 100644 index 00000000..92e2a1b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.json @@ -0,0 +1,42 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/conditional-validation-if-else.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Conditional Validation with If-Else", + "type": "object", + "properties": { + "isMember": { + "type": "boolean" + }, + "membershipNumber": { + "type": "string" + } + }, + "required": ["isMember"], + "if": { + "properties": { + "isMember": { + "const": true + } + } + }, + "then": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 10, + "maxLength": 10 + } + } + }, + "else": { + "properties": { + "membershipNumber": { + "type": "string", + "minLength": 15 + } + } + } + } +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml new file mode 100644 index 00000000..6a60760e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/conditional-validation-if-else.schema.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/conditional-validation-if-else.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Conditional Validation with If-Else + type: object + properties: + isMember: + type: boolean + membershipNumber: + type: string + required: + - isMember + if: + properties: + isMember: + const: true + then: + properties: + membershipNumber: + type: string + minLength: 10 + maxLength: 10 + else: + properties: + membershipNumber: + type: string + minLength: 15 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json new file mode 100644 index 00000000..c61325c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.json @@ -0,0 +1,175 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": { "$ref": "#" }, + "then": { "$ref": "#" }, + "else": { "$ref": "#" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml new file mode 100644 index 00000000..b38a28f8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/draft-07-core-schema-meta-schema.yaml @@ -0,0 +1,164 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $schema: 'http://json-schema.org/draft-07/schema#' + $id: 'http://json-schema.org/draft-07/schema#' + title: Core schema meta-schema + definitions: + schemaArray: + type: array + minItems: 1 + items: + $ref: '#' + nonNegativeInteger: + type: integer + minimum: 0 + nonNegativeIntegerDefault0: + allOf: + - $ref: '#/definitions/nonNegativeInteger' + - default: 0 + simpleTypes: + enum: + - 'array' + - 'boolean' + - 'integer' + - 'null' + - 'number' + - 'object' + - 'string' + stringArray: + type: array + items: + type: string + uniqueItems: true + default: [] + type: + - object + - boolean + properties: + $id: + type: string + format: uri-reference + $schema: + type: string + format: uri + $ref: + type: string + format: uri-reference + $comment: + type: string + title: + type: string + description: + type: string + default: true + readOnly: + type: boolean + default: false + writeOnly: + type: boolean + default: false + examples: + type: array + items: true + multipleOf: + type: number + exclusiveMinimum: 0 + maximum: + type: number + exclusiveMaximum: + type: number + minimum: + type: number + exclusiveMinimum: + type: number + maxLength: + $ref: '#/definitions/nonNegativeInteger' + minLength: + $ref: '#/definitions/nonNegativeIntegerDefault0' + pattern: + type: string + format: regex + additionalItems: + $ref: '#' + items: + anyOf: + - $ref: '#' + - $ref: '#/definitions/schemaArray' + default: true + maxItems: + $ref: '#/definitions/nonNegativeInteger' + minItems: + $ref: '#/definitions/nonNegativeIntegerDefault0' + uniqueItems: + type: boolean + default: false + contains: + $ref: '#' + maxProperties: + $ref: '#/definitions/nonNegativeInteger' + minProperties: + $ref: '#/definitions/nonNegativeIntegerDefault0' + required: + $ref: '#/definitions/stringArray' + additionalProperties: + $ref: '#' + definitions: + type: object + additionalProperties: + $ref: '#' + default: {} + properties: + type: object + additionalProperties: + $ref: '#' + default: {} + patternProperties: + type: object + additionalProperties: + $ref: '#' + propertyNames: + format: regex + default: {} + dependencies: + type: object + additionalProperties: + anyOf: + - $ref: '#' + - $ref: '#/definitions/stringArray' + propertyNames: + $ref: '#' + const: true + enum: + type: array + items: true + minItems: 1 + uniqueItems: true + type: + anyOf: + - $ref: '#/definitions/simpleTypes' + - type: array + items: + $ref: '#/definitions/simpleTypes' + minItems: 1 + uniqueItems: true + format: + type: string + contentMediaType: + type: string + contentEncoding: + type: string + if: + $ref: '#' + then: + $ref: '#' + else: + $ref: '#' + allOf: + $ref: '#/definitions/schemaArray' + anyOf: + $ref: '#/definitions/schemaArray' + oneOf: + $ref: '#/definitions/schemaArray' + not: + $ref: '#' + default: true \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json new file mode 100644 index 00000000..c5f2fbf7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.json @@ -0,0 +1,14 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/enumerated-values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Enumerated Values", + "type": "object", + "properties": { + "data": { + "enum": [42, true, "hello", null, [1, 2, 3]] + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml new file mode 100644 index 00000000..d1bb7ecf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/enumerated-values.schema.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/enumerated-values.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Enumerated Values + type: object + properties: + data: + enum: + - 42 + - true + - hello + - null + - - 1 + - 2 + - 3 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json new file mode 100644 index 00000000..02913a8e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/person.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml new file mode 100644 index 00000000..147e627d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/person.schema.yaml @@ -0,0 +1,17 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/person.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Person + type: object + properties: + firstName: + type: string + description: The person's first name. + lastName: + type: string + description: The person's last name. + age: + description: Age in years which must be equal to or greater than zero. + type: integer + minimum: 0 \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json new file mode 100644 index 00000000..a891512b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.json @@ -0,0 +1,15 @@ +{ + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": { + "$id": "https://example.com/regex-pattern.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Regular Expression Pattern", + "type": "object", + "properties": { + "code": { + "type": "string", + "pattern": "^[A-Z]{3}-\\d{3}$" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml new file mode 100644 index 00000000..bb1def4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/asyncapi/3.0.0/vnd.aai.asyncapi/regex-pattern.schema.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 +schema: + $id: 'https://example.com/regex-pattern.schema.json' + $schema: 'http://json-schema.org/draft-07/schema#' + title: Regular Expression Pattern + type: object + properties: + code: + type: string + pattern: '^[A-Z]{3}-\d{3}$' \ No newline at end of file From 74098347e9e4b0b582dfac37d696869eef6a3dd7 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 13 Apr 2024 01:05:40 +0400 Subject: [PATCH 26/44] chore: project icon for IDEA --- .idea/icon.svg | 1 + 1 file changed, 1 insertion(+) create mode 100755 .idea/icon.svg diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100755 index 00000000..9eea85b6 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file From 1967dba7019dea9bf90931914c21422d3bb085fa Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 13 Apr 2024 01:23:08 +0400 Subject: [PATCH 27/44] test(schemaFormat): refactor Json Schema tests https://github.com/asyncapi/jasyncapi/issues/185 --- .../multiformat/MultiFormatSchemaTest.kt | 75 +---------- .../multiformat/json/JsonFormatSchemaTest.kt | 126 ++++++++++++++++++ .../json/{ => schema+json}/arrays.schema.json | 0 .../complex-object.schema.json | 0 ...conditional-validation-if-else.schema.json | 0 .../draft-07-core-schema-meta-schema.json | 0 .../enumerated-values.schema.json | 0 .../json/{ => schema+json}/person.schema.json | 0 .../regex-pattern.schema.json | 0 .../json/{ => schema+yaml}/arrays.schema.yaml | 0 .../complex-object.schema.yaml | 0 ...conditional-validation-if-else.schema.yaml | 0 .../draft-07-core-schema-meta-schema.yaml | 0 .../enumerated-values.schema.yaml | 0 .../json/{ => schema+yaml}/person.schema.yaml | 0 .../regex-pattern.schema.yaml | 0 16 files changed, 130 insertions(+), 71 deletions(-) create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/arrays.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/complex-object.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/conditional-validation-if-else.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/draft-07-core-schema-meta-schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/enumerated-values.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/person.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+json}/regex-pattern.schema.json (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/arrays.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/complex-object.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/conditional-validation-if-else.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/draft-07-core-schema-meta-schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/enumerated-values.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/person.schema.yaml (100%) rename asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/{ => schema+yaml}/regex-pattern.schema.yaml (100%) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt index 988ff06e..ac1e0875 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -1,43 +1,16 @@ package com.asyncapi.v3.schema.multiformat -import com.asyncapi.v3.ClasspathUtils -import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.json.* import com.asyncapi.v3.schema.multiformat.asyncapi.* +import com.asyncapi.v3.schema.multiformat.json.JsonFormatSchemaTest import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_1Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_2Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_3Test -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.extension.ExtensionContext -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments -import org.junit.jupiter.params.provider.ArgumentsProvider -import org.junit.jupiter.params.provider.ArgumentsSource -import java.util.stream.Stream class MultiFormatSchemaTest { - private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) - .setSerializationInclusion(JsonInclude.Include.NON_NULL) - .findAndRegisterModules() - - fun compareSchemas( - schemaToCompareWith: String, - schemaClass: Class<*>, - schemaToCheck: Schema - ) { - val jsonSchemaString = ClasspathUtils.readAsString(schemaToCompareWith) - val jsonSchema = objectMapper.readValue(jsonSchemaString, schemaClass) - - Assertions.assertEquals(jsonSchema, schemaToCheck) - } - @Nested inner class AsyncAPISchema { @@ -90,17 +63,9 @@ class MultiFormatSchemaTest { @Nested inner class JsonSchema { - @ArgumentsSource(JsonSchemasJsonFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun json(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, JsonFormatSchema::class.java, schemaProvider.jsonFormatSchemaJson()) - } - - @ArgumentsSource(JsonSchemasYamlFormat::class) - @ParameterizedTest(name = "Read: {0}") - fun yaml(schemaToCompareWith: String, schemaProvider: SchemaProvider) { - compareSchemas(schemaToCompareWith, JsonFormatSchema::class.java, schemaProvider.jsonFormatSchemaYaml()) - } + @Nested + @DisplayName("Draft-07") + inner class Draft07: JsonFormatSchemaTest() } @@ -125,36 +90,4 @@ class MultiFormatSchemaTest { } - class JsonSchemasJsonFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/json/arrays.schema.json", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/json/complex-object.schema.json", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/json/enumerated-values.schema.json", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/json/person.schema.json", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/json/regex-pattern.schema.json", RegexPatternTest()) - ) - } - - } - - class JsonSchemasYamlFormat: ArgumentsProvider { - - override fun provideArguments(context: ExtensionContext?): Stream { - return Stream.of( - Arguments.of("/json/v3/schema/multiformat/json/arrays.schema.yaml", ArraysSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/json/complex-object.schema.yaml", ComplexObjectTest()), - Arguments.of("/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml", ConditionalValidationIfElse()), - Arguments.of("/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml", Draft07CoreSchemaMetaSchemaTest()), - Arguments.of("/json/v3/schema/multiformat/json/enumerated-values.schema.yaml", EnumeratedValuesTest()), - Arguments.of("/json/v3/schema/multiformat/json/person.schema.yaml", PersonTest()), - Arguments.of("/json/v3/schema/multiformat/json/regex-pattern.schema.yaml", RegexPatternTest()) - ) - } - - } - } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt new file mode 100644 index 00000000..b8d5f9ff --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/json/JsonFormatSchemaTest.kt @@ -0,0 +1,126 @@ +package com.asyncapi.v3.schema.multiformat.json + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.json.* +import com.asyncapi.v3.schema.multiformat.JsonFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class JsonFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + jsonFormatSchemaToCompareWithFilePath: String, + schemaToCheck: JsonFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(jsonFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, JsonFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + @ArgumentsSource(Json::class) + @ParameterizedTest(name = "Read: {0}") + fun parseJson( + jsonFormatSchemaToCompareWithFilePath: String, + jsonFormatSchema: JsonFormatSchema + ) { + compareSchemas(jsonFormatSchemaToCompareWithFilePath, jsonFormatSchema) + + } + + @ArgumentsSource(Yaml::class) + @ParameterizedTest(name = "Read: {0}") + fun parseYaml( + jsonFormatSchemaToCompareWithFilePath: String, + jsonFormatSchema: JsonFormatSchema + ) { + compareSchemas(jsonFormatSchemaToCompareWithFilePath, jsonFormatSchema) + } + + class Json: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/arrays.schema.json", + JsonFormatSchema(ArraysSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json", + JsonFormatSchema(ComplexObjectTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json", + JsonFormatSchema(ConditionalValidationIfElse().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json", + JsonFormatSchema(Draft07CoreSchemaMetaSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json", + JsonFormatSchema(EnumeratedValuesTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/person.schema.json", + JsonFormatSchema(PersonTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json", + JsonFormatSchema(RegexPatternTest().jsonSchema()) + ) + ) + } + + } + + class Yaml: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ArraysSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ComplexObjectTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", ConditionalValidationIfElse().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", Draft07CoreSchemaMetaSchemaTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", EnumeratedValuesTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", PersonTest().jsonSchema()) + ), + Arguments.of( + "/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml", + JsonFormatSchema("application/schema+yaml;version=draft-07", RegexPatternTest().jsonSchema()) + ) + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/arrays.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/arrays.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/complex-object.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/conditional-validation-if-else.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/draft-07-core-schema-meta-schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/enumerated-values.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/person.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/person.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.json rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+json/regex-pattern.schema.json diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/arrays.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/arrays.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/complex-object.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/complex-object.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/conditional-validation-if-else.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/conditional-validation-if-else.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/draft-07-core-schema-meta-schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/draft-07-core-schema-meta-schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/enumerated-values.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/enumerated-values.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/person.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/person.schema.yaml diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml similarity index 100% rename from asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/regex-pattern.schema.yaml rename to asyncapi-core/src/test/resources/json/v3/schema/multiformat/json/schema+yaml/regex-pattern.schema.yaml From d5a67c757a17baacad6a93ccf28ae96c29c5ae1e Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 13 Apr 2024 14:47:17 +0400 Subject: [PATCH 28/44] feat(avro schema): initial commit https://github.com/asyncapi/jasyncapi/issues/185 --- .../v3/schema/avro/AvroArraySchema.java | 15 + .../v3/schema/avro/AvroEnumSchema.java | 60 ++++ .../v3/schema/avro/AvroFixedSchema.java | 37 +++ .../v3/schema/avro/AvroMapSchema.java | 15 + .../v3/schema/avro/AvroRecordFieldSchema.java | 157 ++++++++++ .../v3/schema/avro/AvroRecordSchema.java | 52 ++++ .../asyncapi/v3/schema/avro/AvroSchema.java | 33 ++ .../v3/schema/avro/AvroSchemaType.java | 75 +++++ .../json/v3/schema/avro/ApplicationEvent.avsc | 27 ++ .../json/v3/schema/avro/DocumentInfo.avsc | 18 ++ .../json/v3/schema/avro/MyResponse.avsc | 13 + .../json/v3/schema/avro/SchemaBuilder.avsc | 284 ++++++++++++++++++ .../avro/TestRecordWithLogicalTypes.avsc | 50 +++ .../avro/TestRecordWithMapsAndArrays.avsc | 23 ++ .../json/v3/schema/avro/TestUnionRecord.avsc | 23 ++ .../json/v3/schema/avro/foo.Bar.avsc | 21 ++ .../json/v3/schema/avro/full_record_v1.avsc | 29 ++ .../json/v3/schema/avro/full_record_v2.avsc | 29 ++ .../json/v3/schema/avro/logical-uuid.avsc | 30 ++ .../logical_types_with_multiple_fields.avsc | 30 ++ .../regression_error_field_in_record.avsc | 22 ++ .../v3/schema/avro/schema-location-read.json | 28 ++ .../v3/schema/avro/schema-location-write.json | 28 ++ .../json/v3/schema/avro/schema-location.json | 14 + .../json/v3/schema/avro/simple_record.avsc | 8 + .../schema/avro/union_and_fixed_fields.avsc | 18 ++ 26 files changed, 1139 insertions(+) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java new file mode 100644 index 00000000..498c066b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java @@ -0,0 +1,15 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; + +/** + * @see Arrays + */ +public class AvroArraySchema { + + @NotNull + @JsonProperty("items") + private String items; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java new file mode 100644 index 00000000..abac9386 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java @@ -0,0 +1,60 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +/** + * Avro Enum Schema + * + * @see Enums + */ +public class AvroEnumSchema { + + @NotNull + @JsonProperty("name") + private String name = ""; + + @Nullable + @JsonProperty("namespace") + private String namespace; + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + private String doc; + + /** + * A JSON array, listing symbols, as JSON strings (required). + *

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

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

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

+ * See documentation on schema resolution for how this gets used. + */ + @Nullable + @JsonProperty("default") + private String defaultValue; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java new file mode 100644 index 00000000..f329d988 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java @@ -0,0 +1,37 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * @see Arrays + */ +public class AvroFixedSchema { + + @NotNull + @JsonProperty("name") + private String name; + + /** + * A JSON string that qualifies the name. + */ + @Nullable + @JsonProperty("namespace") + private String namespace; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + private List<@NotNull String> aliases; + + /** + * An integer, specifying the number of bytes per value (required). + */ + @NotNull + private Integer size; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java new file mode 100644 index 00000000..519ad91f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java @@ -0,0 +1,15 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; + +/** + * @see Maps + */ +public class AvroMapSchema { + + @NotNull + @JsonProperty("values") + private String values; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java new file mode 100644 index 00000000..a53a54d4 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java @@ -0,0 +1,157 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +/** + * Avro Record Field. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Record + */ +public class AvroRecordFieldSchema extends AvroSchema { + + public AvroRecordFieldSchema() { + super(AvroSchemaType.RECORD); + } + + /** + * Field type. + */ + @NotNull + @JsonProperty("type") + private Object type; + + /** + * A JSON string providing the name of the record (required). + */ + @NotNull + @JsonProperty("name") + private String name = ""; + + /** + * Specifies how this field impacts sort ordering of this record (optional). + */ + @Nullable("order") + private Order order = Order.ASCENDING; + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + @JsonProperty("doc") + private String doc; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + @JsonProperty("aliases") + private List<@NotNull String> aliases; + + /** + * A default value for this field, used when reading instances that lack this field (optional). + *

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

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

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

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

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

+ * For more details on how this is used, see the the sort order section. + * + * @see Order + */ + public enum Order { + + @JsonProperty("ascending") + ASCENDING, + + @JsonProperty("descending") + DESCENDING, + + @JsonProperty("ignore") + IGNORE + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java new file mode 100644 index 00000000..464ba693 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java @@ -0,0 +1,52 @@ +package com.asyncapi.v3.schema.avro; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +/** + * Avro Record. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Record + */ +public class AvroRecordSchema extends AvroSchema { + + public AvroRecordSchema() { + super(AvroSchemaType.RECORD); + } + + /** + * A JSON string providing the name of the record (required). + */ + @NotNull + private String name = ""; + + /** + * A JSON string that qualifies the name. + */ + @Nullable + private String namespace; + + /** + * A JSON string providing documentation to the user of this schema (optional). + */ + @Nullable + private String doc; + + /** + * A JSON array of strings, providing alternate names for this record (optional). + */ + @Nullable + private List<@NotNull String> aliases; + + /** + * A JSON array, listing fields (required). + */ + @NotNull + private List<@NotNull AvroRecordFieldSchema> fields = Collections.emptyList(); + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java new file mode 100644 index 00000000..9273f76d --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java @@ -0,0 +1,33 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.Data; +import org.jetbrains.annotations.NotNull; + +/** + * Apache Avro Schema. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Specification + */ +@Data +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "type", + visible = true +) +@JsonSubTypes.Type(value = AvroSchema.class, names = { + "null", "boolean", "int", "long", "float", "double", "bytes", "string" +}) +public class AvroSchema { + + /** + * Avro Schema type. + */ + @NotNull + private AvroSchemaType type; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java new file mode 100644 index 00000000..2dbe8ba1 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java @@ -0,0 +1,75 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import org.jetbrains.annotations.NotNull; + +/** + * Apache Avro Schema types. + * + * @author Pavel Bodiachevskii + * @version 3.0.0 + * @see Avro Schema Primitive Types + * @see Avro Schema Complex Types + */ +public enum AvroSchemaType { + + /* + Primitive Types. + */ + + @JsonProperty("null") + @JsonPropertyDescription("no value") + NULL, + + @JsonProperty("boolean") + @JsonPropertyDescription("a binary value") + BOOLEAN, + + @JsonProperty("int") + @JsonPropertyDescription("32-bit signed integer") + INT, + + @JsonProperty("long") + @JsonPropertyDescription("64-bit signed integer") + LONG, + + @JsonProperty("float") + @JsonPropertyDescription("single precision (32-bit) IEEE 754 floating-point number") + FLOAT, + + @JsonProperty("double") + @JsonPropertyDescription("double precision (64-bit) IEEE 754 floating-point number") + DOUBLE, + + @JsonProperty("bytes") + @JsonPropertyDescription("sequence of 8-bit unsigned bytes") + BYTES, + + @JsonProperty("string") + @JsonPropertyDescription("unicode character sequence") + STRING, + + /* + Complex Types. + */ + + @JsonProperty("record") + RECORD, + + @JsonProperty("enum") + ENUM, + + @JsonProperty("array") + ARRAY, + + @JsonProperty("map") + MAP, + + @JsonProperty("unions") + UNIONS, + + @JsonProperty("fixed") + FIXED; + +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc new file mode 100644 index 00000000..7f27d31b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/ApplicationEvent.avsc @@ -0,0 +1,27 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": ["null", { + "type": "array", + "items": "model.DocumentInfo" + }], + "doc": "", + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc new file mode 100644 index 00000000..7f6383f5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/DocumentInfo.avsc @@ -0,0 +1,18 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc new file mode 100644 index 00000000..c67a6eba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/MyResponse.avsc @@ -0,0 +1,13 @@ +{ + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc new file mode 100644 index 00000000..af11831b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/SchemaBuilder.avsc @@ -0,0 +1,284 @@ +{ + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc new file mode 100644 index 00000000..065b448d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc @@ -0,0 +1,50 @@ +{ + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc new file mode 100644 index 00000000..24487c98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc @@ -0,0 +1,23 @@ +{ + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc new file mode 100644 index 00000000..a6b0bb39 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/TestUnionRecord.avsc @@ -0,0 +1,23 @@ +[ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } +] \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc new file mode 100644 index 00000000..c0d7396e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/foo.Bar.avsc @@ -0,0 +1,21 @@ +{ + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc new file mode 100644 index 00000000..66a80597 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v1.avsc @@ -0,0 +1,29 @@ +{ + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc new file mode 100644 index 00000000..fd809e6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/full_record_v2.avsc @@ -0,0 +1,29 @@ +{ + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] +} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc new file mode 100644 index 00000000..31881474 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical-uuid.avsc @@ -0,0 +1,30 @@ +{ + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc new file mode 100644 index 00000000..a373524e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/logical_types_with_multiple_fields.avsc @@ -0,0 +1,30 @@ +{ + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc new file mode 100644 index 00000000..c01875bf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/regression_error_field_in_record.avsc @@ -0,0 +1,22 @@ +{ + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json new file mode 100644 index 00000000..e94c027f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-read.json @@ -0,0 +1,28 @@ +{ + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json new file mode 100644 index 00000000..3b811fb9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location-write.json @@ -0,0 +1,28 @@ +{ + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json new file mode 100644 index 00000000..e791630a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/schema-location.json @@ -0,0 +1,14 @@ +{ + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc new file mode 100644 index 00000000..39e35347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/simple_record.avsc @@ -0,0 +1,8 @@ +{ + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc b/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc new file mode 100644 index 00000000..01884575 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/avro/union_and_fixed_fields.avsc @@ -0,0 +1,18 @@ +{ + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] +} \ No newline at end of file From e38feadb6b502b1ffe205c412083875339d66cc2 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 13 Apr 2024 14:50:05 +0400 Subject: [PATCH 29/44] feat(avro schema): schemas hierarchy https://github.com/asyncapi/jasyncapi/issues/185 --- .../java/com/asyncapi/v3/schema/avro/AvroArraySchema.java | 6 +++++- .../java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java | 6 +++++- .../java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java | 6 +++++- .../java/com/asyncapi/v3/schema/avro/AvroMapSchema.java | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java index 498c066b..e2543a6c 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java @@ -6,7 +6,11 @@ /** * @see Arrays */ -public class AvroArraySchema { +public class AvroArraySchema extends AvroSchema { + + public AvroArraySchema() { + super(AvroSchemaType.ARRAY); + } @NotNull @JsonProperty("items") diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java index abac9386..4fe12a8d 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java @@ -12,7 +12,11 @@ * * @see Enums */ -public class AvroEnumSchema { +public class AvroEnumSchema extends AvroSchema { + + public AvroEnumSchema() { + super(AvroSchemaType.ENUM); + } @NotNull @JsonProperty("name") diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java index f329d988..7aba05ed 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java @@ -9,7 +9,11 @@ /** * @see Arrays */ -public class AvroFixedSchema { +public class AvroFixedSchema extends AvroSchema { + + public AvroFixedSchema() { + super(AvroSchemaType.FIXED); + } @NotNull @JsonProperty("name") diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java index 519ad91f..1b0ecfd3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java @@ -6,7 +6,11 @@ /** * @see Maps */ -public class AvroMapSchema { +public class AvroMapSchema extends AvroSchema { + + public AvroMapSchema() { + super(AvroSchemaType.MAP); + } @NotNull @JsonProperty("values") From dda9b18a3723142e418730d315edb7cb7ed39f94 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 15 Apr 2024 21:05:58 +0400 Subject: [PATCH 30/44] feat(avro schema): new Avro type - error https://github.com/asyncapi/jasyncapi/issues/185 --- .../main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java index 2dbe8ba1..48137e14 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java @@ -57,6 +57,9 @@ public enum AvroSchemaType { @JsonProperty("record") RECORD, + @JsonProperty("error") + ERROR, + @JsonProperty("enum") ENUM, From 1018622f18bd2073396b4cae614ea936fd642450 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 16 Apr 2024 02:11:35 +0400 Subject: [PATCH 31/44] feat(avro schema): schemas required methods and basic tests https://github.com/asyncapi/jasyncapi/issues/185 --- .../v3/schema/avro/AvroArraySchema.java | 28 +- .../v3/schema/avro/AvroEnumSchema.java | 29 +- .../v3/schema/avro/AvroFixedSchema.java | 20 + .../v3/schema/avro/AvroMapSchema.java | 33 +- .../asyncapi/v3/schema/avro/AvroMetadata.java | 33 + .../v3/schema/avro/AvroRecordFieldSchema.java | 49 +- .../v3/schema/avro/AvroRecordSchema.java | 35 + .../asyncapi/v3/schema/avro/AvroSchema.java | 66 +- ...AvroRecordFieldSchemaTypeDeserializer.java | 63 ++ .../asyncapi/v3/schema/avro/AvroSchemaTest.kt | 59 ++ .../v3/schema/avro/AvroSchemasProvider.kt | 748 ++++++++++++++++++ 11 files changed, 1152 insertions(+), 11 deletions(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java index e2543a6c..48c4ab27 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java @@ -1,19 +1,45 @@ package com.asyncapi.v3.schema.avro; +import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; /** * @see Arrays */ +@Data +@EqualsAndHashCode(callSuper = true) public class AvroArraySchema extends AvroSchema { public AvroArraySchema() { super(AvroSchemaType.ARRAY); } + @Builder(builderMethodName = "arrayBuilder") + public AvroArraySchema( + @NotNull Object items + ) { + super(AvroSchemaType.ARRAY); + this.items = items; + } + @NotNull @JsonProperty("items") - private String items; + @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + private Object items; + + @NotNull + @Override + public AvroSchemaType getType() { + return AvroSchemaType.ARRAY; + } + + public void setType(@NotNull AvroSchemaType type) { + super.setType(AvroSchemaType.ARRAY); + } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java index 4fe12a8d..f82d37f9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java @@ -1,6 +1,11 @@ package com.asyncapi.v3.schema.avro; +import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -12,12 +17,33 @@ * * @see Enums */ +@Data +@EqualsAndHashCode(callSuper = true) public class AvroEnumSchema extends AvroSchema { public AvroEnumSchema() { super(AvroSchemaType.ENUM); } + @Builder(builderMethodName = "enumBuilder") + public AvroEnumSchema( + @NotNull String name, + @Nullable String namespace, + @Nullable String doc, + @NotNull List<@NotNull String> symbols, + @Nullable List<@NotNull String> aliases, + @Nullable Object defaultValue + ) { + super(AvroSchemaType.ENUM); + + this.name = name; + this.namespace = namespace; + this.doc = doc; + this.symbols = symbols; + this.aliases = aliases; + this.defaultValue = defaultValue; + } + @NotNull @JsonProperty("name") private String name = ""; @@ -59,6 +85,7 @@ public AvroEnumSchema() { */ @Nullable @JsonProperty("default") - private String defaultValue; + @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + private Object defaultValue; } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java index 7aba05ed..092b446f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java @@ -1,6 +1,9 @@ package com.asyncapi.v3.schema.avro; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -9,12 +12,29 @@ /** * @see Arrays */ +@Data +@EqualsAndHashCode(callSuper = true) public class AvroFixedSchema extends AvroSchema { public AvroFixedSchema() { super(AvroSchemaType.FIXED); } + @Builder(builderMethodName = "fixedBuilder") + public AvroFixedSchema( + @NotNull String name, + @Nullable String namespace, + @Nullable List<@NotNull String> aliases, + @NotNull Integer size + ) { + super(AvroSchemaType.FIXED); + + this.name = name; + this.namespace = namespace; + this.aliases = aliases; + this.size = size; + } + @NotNull @JsonProperty("name") private String name; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java index 1b0ecfd3..d1488029 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java @@ -1,19 +1,50 @@ package com.asyncapi.v3.schema.avro; +import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; /** * @see Maps */ +@Data +@EqualsAndHashCode(callSuper = true) public class AvroMapSchema extends AvroSchema { public AvroMapSchema() { super(AvroSchemaType.MAP); } + public AvroMapSchema(@NotNull Object values) { + this.values = values; + } + + @Builder(builderMethodName = "mapBuilder") + public AvroMapSchema(@NotNull Object values, @Nullable Map metadata) { + this.values = values; + this.metadata = metadata; + } + @NotNull @JsonProperty("values") - private String values; + @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + private Object values; + + @NotNull + @Override + public AvroSchemaType getType() { + return AvroSchemaType.MAP; + } + + public void setType(@NotNull AvroSchemaType type) { + super.setType(AvroSchemaType.MAP); + } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java new file mode 100644 index 00000000..80372d23 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java @@ -0,0 +1,33 @@ +package com.asyncapi.v3.schema.avro; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties({"metadata"}) +public class AvroMetadata { + + @Nullable + @JsonAnyGetter + protected Map metadata; + + @JsonAnySetter + protected final void readMetadata(String name, Object value) { + if (metadata == null) { + metadata = new HashMap<>(); + } + + metadata.put(name, value); + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java index a53a54d4..b886f41a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java @@ -1,11 +1,16 @@ package com.asyncapi.v3.schema.avro; +import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collections; import java.util.List; +import java.util.Map; /** * Avro Record Field. @@ -14,10 +19,31 @@ * @version 3.0.0 * @see Avro Record */ -public class AvroRecordFieldSchema extends AvroSchema { +@Data +@EqualsAndHashCode(callSuper = true) +public class AvroRecordFieldSchema extends AvroMetadata { public AvroRecordFieldSchema() { - super(AvroSchemaType.RECORD); + this.type = AvroSchemaType.RECORD; + } + + @Builder + public AvroRecordFieldSchema( + @NotNull Object type, + @NotNull String name, + @Nullable Order order, + @Nullable String doc, + @Nullable List<@NotNull String> aliases, + @Nullable Object defaultValue, + @Nullable Map metadata + ) { + this.type = type; + this.name = name; + this.order = order == null ? Order.ASCENDING : order ; + this.doc = doc; + this.aliases = aliases; + this.defaultValue = defaultValue; + this.metadata = metadata; } /** @@ -25,6 +51,7 @@ public AvroRecordFieldSchema() { */ @NotNull @JsonProperty("type") + @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) private Object type; /** @@ -37,9 +64,23 @@ public AvroRecordFieldSchema() { /** * Specifies how this field impacts sort ordering of this record (optional). */ - @Nullable("order") + @Nullable + @JsonProperty("order") private Order order = Order.ASCENDING; + @NotNull + public Order getOrder() { + if (order == null) { + setOrder(Order.ASCENDING); + } + + return order; + } + + public void setOrder(@NotNull Order order) { + this.order = order; + } + /** * A JSON string providing documentation to the user of this schema (optional). */ diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java index 464ba693..bd49e0c3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java @@ -1,5 +1,6 @@ package com.asyncapi.v3.schema.avro; +import lombok.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -13,12 +14,36 @@ * @version 3.0.0 * @see Avro Record */ +@Data +@EqualsAndHashCode(callSuper = true) public class AvroRecordSchema extends AvroSchema { public AvroRecordSchema() { super(AvroSchemaType.RECORD); } + @Builder(builderMethodName = "recordBuilder") + public AvroRecordSchema( + @Nullable AvroSchemaType type, + @NotNull String name, + @Nullable String namespace, + @Nullable String doc, + @Nullable List<@NotNull String> aliases, + @NotNull List<@NotNull AvroRecordFieldSchema> fields + ) { + if (AvroSchemaType.RECORD.equals(type) || AvroSchemaType.ERROR.equals(type)) { + super.setType(type); + } else { + super.setType(AvroSchemaType.RECORD); + } + + this.name = name; + this.namespace = namespace; + this.doc = doc; + this.aliases = aliases; + this.fields = fields; + } + /** * A JSON string providing the name of the record (required). */ @@ -49,4 +74,14 @@ public AvroRecordSchema() { @NotNull private List<@NotNull AvroRecordFieldSchema> fields = Collections.emptyList(); + @NotNull + @Override + public AvroSchemaType getType() { + return AvroSchemaType.RECORD; + } + + public void setType(@NotNull AvroSchemaType type) { + super.setType(AvroSchemaType.RECORD); + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java index 9273f76d..f2e060e6 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java @@ -1,9 +1,11 @@ package com.asyncapi.v3.schema.avro; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import lombok.Data; +import lombok.*; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Apache Avro Schema. @@ -13,16 +15,31 @@ * @see Avro Specification */ @Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true ) -@JsonSubTypes.Type(value = AvroSchema.class, names = { - "null", "boolean", "int", "long", "float", "double", "bytes", "string" +@JsonSubTypes({ + @JsonSubTypes.Type(value = AvroSchema.class, names = { + "null", "boolean", "int", "long", "float", "double", "bytes", "string" + }), + @JsonSubTypes.Type(value = AvroRecordSchema.class, names = {"record", "error"}), + @JsonSubTypes.Type(value = AvroArraySchema.class, name = "array"), + @JsonSubTypes.Type(value = AvroMapSchema.class, name = "map"), + @JsonSubTypes.Type(value = AvroEnumSchema.class, name = "enum"), + @JsonSubTypes.Type(value = AvroFixedSchema.class, name = "fixed"), }) -public class AvroSchema { +public class AvroSchema extends AvroMetadata { + + public AvroSchema(@NotNull AvroSchemaType avroSchemaType) { + this.type = avroSchemaType; + } /** * Avro Schema type. @@ -30,4 +47,45 @@ public class AvroSchema { @NotNull private AvroSchemaType type; + @Nullable + private Integer scale; + + /* + Type: bytes, fixed + */ + + @Nullable + private Integer precision; + + @Nullable + private LogicalType logicalType; + + public enum LogicalType { + + @JsonProperty("decimal") + DECIMAL, + + @JsonProperty("uuid") + UUID, + + @JsonProperty("date") + DATE, + + @JsonProperty("time-millis") + TIME_MILLIS, + + @JsonProperty("time-micros") + TIME_MICROS, + + @JsonProperty("timestamp-millis") + TIMESTAMP_MILLIS, + + @JsonProperty("timestamp-micros") + TIMESTAMP_MICROS, + + @JsonProperty("duration") + DURATION + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java new file mode 100644 index 00000000..f409589e --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java @@ -0,0 +1,63 @@ +package com.asyncapi.v3.schema.avro.jackson; + +import com.asyncapi.v3.schema.avro.AvroSchema; +import com.asyncapi.v3.schema.avro.AvroSchemaType; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class AvroRecordFieldSchemaTypeDeserializer extends JsonDeserializer { + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsList((ArrayNode) jsonNode, objectCodec); + case BOOLEAN: + return jsonNode.asBoolean(); + case NUMBER: + return jsonParser.readValueAs(Number.class); + case OBJECT: + return jsonParser.readValueAs(AvroSchema.class); + case STRING: + return jsonParser.readValueAs(AvroSchemaType.class); + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + List list = new ArrayList<>(); + for (JsonNode childNode : arrayNode) { + list.add(chooseKnownPojo(childNode, objectCodec)); + } + + return list; + } + +} diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt new file mode 100644 index 00000000..07fc0716 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt @@ -0,0 +1,59 @@ +package com.asyncapi.v3.schema.avro + +import com.asyncapi.v3.ClasspathUtils +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +class AvroSchemaTest { + + fun compareSchemas( + schemaToCheckPath: String, + schemaToCheck: AvroSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(schemaToCheckPath) + val schema = objectMapper.readValue(schemaAsJson, AvroSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + @ArgumentsSource(Avro::class) + @ParameterizedTest(name = "Read: {0}") + fun read(schemaToCheckPath: String, avroSchema: AvroSchema) { + compareSchemas(schemaToCheckPath, avroSchema) + } + + class Avro: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( +// Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchemasProvider().applicationEventTest()), // TODO: fix - Cannot deserialize value of type `com.asyncapi.v3.schema.avro.AvroSchemaType` from String "model.DocumentInfo" + Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", AvroSchemasProvider().documentInfo()), + Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", AvroSchemasProvider().fooBar()), + Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", AvroSchemasProvider().fullRecordV1()), + Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", AvroSchemasProvider().fullRecordV2()), + Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", AvroSchemasProvider().logicalUUID()), + Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", AvroSchemasProvider().logicalTypesWithMultipleFields()), + Arguments.of("/json/v3/schema/avro/MyResponse.avsc", AvroSchemasProvider().myResponse()), + Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", AvroSchemasProvider().regressionErrorFieldInRecord()), + Arguments.of("/json/v3/schema/avro/schema-location.json", AvroSchemasProvider().schemaLocation()), + Arguments.of("/json/v3/schema/avro/schema-location-read.json", AvroSchemasProvider().schemaLocationRead()), + Arguments.of("/json/v3/schema/avro/schema-location-write.json", AvroSchemasProvider().schemaLocationWrite()), + Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", AvroSchemasProvider().schemaBuilder()), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt new file mode 100644 index 00000000..e14cc847 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -0,0 +1,748 @@ +package com.asyncapi.v3.schema.avro + +class AvroSchemasProvider { + + fun applicationEventTest(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("ApplicationEvent") + .namespace("model") + .doc("") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("applicationId") + .type(AvroSchemaType.STRING) + .doc("Application ID") + .build(), + AvroRecordFieldSchema.builder() + .name("status") + .type(AvroSchemaType.STRING) + .doc("Application Status") + .build(), + AvroRecordFieldSchema.builder() + .name("documents") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, + AvroArraySchema("model.DocumentInfo") + )) + .doc("") + .defaultValue(null) + .build() + )) + .build() + } + + fun documentInfo(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("DocumentInfo") + .namespace("model") + .doc("") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("documentId") + .type(AvroSchemaType.STRING) + .doc("Document ID") + .build(), + AvroRecordFieldSchema.builder() + .name("filePath") + .type(AvroSchemaType.STRING) + .doc("Document Path") + .build() + )) + .build() + } + + fun fooBar(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("Bar") + .namespace("foo") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("title") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("created_at") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .build() + )) + .build() + )) + .build() + } + + fun fullRecordV1(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("FullRecordV1") + .namespace("org.apache.avro.specific.test") + .doc("Test schema changes: this is the 'old' schema the SpecificRecord expects to see") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("b") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroRecordFieldSchema.builder() + .name("i32") + .type(AvroSchemaType.INT) + .build(), + AvroRecordFieldSchema.builder() + .name("i64") + .type(AvroSchemaType.LONG) + .build(), + AvroRecordFieldSchema.builder() + .name("f32") + .type(AvroSchemaType.FLOAT) + .build(), + AvroRecordFieldSchema.builder() + .name("f64") + .type(AvroSchemaType.DOUBLE) + .build(), + AvroRecordFieldSchema.builder() + .name("s") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroSchemaType.STRING + )) + .build(), + AvroRecordFieldSchema.builder() + .name("h") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroSchemaType.STRING + )) + .build() + )) + .build() + } + + fun fullRecordV2(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("FullRecordV2") + .namespace("org.apache.avro.specific.test") + .doc("Test schema changes: this is the 'new' schema actually used to write data") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("b") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroRecordFieldSchema.builder() + .name("i64") + .type(AvroSchemaType.INT) + .build(), + AvroRecordFieldSchema.builder() + .name("i32") + .type(AvroSchemaType.INT) + .build(), + AvroRecordFieldSchema.builder() + .name("f64") + .type(AvroSchemaType.LONG) + .build(), + AvroRecordFieldSchema.builder() + .name("f32") + // TODO: union type + .type(listOf( + AvroSchemaType.FLOAT, AvroSchemaType.NULL + )) + .build(), + AvroRecordFieldSchema.builder() + .name("newfield") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("h") + .type(AvroSchemaType.BYTES) + .build(), + AvroRecordFieldSchema.builder() + .name("myMap") + .type(AvroMapSchema(AvroSchemaType.STRING)) + .build() + )) + .build() + } + + fun logicalUUID(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("Action") + .namespace("schema.common") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("name") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("guid") + .type(AvroSchema.builder() + .type(AvroSchemaType.STRING) + .logicalType(AvroSchema.LogicalType.UUID) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("time") + .type(AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("requestId") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroSchemaType.STRING + )) + .build() + )) + .build() + } + + fun logicalTypesWithMultipleFields(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("Action") + .namespace("schema.common") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("name") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("uuid") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("time") + .type(AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("requestId") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroSchemaType.STRING + )) + .build() + )) + .build() + } + + fun myResponse(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("MyResponse") + .namespace("model") + .doc("") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("isSuccessful") + .doc("Indicator for successful or unsuccessful call") + .type(AvroSchemaType.BOOLEAN) + .build() + )) + .build() + } + + fun regressionErrorFieldInRecord(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("RecordWithErrorField") + .namespace("org.apache.avro.specific.test") + .doc("With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("s") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroSchemaType.STRING + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("e") + // TODO: union type + .type(listOf( + AvroSchemaType.NULL, AvroRecordSchema.recordBuilder() + .type(AvroSchemaType.ERROR) + .name("TestError") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("message") + .type(AvroSchemaType.STRING) + .build() + )) + .build() + )) + .defaultValue(null) + .build() + )) + .build() + } + + fun schemaLocation(): AvroRecordSchema { + val lat = AvroRecordFieldSchema.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .build() + lat.metadata = mapOf(Pair("field-id", 1)) + + val long = AvroRecordFieldSchema.builder() + .name("long") + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .build() + long.metadata = mapOf(Pair("field-id", 2)) + + return AvroRecordSchema.recordBuilder() + .name("r7") + .fields(listOf(lat, long)) + .build() + } + + fun schemaLocationRead(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("table") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("location") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() + // TODO: union type + .values(listOf( + AvroSchemaType.NULL, + AvroRecordSchema.recordBuilder() + .name("r7") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroRecordFieldSchema.builder() + .name("long_r2") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + )) + .build() + )) + .metadata(mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + )) + .build()) + ) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 5))) + .build() + )) + .build() + } + + fun schemaLocationWrite(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("table") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("location") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() + // TODO: union type + .values(listOf( + AvroSchemaType.NULL, + AvroRecordSchema.recordBuilder() + .name("r7") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroRecordFieldSchema.builder() + .name("long") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + )) + .build() + )) + .metadata(mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + )) + .build()) + ) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 5))) + .build() + )) + .build() + } + + fun schemaBuilder(): AvroRecordSchema { + return AvroRecordSchema.recordBuilder() + .name("recordAll") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("requiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredBooleanWithDefault") + .type(AvroSchemaType.BOOLEAN) + .defaultValue(true) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalBoolean") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.BOOLEAN)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalBooleanWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.NULL)) + .defaultValue(true) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredInt") + .type(AvroSchemaType.INT) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalInt") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.INT)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalIntWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) + .defaultValue(1) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredLong") + .type(AvroSchemaType.LONG) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalLong") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.LONG)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalLongWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) + .defaultValue(1) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredFloat") + .type(AvroSchemaType.FLOAT) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalFloat") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalFloatWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.NULL)) + .defaultValue(1.0) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredDouble") + .type(AvroSchemaType.DOUBLE) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalDouble") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.DOUBLE)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalDoubleWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.NULL)) + .defaultValue(1.0) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredBytes") + .type(AvroSchemaType.BYTES) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalBytes") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.BYTES)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalBytesWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.NULL)) + .defaultValue("A") + .build(), + AvroRecordFieldSchema.builder() + .name("requiredString") + .type(AvroSchemaType.STRING) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalString") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.STRING)) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalStringWithDefault") + // TODO: union type + .type(listOf(AvroSchemaType.STRING, AvroSchemaType.NULL)) + .defaultValue("a") + .build(), + AvroRecordFieldSchema.builder() + .name("requiredRecord") + .type(AvroRecordSchema.recordBuilder() + .name("nestedRequiredRecord") + .fields(listOf(AvroRecordFieldSchema.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build()) + ) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalRecord") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroRecordSchema.recordBuilder() + .name("nestedOptionalRecord") + .fields(listOf(AvroRecordFieldSchema.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build()) + ) + .build() + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalRecordWithDefault") + // TODO: union type + .type(listOf(AvroRecordSchema.recordBuilder() + .name("nestedOptionalRecordWithDefault") + .fields(listOf(AvroRecordFieldSchema.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build()) + ) + .build(), AvroSchemaType.NULL + )) + .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredEnum") + .type(AvroEnumSchema.enumBuilder() + .name("requiredEnum") + .symbols(listOf("a", "b")) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalEnum") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroEnumSchema.enumBuilder() + .name("optionalEnum") + .symbols(listOf("a", "b")) + .build() + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalEnumWithDefault") + // TODO: union type + .type(listOf(AvroEnumSchema.enumBuilder() + .name("optionalEnumWithDefault") + .symbols(listOf("a", "b")) + .build(), AvroSchemaType.NULL, + )) + .defaultValue("b") + .build(), + AvroRecordFieldSchema.builder() + .name("requiredArray") + .type(AvroArraySchema.arrayBuilder() + .items(AvroSchemaType.STRING) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalArray") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroArraySchema.arrayBuilder() + .items(AvroSchemaType.STRING) + .build() + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalArrayWithDefault") + // TODO: union type + .type(listOf(AvroArraySchema.arrayBuilder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + )) + .defaultValue(listOf("a")) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredMap") + .type(AvroMapSchema.mapBuilder() + .values(AvroSchemaType.STRING) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalMap") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() + .values(AvroSchemaType.STRING) + .build() + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalMapWithDefault") + // TODO: union type + .type(listOf(AvroMapSchema.mapBuilder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + )) + .defaultValue(mapOf(Pair("a", "b"))) + .build(), + AvroRecordFieldSchema.builder() + .name("requiredFixed") + .type(AvroFixedSchema.fixedBuilder() + .name("requiredFixed") + .size(1) + .build() + ) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalFixed") + // TODO: union type + .type(listOf(AvroSchemaType.NULL, AvroFixedSchema.fixedBuilder() + .name("optionalFixed") + .size(1) + .build() + )) + .defaultValue(null) + .build(), + AvroRecordFieldSchema.builder() + .name("optionalFixedWithDefault") + // TODO: union type + .type(listOf(AvroFixedSchema.fixedBuilder() + .name("optionalFixedWithDefault") + .size(1) + .build(), AvroSchemaType.NULL + )) + .defaultValue("A") + .build(), + AvroRecordFieldSchema.builder() + .name("unionType") + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) + .build(), + AvroRecordFieldSchema.builder() + .name("unionBooleanWithDefault") + .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.INT)) + .defaultValue(true) + .build(), + AvroRecordFieldSchema.builder() + .name("unionIntWithDefault") + .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) + .defaultValue(1) + .build(), + AvroRecordFieldSchema.builder() + .name("unionLongWithDefault") + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.INT)) + .defaultValue(1) + .build(), + AvroRecordFieldSchema.builder() + .name("unionFloatWithDefault") + .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.INT)) + .defaultValue(1.0) + .build(), + AvroRecordFieldSchema.builder() + .name("unionDoubleWithDefault") + .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.INT)) + .defaultValue(1.0) + .build(), + AvroRecordFieldSchema.builder() + .name("unionBytesWithDefault") + .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.INT)) + .defaultValue("A") + .build(), + AvroRecordFieldSchema.builder() + .name("unionStringWithDefault") + .type(listOf(AvroSchemaType.STRING, AvroSchemaType.INT)) + .defaultValue("a") + .build(), + AvroRecordFieldSchema.builder() + .name("unionRecordWithDefault") + .type(listOf(AvroRecordSchema.recordBuilder() + .name("nestedUnionRecordWithDefault") + .fields(listOf( + AvroRecordFieldSchema.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + )) + .build(), AvroSchemaType.INT + )) + .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) + .build(), + AvroRecordFieldSchema.builder() + .name("unionEnumWithDefault") + .type(listOf(AvroEnumSchema.enumBuilder() + .name("nestedUnionEnumWithDefault") + .symbols(listOf("a", "b")) + .build(), AvroSchemaType.INT + )) + .defaultValue("b") + .build(), + AvroRecordFieldSchema.builder() + .name("unionArrayWithDefault") + .type(listOf(AvroArraySchema.arrayBuilder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT + )) + .defaultValue(listOf("a")) + .build(), + AvroRecordFieldSchema.builder() + .name("unionMapWithDefault") + .type(listOf(AvroMapSchema.mapBuilder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT + )) + .defaultValue(mapOf(Pair("a", "b"))) + .build(), + AvroRecordFieldSchema.builder() + .name("unionFixedWithDefault") + .type(listOf(AvroFixedSchema.fixedBuilder() + .name("nestedUnionFixedWithDefault") + .size(1) + .build(), AvroSchemaType.INT + )) + .defaultValue("A") + .build(), + )) + .build() + } + +} \ No newline at end of file From 2dc488e7a4a662ec92c036718c792695c76d6249 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 16 Apr 2024 03:11:17 +0400 Subject: [PATCH 32/44] refactor(avro schema): rename Avro*Schema to Avro* and move to 1.9.0 package https://github.com/asyncapi/jasyncapi/issues/185 --- .../{AvroSchema.java => v1/_9_0/Avro.java} | 22 +- .../_9_0/AvroArray.java} | 24 +- .../_9_0/AvroEnum.java} | 16 +- .../_9_0/AvroFixed.java} | 12 +- .../_9_0/AvroMap.java} | 24 +- .../avro/{ => v1/_9_0}/AvroMetadata.java | 2 +- .../_9_0/AvroRecord.java} | 28 +- .../_9_0/AvroRecordField.java} | 14 +- .../_9_0/AvroType.java} | 5 +- .../_9_0/jackson/AvroTypeDeserializer.java} | 12 +- .../v3/schema/avro/AvroSchemasProvider.kt | 532 +++++++++--------- .../avro/{AvroSchemaTest.kt => AvroTest.kt} | 13 +- 12 files changed, 367 insertions(+), 337 deletions(-) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroSchema.java => v1/_9_0/Avro.java} (69%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroArraySchema.java => v1/_9_0/AvroArray.java} (52%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroEnumSchema.java => v1/_9_0/AvroEnum.java} (86%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroFixedSchema.java => v1/_9_0/AvroFixed.java} (84%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroMapSchema.java => v1/_9_0/AvroMap.java} (53%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{ => v1/_9_0}/AvroMetadata.java (94%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroRecordSchema.java => v1/_9_0/AvroRecord.java} (68%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroRecordFieldSchema.java => v1/_9_0/AvroRecordField.java} (92%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{AvroSchemaType.java => v1/_9_0/AvroType.java} (93%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/{jackson/AvroRecordFieldSchemaTypeDeserializer.java => v1/_9_0/jackson/AvroTypeDeserializer.java} (83%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/{AvroSchemaTest.kt => AvroTest.kt} (88%) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java similarity index 69% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java index f2e060e6..3b615cfc 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; @@ -26,26 +26,26 @@ visible = true ) @JsonSubTypes({ - @JsonSubTypes.Type(value = AvroSchema.class, names = { + @JsonSubTypes.Type(value = Avro.class, names = { "null", "boolean", "int", "long", "float", "double", "bytes", "string" }), - @JsonSubTypes.Type(value = AvroRecordSchema.class, names = {"record", "error"}), - @JsonSubTypes.Type(value = AvroArraySchema.class, name = "array"), - @JsonSubTypes.Type(value = AvroMapSchema.class, name = "map"), - @JsonSubTypes.Type(value = AvroEnumSchema.class, name = "enum"), - @JsonSubTypes.Type(value = AvroFixedSchema.class, name = "fixed"), + @JsonSubTypes.Type(value = AvroRecord.class, names = {"record", "error"}), + @JsonSubTypes.Type(value = AvroArray.class, name = "array"), + @JsonSubTypes.Type(value = AvroMap.class, name = "map"), + @JsonSubTypes.Type(value = AvroEnum.class, name = "enum"), + @JsonSubTypes.Type(value = AvroFixed.class, name = "fixed"), }) -public class AvroSchema extends AvroMetadata { +public class Avro extends AvroMetadata { - public AvroSchema(@NotNull AvroSchemaType avroSchemaType) { - this.type = avroSchemaType; + public Avro(@NotNull AvroType avroType) { + this.type = avroType; } /** * Avro Schema type. */ @NotNull - private AvroSchemaType type; + private AvroType type; @Nullable private Integer scale; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java similarity index 52% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java index 48c4ab27..8df60659 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroArraySchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java @@ -1,6 +1,6 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; -import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Builder; @@ -13,33 +13,33 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroArraySchema extends AvroSchema { +public class AvroArray extends Avro { - public AvroArraySchema() { - super(AvroSchemaType.ARRAY); + public AvroArray() { + super(AvroType.ARRAY); } @Builder(builderMethodName = "arrayBuilder") - public AvroArraySchema( + public AvroArray( @NotNull Object items ) { - super(AvroSchemaType.ARRAY); + super(AvroType.ARRAY); this.items = items; } @NotNull @JsonProperty("items") - @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + @JsonDeserialize(using = AvroTypeDeserializer.class) private Object items; @NotNull @Override - public AvroSchemaType getType() { - return AvroSchemaType.ARRAY; + public AvroType getType() { + return AvroType.ARRAY; } - public void setType(@NotNull AvroSchemaType type) { - super.setType(AvroSchemaType.ARRAY); + public void setType(@NotNull AvroType type) { + super.setType(AvroType.ARRAY); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java similarity index 86% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java index f82d37f9..fe0446b8 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroEnumSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java @@ -1,6 +1,6 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; -import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Builder; @@ -19,14 +19,14 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroEnumSchema extends AvroSchema { +public class AvroEnum extends Avro { - public AvroEnumSchema() { - super(AvroSchemaType.ENUM); + public AvroEnum() { + super(AvroType.ENUM); } @Builder(builderMethodName = "enumBuilder") - public AvroEnumSchema( + public AvroEnum( @NotNull String name, @Nullable String namespace, @Nullable String doc, @@ -34,7 +34,7 @@ public AvroEnumSchema( @Nullable List<@NotNull String> aliases, @Nullable Object defaultValue ) { - super(AvroSchemaType.ENUM); + super(AvroType.ENUM); this.name = name; this.namespace = namespace; @@ -85,7 +85,7 @@ public AvroEnumSchema( */ @Nullable @JsonProperty("default") - @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + @JsonDeserialize(using = AvroTypeDeserializer.class) private Object defaultValue; } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java similarity index 84% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java index 092b446f..c74e4e2d 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroFixedSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; @@ -14,20 +14,20 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroFixedSchema extends AvroSchema { +public class AvroFixed extends Avro { - public AvroFixedSchema() { - super(AvroSchemaType.FIXED); + public AvroFixed() { + super(AvroType.FIXED); } @Builder(builderMethodName = "fixedBuilder") - public AvroFixedSchema( + public AvroFixed( @NotNull String name, @Nullable String namespace, @Nullable List<@NotNull String> aliases, @NotNull Integer size ) { - super(AvroSchemaType.FIXED); + super(AvroType.FIXED); this.name = name; this.namespace = namespace; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java similarity index 53% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java index d1488029..01a48835 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMapSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java @@ -1,6 +1,6 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; -import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Builder; @@ -16,35 +16,35 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroMapSchema extends AvroSchema { +public class AvroMap extends Avro { - public AvroMapSchema() { - super(AvroSchemaType.MAP); + public AvroMap() { + super(AvroType.MAP); } - public AvroMapSchema(@NotNull Object values) { + public AvroMap(@NotNull Object values) { this.values = values; } @Builder(builderMethodName = "mapBuilder") - public AvroMapSchema(@NotNull Object values, @Nullable Map metadata) { + public AvroMap(@NotNull Object values, @Nullable Map metadata) { this.values = values; this.metadata = metadata; } @NotNull @JsonProperty("values") - @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + @JsonDeserialize(using = AvroTypeDeserializer.class) private Object values; @NotNull @Override - public AvroSchemaType getType() { - return AvroSchemaType.MAP; + public AvroType getType() { + return AvroType.MAP; } - public void setType(@NotNull AvroSchemaType type) { - super.setType(AvroSchemaType.MAP); + public void setType(@NotNull AvroType type) { + super.setType(AvroType.MAP); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java similarity index 94% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java index 80372d23..628bd1cf 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroMetadata.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java similarity index 68% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java index bd49e0c3..272bd6d5 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; import lombok.*; import org.jetbrains.annotations.NotNull; @@ -16,25 +16,25 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroRecordSchema extends AvroSchema { +public class AvroRecord extends Avro { - public AvroRecordSchema() { - super(AvroSchemaType.RECORD); + public AvroRecord() { + super(AvroType.RECORD); } @Builder(builderMethodName = "recordBuilder") - public AvroRecordSchema( - @Nullable AvroSchemaType type, + public AvroRecord( + @Nullable AvroType type, @NotNull String name, @Nullable String namespace, @Nullable String doc, @Nullable List<@NotNull String> aliases, - @NotNull List<@NotNull AvroRecordFieldSchema> fields + @NotNull List<@NotNull AvroRecordField> fields ) { - if (AvroSchemaType.RECORD.equals(type) || AvroSchemaType.ERROR.equals(type)) { + if (AvroType.RECORD.equals(type) || AvroType.ERROR.equals(type)) { super.setType(type); } else { - super.setType(AvroSchemaType.RECORD); + super.setType(AvroType.RECORD); } this.name = name; @@ -72,16 +72,16 @@ public AvroRecordSchema( * A JSON array, listing fields (required). */ @NotNull - private List<@NotNull AvroRecordFieldSchema> fields = Collections.emptyList(); + private List<@NotNull AvroRecordField> fields = Collections.emptyList(); @NotNull @Override - public AvroSchemaType getType() { - return AvroSchemaType.RECORD; + public AvroType getType() { + return AvroType.RECORD; } - public void setType(@NotNull AvroSchemaType type) { - super.setType(AvroSchemaType.RECORD); + public void setType(@NotNull AvroType type) { + super.setType(AvroType.RECORD); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java similarity index 92% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java index b886f41a..5d62e8b8 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroRecordFieldSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java @@ -1,6 +1,6 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; -import com.asyncapi.v3.schema.avro.jackson.AvroRecordFieldSchemaTypeDeserializer; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Builder; @@ -21,14 +21,14 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroRecordFieldSchema extends AvroMetadata { +public class AvroRecordField extends AvroMetadata { - public AvroRecordFieldSchema() { - this.type = AvroSchemaType.RECORD; + public AvroRecordField() { + this.type = AvroType.RECORD; } @Builder - public AvroRecordFieldSchema( + public AvroRecordField( @NotNull Object type, @NotNull String name, @Nullable Order order, @@ -51,7 +51,7 @@ public AvroRecordFieldSchema( */ @NotNull @JsonProperty("type") - @JsonDeserialize(using = AvroRecordFieldSchemaTypeDeserializer.class) + @JsonDeserialize(using = AvroTypeDeserializer.class) private Object type; /** diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java similarity index 93% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java index 48137e14..913320ee 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/AvroSchemaType.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java @@ -1,8 +1,7 @@ -package com.asyncapi.v3.schema.avro; +package com.asyncapi.v3.schema.avro.v1._9_0; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import org.jetbrains.annotations.NotNull; /** * Apache Avro Schema types. @@ -12,7 +11,7 @@ * @see Avro Schema Primitive Types * @see Avro Schema Complex Types */ -public enum AvroSchemaType { +public enum AvroType { /* Primitive Types. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java similarity index 83% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java index f409589e..e8f3fbda 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/jackson/AvroRecordFieldSchemaTypeDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java @@ -1,7 +1,7 @@ -package com.asyncapi.v3.schema.avro.jackson; +package com.asyncapi.v3.schema.avro.v1._9_0.jackson; -import com.asyncapi.v3.schema.avro.AvroSchema; -import com.asyncapi.v3.schema.avro.AvroSchemaType; +import com.asyncapi.v3.schema.avro.v1._9_0.Avro; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroType; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.List; -public class AvroRecordFieldSchemaTypeDeserializer extends JsonDeserializer { +public class AvroTypeDeserializer extends JsonDeserializer { @Override final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { @@ -37,9 +37,9 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) case NUMBER: return jsonParser.readValueAs(Number.class); case OBJECT: - return jsonParser.readValueAs(AvroSchema.class); + return jsonParser.readValueAs(Avro.class); case STRING: - return jsonParser.readValueAs(AvroSchemaType.class); + return jsonParser.readValueAs(AvroType.class); case BINARY: case POJO: case MISSING: diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index e14cc847..67ab9f69 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -1,29 +1,31 @@ package com.asyncapi.v3.schema.avro +import com.asyncapi.v3.schema.avro.v1._9_0.* + class AvroSchemasProvider { - fun applicationEventTest(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun applicationEventTest(): AvroRecord { + return AvroRecord.recordBuilder() .name("ApplicationEvent") .namespace("model") .doc("") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("applicationId") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .doc("Application ID") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("status") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .doc("Application Status") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("documents") // TODO: union type .type(listOf( - AvroSchemaType.NULL, - AvroArraySchema("model.DocumentInfo") + AvroType.NULL, + AvroArray("model.DocumentInfo") )) .doc("") .defaultValue(null) @@ -32,43 +34,43 @@ class AvroSchemasProvider { .build() } - fun documentInfo(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun documentInfo(): AvroRecord { + return AvroRecord.recordBuilder() .name("DocumentInfo") .namespace("model") .doc("") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("documentId") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .doc("Document ID") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("filePath") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .doc("Document Path") .build() )) .build() } - fun fooBar(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun fooBar(): AvroRecord { + return AvroRecord.recordBuilder() .name("Bar") .namespace("foo") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("title") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("created_at") // TODO: union type .type(listOf( - AvroSchemaType.NULL, - AvroSchema.builder() - .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + AvroType.NULL, + Avro.builder() + .type(AvroType.LONG) + .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) .build() )) .build() @@ -76,203 +78,206 @@ class AvroSchemasProvider { .build() } - fun fullRecordV1(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun fullRecordV1(): AvroRecord { + return AvroRecord.recordBuilder() .name("FullRecordV1") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'old' schema the SpecificRecord expects to see") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("b") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("i32") - .type(AvroSchemaType.INT) + .type(AvroType.INT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("i64") - .type(AvroSchemaType.LONG) + .type(AvroType.LONG) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("f32") - .type(AvroSchemaType.FLOAT) + .type(AvroType.FLOAT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("f64") - .type(AvroSchemaType.DOUBLE) + .type(AvroType.DOUBLE) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("s") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroSchemaType.STRING + AvroType.NULL, AvroType.STRING )) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("h") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroSchemaType.STRING + AvroType.NULL, AvroType.STRING )) .build() )) .build() } - fun fullRecordV2(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun fullRecordV2(): AvroRecord { + return AvroRecord.recordBuilder() .name("FullRecordV2") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'new' schema actually used to write data") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("b") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("i64") - .type(AvroSchemaType.INT) + .type(AvroType.INT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("i32") - .type(AvroSchemaType.INT) + .type(AvroType.INT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("f64") - .type(AvroSchemaType.LONG) + .type(AvroType.LONG) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("f32") // TODO: union type .type(listOf( - AvroSchemaType.FLOAT, AvroSchemaType.NULL + AvroType.FLOAT, AvroType.NULL )) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("newfield") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("h") - .type(AvroSchemaType.BYTES) + .type(AvroType.BYTES) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("myMap") - .type(AvroMapSchema(AvroSchemaType.STRING)) + .type(AvroMap(AvroType.STRING)) .build() )) .build() } - fun logicalUUID(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun logicalUUID(): AvroRecord { + return AvroRecord.recordBuilder() .name("Action") .namespace("schema.common") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("name") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("guid") - .type(AvroSchema.builder() - .type(AvroSchemaType.STRING) - .logicalType(AvroSchema.LogicalType.UUID) + .type( + Avro.builder() + .type(AvroType.STRING) + .logicalType(Avro.LogicalType.UUID) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("time") - .type(AvroSchema.builder() - .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .type( + Avro.builder() + .type(AvroType.LONG) + .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requestId") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroSchemaType.STRING + AvroType.NULL, AvroType.STRING )) .build() )) .build() } - fun logicalTypesWithMultipleFields(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun logicalTypesWithMultipleFields(): AvroRecord { + return AvroRecord.recordBuilder() .name("Action") .namespace("schema.common") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("name") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("uuid") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("time") - .type(AvroSchema.builder() - .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .type( + Avro.builder() + .type(AvroType.LONG) + .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requestId") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroSchemaType.STRING + AvroType.NULL, AvroType.STRING )) .build() )) .build() } - fun myResponse(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun myResponse(): AvroRecord { + return AvroRecord.recordBuilder() .name("MyResponse") .namespace("model") .doc("") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("isSuccessful") .doc("Indicator for successful or unsuccessful call") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build() )) .build() } - fun regressionErrorFieldInRecord(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun regressionErrorFieldInRecord(): AvroRecord { + return AvroRecord.recordBuilder() .name("RecordWithErrorField") .namespace("org.apache.avro.specific.test") .doc("With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("s") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroSchemaType.STRING + AvroType.NULL, AvroType.STRING )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("e") // TODO: union type .type(listOf( - AvroSchemaType.NULL, AvroRecordSchema.recordBuilder() - .type(AvroSchemaType.ERROR) + AvroType.NULL, AvroRecord.recordBuilder() + .type(AvroType.ERROR) .name("TestError") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("message") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build() )) .build() @@ -283,49 +288,50 @@ class AvroSchemasProvider { .build() } - fun schemaLocation(): AvroRecordSchema { - val lat = AvroRecordFieldSchema.builder() + fun schemaLocation(): AvroRecord { + val lat = AvroRecordField.builder() .name("lat") - .type(AvroSchemaType.FLOAT) + .type(AvroType.FLOAT) .build() lat.metadata = mapOf(Pair("field-id", 1)) - val long = AvroRecordFieldSchema.builder() + val long = AvroRecordField.builder() .name("long") - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .type(listOf(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .build() long.metadata = mapOf(Pair("field-id", 2)) - return AvroRecordSchema.recordBuilder() + return AvroRecord.recordBuilder() .name("r7") .fields(listOf(lat, long)) .build() } - fun schemaLocationRead(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun schemaLocationRead(): AvroRecord { + return AvroRecord.recordBuilder() .name("table") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("location") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() + .type(listOf( + AvroType.NULL, AvroMap.mapBuilder() // TODO: union type .values(listOf( - AvroSchemaType.NULL, - AvroRecordSchema.recordBuilder() + AvroType.NULL, + AvroRecord.recordBuilder() .name("r7") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("lat") - .type(AvroSchemaType.FLOAT) + .type(AvroType.FLOAT) .metadata(mapOf(Pair("field-id", 1))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("long_r2") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .type(listOf(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .metadata(mapOf(Pair("field-id", 2))) .build() @@ -345,29 +351,30 @@ class AvroSchemasProvider { .build() } - fun schemaLocationWrite(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun schemaLocationWrite(): AvroRecord { + return AvroRecord.recordBuilder() .name("table") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("location") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() + .type(listOf( + AvroType.NULL, AvroMap.mapBuilder() // TODO: union type .values(listOf( - AvroSchemaType.NULL, - AvroRecordSchema.recordBuilder() + AvroType.NULL, + AvroRecord.recordBuilder() .name("r7") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("lat") - .type(AvroSchemaType.FLOAT) + .type(AvroType.FLOAT) .metadata(mapOf(Pair("field-id", 1))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("long") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .type(listOf(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .metadata(mapOf(Pair("field-id", 2))) .build() @@ -387,357 +394,380 @@ class AvroSchemasProvider { .build() } - fun schemaBuilder(): AvroRecordSchema { - return AvroRecordSchema.recordBuilder() + fun schemaBuilder(): AvroRecord { + return AvroRecord.recordBuilder() .name("recordAll") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredBoolean") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredBooleanWithDefault") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .defaultValue(true) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalBoolean") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.BOOLEAN)) + .type(listOf(AvroType.NULL, AvroType.BOOLEAN)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalBooleanWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.NULL)) + .type(listOf(AvroType.BOOLEAN, AvroType.NULL)) .defaultValue(true) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredInt") - .type(AvroSchemaType.INT) + .type(AvroType.INT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalInt") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.INT)) + .type(listOf(AvroType.NULL, AvroType.INT)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalIntWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) + .type(listOf(AvroType.INT, AvroType.NULL)) .defaultValue(1) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredLong") - .type(AvroSchemaType.LONG) + .type(AvroType.LONG) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalLong") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.LONG)) + .type(listOf(AvroType.NULL, AvroType.LONG)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalLongWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) + .type(listOf(AvroType.LONG, AvroType.NULL)) .defaultValue(1) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredFloat") - .type(AvroSchemaType.FLOAT) + .type(AvroType.FLOAT) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalFloat") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .type(listOf(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalFloatWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.NULL)) + .type(listOf(AvroType.FLOAT, AvroType.NULL)) .defaultValue(1.0) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredDouble") - .type(AvroSchemaType.DOUBLE) + .type(AvroType.DOUBLE) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalDouble") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.DOUBLE)) + .type(listOf(AvroType.NULL, AvroType.DOUBLE)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalDoubleWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.NULL)) + .type(listOf(AvroType.DOUBLE, AvroType.NULL)) .defaultValue(1.0) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredBytes") - .type(AvroSchemaType.BYTES) + .type(AvroType.BYTES) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalBytes") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.BYTES)) + .type(listOf(AvroType.NULL, AvroType.BYTES)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalBytesWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.NULL)) + .type(listOf(AvroType.BYTES, AvroType.NULL)) .defaultValue("A") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredString") - .type(AvroSchemaType.STRING) + .type(AvroType.STRING) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalString") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroSchemaType.STRING)) + .type(listOf(AvroType.NULL, AvroType.STRING)) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalStringWithDefault") // TODO: union type - .type(listOf(AvroSchemaType.STRING, AvroSchemaType.NULL)) + .type(listOf(AvroType.STRING, AvroType.NULL)) .defaultValue("a") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredRecord") - .type(AvroRecordSchema.recordBuilder() + .type( + AvroRecord.recordBuilder() .name("nestedRequiredRecord") - .fields(listOf(AvroRecordFieldSchema.builder() + .fields(listOf( + AvroRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build()) ) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalRecord") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroRecordSchema.recordBuilder() + .type(listOf( + AvroType.NULL, AvroRecord.recordBuilder() .name("nestedOptionalRecord") - .fields(listOf(AvroRecordFieldSchema.builder() + .fields(listOf( + AvroRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build()) ) .build() )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalRecordWithDefault") // TODO: union type - .type(listOf(AvroRecordSchema.recordBuilder() + .type(listOf( + AvroRecord.recordBuilder() .name("nestedOptionalRecordWithDefault") - .fields(listOf(AvroRecordFieldSchema.builder() + .fields(listOf( + AvroRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build()) ) - .build(), AvroSchemaType.NULL + .build(), AvroType.NULL )) .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredEnum") - .type(AvroEnumSchema.enumBuilder() + .type( + AvroEnum.enumBuilder() .name("requiredEnum") .symbols(listOf("a", "b")) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalEnum") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroEnumSchema.enumBuilder() + .type(listOf( + AvroType.NULL, AvroEnum.enumBuilder() .name("optionalEnum") .symbols(listOf("a", "b")) .build() )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalEnumWithDefault") // TODO: union type - .type(listOf(AvroEnumSchema.enumBuilder() + .type(listOf( + AvroEnum.enumBuilder() .name("optionalEnumWithDefault") .symbols(listOf("a", "b")) - .build(), AvroSchemaType.NULL, + .build(), AvroType.NULL, )) .defaultValue("b") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredArray") - .type(AvroArraySchema.arrayBuilder() - .items(AvroSchemaType.STRING) + .type( + AvroArray.arrayBuilder() + .items(AvroType.STRING) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalArray") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroArraySchema.arrayBuilder() - .items(AvroSchemaType.STRING) + .type(listOf( + AvroType.NULL, AvroArray.arrayBuilder() + .items(AvroType.STRING) .build() )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalArrayWithDefault") // TODO: union type - .type(listOf(AvroArraySchema.arrayBuilder() - .items(AvroSchemaType.STRING) - .build(), AvroSchemaType.NULL + .type(listOf( + AvroArray.arrayBuilder() + .items(AvroType.STRING) + .build(), AvroType.NULL )) .defaultValue(listOf("a")) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredMap") - .type(AvroMapSchema.mapBuilder() - .values(AvroSchemaType.STRING) + .type( + AvroMap.mapBuilder() + .values(AvroType.STRING) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalMap") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroMapSchema.mapBuilder() - .values(AvroSchemaType.STRING) + .type(listOf( + AvroType.NULL, AvroMap.mapBuilder() + .values(AvroType.STRING) .build() )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalMapWithDefault") // TODO: union type - .type(listOf(AvroMapSchema.mapBuilder() - .values(AvroSchemaType.STRING) - .build(), AvroSchemaType.NULL + .type(listOf( + AvroMap.mapBuilder() + .values(AvroType.STRING) + .build(), AvroType.NULL )) .defaultValue(mapOf(Pair("a", "b"))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("requiredFixed") - .type(AvroFixedSchema.fixedBuilder() + .type( + AvroFixed.fixedBuilder() .name("requiredFixed") .size(1) .build() ) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalFixed") // TODO: union type - .type(listOf(AvroSchemaType.NULL, AvroFixedSchema.fixedBuilder() + .type(listOf( + AvroType.NULL, AvroFixed.fixedBuilder() .name("optionalFixed") .size(1) .build() )) .defaultValue(null) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("optionalFixedWithDefault") // TODO: union type - .type(listOf(AvroFixedSchema.fixedBuilder() + .type(listOf( + AvroFixed.fixedBuilder() .name("optionalFixedWithDefault") .size(1) - .build(), AvroSchemaType.NULL + .build(), AvroType.NULL )) .defaultValue("A") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionType") - .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) + .type(listOf(AvroType.LONG, AvroType.NULL)) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionBooleanWithDefault") - .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.INT)) + .type(listOf(AvroType.BOOLEAN, AvroType.INT)) .defaultValue(true) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionIntWithDefault") - .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) + .type(listOf(AvroType.INT, AvroType.NULL)) .defaultValue(1) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionLongWithDefault") - .type(listOf(AvroSchemaType.LONG, AvroSchemaType.INT)) + .type(listOf(AvroType.LONG, AvroType.INT)) .defaultValue(1) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionFloatWithDefault") - .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.INT)) + .type(listOf(AvroType.FLOAT, AvroType.INT)) .defaultValue(1.0) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionDoubleWithDefault") - .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.INT)) + .type(listOf(AvroType.DOUBLE, AvroType.INT)) .defaultValue(1.0) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionBytesWithDefault") - .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.INT)) + .type(listOf(AvroType.BYTES, AvroType.INT)) .defaultValue("A") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionStringWithDefault") - .type(listOf(AvroSchemaType.STRING, AvroSchemaType.INT)) + .type(listOf(AvroType.STRING, AvroType.INT)) .defaultValue("a") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionRecordWithDefault") - .type(listOf(AvroRecordSchema.recordBuilder() + .type(listOf( + AvroRecord.recordBuilder() .name("nestedUnionRecordWithDefault") .fields(listOf( - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroSchemaType.BOOLEAN) + .type(AvroType.BOOLEAN) .build() )) - .build(), AvroSchemaType.INT + .build(), AvroType.INT )) .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionEnumWithDefault") - .type(listOf(AvroEnumSchema.enumBuilder() + .type(listOf( + AvroEnum.enumBuilder() .name("nestedUnionEnumWithDefault") .symbols(listOf("a", "b")) - .build(), AvroSchemaType.INT + .build(), AvroType.INT )) .defaultValue("b") .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionArrayWithDefault") - .type(listOf(AvroArraySchema.arrayBuilder() - .items(AvroSchemaType.STRING) - .build(), AvroSchemaType.INT + .type(listOf( + AvroArray.arrayBuilder() + .items(AvroType.STRING) + .build(), AvroType.INT )) .defaultValue(listOf("a")) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionMapWithDefault") - .type(listOf(AvroMapSchema.mapBuilder() - .values(AvroSchemaType.STRING) - .build(), AvroSchemaType.INT + .type(listOf( + AvroMap.mapBuilder() + .values(AvroType.STRING) + .build(), AvroType.INT )) .defaultValue(mapOf(Pair("a", "b"))) .build(), - AvroRecordFieldSchema.builder() + AvroRecordField.builder() .name("unionFixedWithDefault") - .type(listOf(AvroFixedSchema.fixedBuilder() + .type(listOf( + AvroFixed.fixedBuilder() .name("nestedUnionFixedWithDefault") .size(1) - .build(), AvroSchemaType.INT + .build(), AvroType.INT )) .defaultValue("A") .build(), diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt similarity index 88% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt index 07fc0716..c15e02f0 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt @@ -1,6 +1,7 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.avro.v1._9_0.Avro import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory @@ -16,10 +17,10 @@ class AvroSchemaTest { fun compareSchemas( schemaToCheckPath: String, - schemaToCheck: AvroSchema + schemaToCheck: Avro ) { val schemaAsJson = ClasspathUtils.readAsString(schemaToCheckPath) - val schema = objectMapper.readValue(schemaAsJson, AvroSchema::class.java) + val schema = objectMapper.readValue(schemaAsJson, Avro::class.java) Assertions.assertEquals(schema, schemaToCheck) } @@ -28,17 +29,17 @@ class AvroSchemaTest { .setSerializationInclusion(JsonInclude.Include.NON_NULL) .findAndRegisterModules() - @ArgumentsSource(Avro::class) + @ArgumentsSource(AvroSchemas::class) @ParameterizedTest(name = "Read: {0}") - fun read(schemaToCheckPath: String, avroSchema: AvroSchema) { + fun read(schemaToCheckPath: String, avroSchema: Avro) { compareSchemas(schemaToCheckPath, avroSchema) } - class Avro: ArgumentsProvider { + class AvroSchemas: ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream { return Stream.of( -// Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchemasProvider().applicationEventTest()), // TODO: fix - Cannot deserialize value of type `com.asyncapi.v3.schema.avro.AvroSchemaType` from String "model.DocumentInfo" +// Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchemasProvider().applicationEventTest()), // TODO: fix - Cannot deserialize value of type `com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaType` from String "model.DocumentInfo" Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", AvroSchemasProvider().documentInfo()), Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", AvroSchemasProvider().fooBar()), Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", AvroSchemasProvider().fullRecordV1()), From 87e7d323462d2ad38bbd313bf5ceba0b55a5521e Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Wed, 17 Apr 2024 01:23:06 +0400 Subject: [PATCH 33/44] refactor(avro schema): Avro Union + tests + default for Map and Array https://github.com/asyncapi/jasyncapi/issues/185 --- .../asyncapi/v3/schema/avro/v1/_9_0/Avro.java | 4 + .../v3/schema/avro/v1/_9_0/AvroArray.java | 16 +- .../v3/schema/avro/v1/_9_0/AvroMap.java | 11 +- .../v3/schema/avro/v1/_9_0/AvroUnion.java | 48 ++++ .../v1/_9_0/jackson/AvroTypeDeserializer.java | 13 +- .../v3/schema/avro/AvroSchemasProvider.kt | 251 ++++++++++++------ .../com/asyncapi/v3/schema/avro/AvroTest.kt | 38 +-- 7 files changed, 278 insertions(+), 103 deletions(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java index 3b615cfc..a7f221df 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java @@ -23,6 +23,7 @@ use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", + defaultImpl = AvroUnion.class, visible = true ) @JsonSubTypes({ @@ -65,6 +66,9 @@ public enum LogicalType { @JsonProperty("decimal") DECIMAL, + @JsonProperty("big-decimal") + BIG_DECIMAL, + @JsonProperty("uuid") UUID, diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java index 8df60659..53b315ba 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java @@ -7,6 +7,9 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; /** * @see Arrays @@ -19,12 +22,19 @@ public AvroArray() { super(AvroType.ARRAY); } + public AvroArray(@NotNull Object items) { + super(AvroType.ARRAY); + this.items = items; + } + @Builder(builderMethodName = "arrayBuilder") public AvroArray( - @NotNull Object items + @NotNull Object items, + @Nullable List defaultValue ) { super(AvroType.ARRAY); this.items = items; + this.defaultValue = defaultValue; } @NotNull @@ -32,6 +42,10 @@ public AvroArray( @JsonDeserialize(using = AvroTypeDeserializer.class) private Object items; + @Nullable + @JsonProperty("default") + private List defaultValue; + @NotNull @Override public AvroType getType() { diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java index 01a48835..2975cc02 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java @@ -27,8 +27,13 @@ public AvroMap(@NotNull Object values) { } @Builder(builderMethodName = "mapBuilder") - public AvroMap(@NotNull Object values, @Nullable Map metadata) { + public AvroMap( + @NotNull Object values, + @Nullable Map defaultValue, + @Nullable Map metadata + ) { this.values = values; + this.defaultValue = defaultValue; this.metadata = metadata; } @@ -37,6 +42,10 @@ public AvroMap(@NotNull Object values, @Nullable Map metadata) { @JsonDeserialize(using = AvroTypeDeserializer.class) private Object values; + @Nullable + @JsonProperty("default") + private Map defaultValue; + @NotNull @Override public AvroType getType() { diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java new file mode 100644 index 00000000..0f97ec03 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java @@ -0,0 +1,48 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.jetbrains.annotations.NotNull; + +import java.util.LinkedList; + +/** + * Avro Union. + *

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

+ * For example, ["null", "string"] declares a schema which may be either a null or string. + *

+ *

+ * Note that when a default value is specified for a record field whose type is a union, + * the type of the default value must match the first element of the union. + *

+ * Thus, for unions containing "null", the "null" is usually listed first, + * since the default value of such unions is typically null. + *

+ *

+ * Unions may not contain more than one schema with the same type, except for the named types record, fixed and enum. + *

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

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

+ * Unions may not immediately contain other unions. + * + * @see Unions + * @see Record + */ +@JsonDeserialize(contentUsing = AvroTypeDeserializer.class) +public class AvroUnion extends LinkedList { + + public AvroUnion() { + super(); + } + + public AvroUnion(@NotNull Object variantA, @NotNull Object variantB) { + super(); + add(0, variantA); + add(1, variantB); + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java index e8f3fbda..2f2f11f7 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java @@ -2,6 +2,7 @@ import com.asyncapi.v3.schema.avro.v1._9_0.Avro; import com.asyncapi.v3.schema.avro.v1._9_0.AvroType; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -12,8 +13,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeType; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; public class AvroTypeDeserializer extends JsonDeserializer { @@ -31,7 +30,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) switch (nodeType) { case ARRAY: - return readAsList((ArrayNode) jsonNode, objectCodec); + return readAsUnion((ArrayNode) jsonNode, objectCodec); case BOOLEAN: return jsonNode.asBoolean(); case NUMBER: @@ -51,13 +50,13 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) } } - private List readAsList(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { - List list = new ArrayList<>(); + private AvroUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroUnion avroUnion = new AvroUnion(); for (JsonNode childNode : arrayNode) { - list.add(chooseKnownPojo(childNode, objectCodec)); + avroUnion.add(chooseKnownPojo(childNode, objectCodec)); } - return list; + return avroUnion; } } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index 67ab9f69..e50678a2 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -22,8 +22,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("documents") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroArray("model.DocumentInfo") )) @@ -65,8 +64,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("created_at") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, Avro.builder() .type(AvroType.LONG) @@ -106,15 +104,13 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("s") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroType.STRING )) .build(), AvroRecordField.builder() .name("h") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroType.STRING )) .build() @@ -146,8 +142,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("f32") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.FLOAT, AvroType.NULL )) .build(), @@ -196,8 +191,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("requestId") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroType.STRING )) .build() @@ -229,8 +223,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("requestId") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroType.STRING )) .build() @@ -261,16 +254,14 @@ class AvroSchemasProvider { .fields(listOf( AvroRecordField.builder() .name("s") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroType.STRING )) .defaultValue(null) .build(), AvroRecordField.builder() .name("e") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroRecord.recordBuilder() .type(AvroType.ERROR) .name("TestError") @@ -314,11 +305,9 @@ class AvroSchemasProvider { .fields(listOf( AvroRecordField.builder() .name("location") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroMap.mapBuilder() - // TODO: union type - .values(listOf( + .values(AvroUnion( AvroType.NULL, AvroRecord.recordBuilder() .name("r7") @@ -330,8 +319,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("long_r2") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.FLOAT)) + .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .metadata(mapOf(Pair("field-id", 2))) .build() @@ -357,11 +345,9 @@ class AvroSchemasProvider { .fields(listOf( AvroRecordField.builder() .name("location") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroMap.mapBuilder() - // TODO: union type - .values(listOf( + .values(AvroUnion( AvroType.NULL, AvroRecord.recordBuilder() .name("r7") @@ -373,8 +359,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("long") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.FLOAT)) + .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .metadata(mapOf(Pair("field-id", 2))) .build() @@ -409,14 +394,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalBoolean") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.BOOLEAN)) + .type(AvroUnion(AvroType.NULL, AvroType.BOOLEAN)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalBooleanWithDefault") - // TODO: union type - .type(listOf(AvroType.BOOLEAN, AvroType.NULL)) + .type(AvroUnion(AvroType.BOOLEAN, AvroType.NULL)) .defaultValue(true) .build(), AvroRecordField.builder() @@ -425,14 +408,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalInt") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.INT)) + .type(AvroUnion(AvroType.NULL, AvroType.INT)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalIntWithDefault") - // TODO: union type - .type(listOf(AvroType.INT, AvroType.NULL)) + .type(AvroUnion(AvroType.INT, AvroType.NULL)) .defaultValue(1) .build(), AvroRecordField.builder() @@ -441,14 +422,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalLong") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.LONG)) + .type(AvroUnion(AvroType.NULL, AvroType.LONG)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalLongWithDefault") - // TODO: union type - .type(listOf(AvroType.LONG, AvroType.NULL)) + .type(AvroUnion(AvroType.LONG, AvroType.NULL)) .defaultValue(1) .build(), AvroRecordField.builder() @@ -457,14 +436,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalFloat") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.FLOAT)) + .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalFloatWithDefault") - // TODO: union type - .type(listOf(AvroType.FLOAT, AvroType.NULL)) + .type(AvroUnion(AvroType.FLOAT, AvroType.NULL)) .defaultValue(1.0) .build(), AvroRecordField.builder() @@ -473,14 +450,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalDouble") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.DOUBLE)) + .type(AvroUnion(AvroType.NULL, AvroType.DOUBLE)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalDoubleWithDefault") - // TODO: union type - .type(listOf(AvroType.DOUBLE, AvroType.NULL)) + .type(AvroUnion(AvroType.DOUBLE, AvroType.NULL)) .defaultValue(1.0) .build(), AvroRecordField.builder() @@ -489,14 +464,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalBytes") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.BYTES)) + .type(AvroUnion(AvroType.NULL, AvroType.BYTES)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalBytesWithDefault") - // TODO: union type - .type(listOf(AvroType.BYTES, AvroType.NULL)) + .type(AvroUnion(AvroType.BYTES, AvroType.NULL)) .defaultValue("A") .build(), AvroRecordField.builder() @@ -505,14 +478,12 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalString") - // TODO: union type - .type(listOf(AvroType.NULL, AvroType.STRING)) + .type(AvroUnion(AvroType.NULL, AvroType.STRING)) .defaultValue(null) .build(), AvroRecordField.builder() .name("optionalStringWithDefault") - // TODO: union type - .type(listOf(AvroType.STRING, AvroType.NULL)) + .type(AvroUnion(AvroType.STRING, AvroType.NULL)) .defaultValue("a") .build(), AvroRecordField.builder() @@ -531,8 +502,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalRecord") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroRecord.recordBuilder() .name("nestedOptionalRecord") .fields(listOf( @@ -547,8 +517,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalRecordWithDefault") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroRecord.recordBuilder() .name("nestedOptionalRecordWithDefault") .fields(listOf( @@ -572,8 +541,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalEnum") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroEnum.enumBuilder() .name("optionalEnum") .symbols(listOf("a", "b")) @@ -583,8 +551,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalEnumWithDefault") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroEnum.enumBuilder() .name("optionalEnumWithDefault") .symbols(listOf("a", "b")) @@ -602,8 +569,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalArray") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroArray.arrayBuilder() .items(AvroType.STRING) .build() @@ -612,8 +578,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalArrayWithDefault") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroArray.arrayBuilder() .items(AvroType.STRING) .build(), AvroType.NULL @@ -630,8 +595,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalMap") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroMap.mapBuilder() .values(AvroType.STRING) .build() @@ -640,8 +604,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalMapWithDefault") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroMap.mapBuilder() .values(AvroType.STRING) .build(), AvroType.NULL @@ -659,8 +622,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalFixed") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroType.NULL, AvroFixed.fixedBuilder() .name("optionalFixed") .size(1) @@ -670,8 +632,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("optionalFixedWithDefault") - // TODO: union type - .type(listOf( + .type(AvroUnion( AvroFixed.fixedBuilder() .name("optionalFixedWithDefault") .size(1) @@ -775,4 +736,138 @@ class AvroSchemasProvider { .build() } + fun simpleRecord(): AvroRecord { + return AvroRecord.recordBuilder() + .name("SimpleRecord") + .fields(listOf( + AvroRecordField.builder() + .type(AvroType.INT) + .name("value") + .build(), + AvroRecordField.builder() + .type(AvroUnion(AvroType.NULL, AvroType.INT)) + .name("nullableValue") + .doc("doc") + .build() + )) + .build() + } + + fun testRecordWithLogicalTypes(): AvroRecord { + return AvroRecord.recordBuilder() + .name("TestRecordWithLogicalTypes") + .doc("Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroRecordField.builder() + .type(AvroType.BOOLEAN) + .name("b") + .build(), + AvroRecordField.builder() + .type(AvroType.INT) + .name("i32") + .build(), + AvroRecordField.builder() + .type(AvroType.LONG) + .name("i64") + .build(), + AvroRecordField.builder() + .type(AvroType.FLOAT) + .name("f32") + .build(), + AvroRecordField.builder() + .type(AvroType.DOUBLE) + .name("f64") + .build(), + AvroRecordField.builder() + .type(AvroUnion(AvroType.NULL, AvroType.STRING)) + .name("s") + .defaultValue(null) + .build(), + AvroRecordField.builder() + .type(Avro.builder() + .type(AvroType.INT) + .logicalType(Avro.LogicalType.DATE) + .build() + ) + .name("d") + .build(), + AvroRecordField.builder() + .type(Avro.builder() + .type(AvroType.INT) + .logicalType(Avro.LogicalType.TIME_MILLIS) + .build() + ) + .name("t") + .build(), + AvroRecordField.builder() + .type(Avro.builder() + .type(AvroType.LONG) + .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) + .build() + ) + .name("ts") + .build(), + AvroRecordField.builder() + .type(Avro.builder() + .type(AvroType.BYTES) + .logicalType(Avro.LogicalType.BIG_DECIMAL) + .build() + ) + .name("bd") + .build(), + )) + .build() + } + + fun testRecordWithMapsAndArrays(): AvroRecord { + return AvroRecord.recordBuilder() + .name("TestRecordWithMapsAndArrays") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroRecordField.builder() + .name("arr") + .type(AvroArray.arrayBuilder() + .items(AvroType.STRING) + .defaultValue(emptyList()) + .build() + ) + .build(), + AvroRecordField.builder() + .name("map") + .type(AvroMap.mapBuilder() + .values(AvroType.LONG) + .defaultValue(emptyMap()) + .build() + ) + .build() + )) + .build() + } + + fun testUnionRecord(): AvroUnion { + return AvroUnion( + AvroType.NULL, + AvroRecord.recordBuilder() + .name("TestUnionRecord") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroRecordField.builder() + .name("amount") + .type(AvroUnion( + AvroType.NULL, + Avro.builder() + .type(AvroType.BYTES) + .logicalType(Avro.LogicalType.DECIMAL) + .precision(31) + .scale(8) + .build() + )) + .defaultValue(null) + .build() + )) + .build() + ) + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt index c15e02f0..dc17cd5b 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt @@ -2,6 +2,7 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.ClasspathUtils import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory @@ -17,10 +18,11 @@ class AvroSchemaTest { fun compareSchemas( schemaToCheckPath: String, - schemaToCheck: Avro + clazz: Class<*>, + schemaToCheck: Any ) { val schemaAsJson = ClasspathUtils.readAsString(schemaToCheckPath) - val schema = objectMapper.readValue(schemaAsJson, Avro::class.java) + val schema = objectMapper.readValue(schemaAsJson, clazz) Assertions.assertEquals(schema, schemaToCheck) } @@ -31,8 +33,8 @@ class AvroSchemaTest { @ArgumentsSource(AvroSchemas::class) @ParameterizedTest(name = "Read: {0}") - fun read(schemaToCheckPath: String, avroSchema: Avro) { - compareSchemas(schemaToCheckPath, avroSchema) + fun read(schemaToCheckPath: String, clazz: Class<*>, avroSchema: Any) { + compareSchemas(schemaToCheckPath, clazz, avroSchema) } class AvroSchemas: ArgumentsProvider { @@ -40,18 +42,22 @@ class AvroSchemaTest { override fun provideArguments(context: ExtensionContext?): Stream { return Stream.of( // Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchemasProvider().applicationEventTest()), // TODO: fix - Cannot deserialize value of type `com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaType` from String "model.DocumentInfo" - Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", AvroSchemasProvider().documentInfo()), - Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", AvroSchemasProvider().fooBar()), - Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", AvroSchemasProvider().fullRecordV1()), - Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", AvroSchemasProvider().fullRecordV2()), - Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", AvroSchemasProvider().logicalUUID()), - Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", AvroSchemasProvider().logicalTypesWithMultipleFields()), - Arguments.of("/json/v3/schema/avro/MyResponse.avsc", AvroSchemasProvider().myResponse()), - Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", AvroSchemasProvider().regressionErrorFieldInRecord()), - Arguments.of("/json/v3/schema/avro/schema-location.json", AvroSchemasProvider().schemaLocation()), - Arguments.of("/json/v3/schema/avro/schema-location-read.json", AvroSchemasProvider().schemaLocationRead()), - Arguments.of("/json/v3/schema/avro/schema-location-write.json", AvroSchemasProvider().schemaLocationWrite()), - Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", AvroSchemasProvider().schemaBuilder()), + Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", Avro::class.java, AvroSchemasProvider().documentInfo()), + Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", Avro::class.java, AvroSchemasProvider().fooBar()), + Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", Avro::class.java, AvroSchemasProvider().fullRecordV1()), + Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", Avro::class.java, AvroSchemasProvider().fullRecordV2()), + Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", Avro::class.java, AvroSchemasProvider().logicalUUID()), + Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", Avro::class.java, AvroSchemasProvider().logicalTypesWithMultipleFields()), + Arguments.of("/json/v3/schema/avro/MyResponse.avsc", Avro::class.java, AvroSchemasProvider().myResponse()), + Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", Avro::class.java, AvroSchemasProvider().regressionErrorFieldInRecord()), + Arguments.of("/json/v3/schema/avro/schema-location.json", Avro::class.java, AvroSchemasProvider().schemaLocation()), + Arguments.of("/json/v3/schema/avro/schema-location-read.json", Avro::class.java, AvroSchemasProvider().schemaLocationRead()), + Arguments.of("/json/v3/schema/avro/schema-location-write.json", Avro::class.java, AvroSchemasProvider().schemaLocationWrite()), + Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", Avro::class.java, AvroSchemasProvider().schemaBuilder()), + Arguments.of("/json/v3/schema/avro/simple_record.avsc", Avro::class.java, AvroSchemasProvider().simpleRecord()), + Arguments.of("/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithLogicalTypes()), + Arguments.of("/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithMapsAndArrays()), + Arguments.of("/json/v3/schema/avro/TestUnionRecord.avsc", AvroUnion::class.java, AvroSchemasProvider().testUnionRecord()), ) } From 2c630c66d8d0d5d0c2ae1bdd10faaa3622361c22 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Wed, 17 Apr 2024 23:57:30 +0400 Subject: [PATCH 34/44] refactor(avro schema): Avro Union new constructor + types now are string https://github.com/asyncapi/jasyncapi/issues/185 --- .../asyncapi/v3/schema/avro/v1/_9_0/Avro.java | 39 ++++++++++--------- .../v3/schema/avro/v1/_9_0/AvroArray.java | 4 +- .../v3/schema/avro/v1/_9_0/AvroMap.java | 4 +- .../v3/schema/avro/v1/_9_0/AvroRecord.java | 6 +-- .../v3/schema/avro/v1/_9_0/AvroType.java | 32 +++++++-------- .../v3/schema/avro/v1/_9_0/AvroUnion.java | 6 +++ .../v1/_9_0/jackson/AvroTypeDeserializer.java | 2 +- .../v3/schema/avro/AvroSchemasProvider.kt | 34 ++++++++++++++++ .../com/asyncapi/v3/schema/avro/AvroTest.kt | 3 +- 9 files changed, 86 insertions(+), 44 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java index a7f221df..cb0b3a2b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java @@ -28,17 +28,18 @@ ) @JsonSubTypes({ @JsonSubTypes.Type(value = Avro.class, names = { - "null", "boolean", "int", "long", "float", "double", "bytes", "string" + AvroType.NULL, AvroType.BOOLEAN, AvroType.INT, AvroType.LONG, + AvroType.FLOAT, AvroType.DOUBLE, AvroType.BYTES, AvroType.STRING }), - @JsonSubTypes.Type(value = AvroRecord.class, names = {"record", "error"}), - @JsonSubTypes.Type(value = AvroArray.class, name = "array"), - @JsonSubTypes.Type(value = AvroMap.class, name = "map"), - @JsonSubTypes.Type(value = AvroEnum.class, name = "enum"), - @JsonSubTypes.Type(value = AvroFixed.class, name = "fixed"), + @JsonSubTypes.Type(value = AvroRecord.class, names = {AvroType.RECORD, AvroType.ERROR}), + @JsonSubTypes.Type(value = AvroArray.class, name = AvroType.ARRAY), + @JsonSubTypes.Type(value = AvroMap.class, name = AvroType.MAP), + @JsonSubTypes.Type(value = AvroEnum.class, name = AvroType.ENUM), + @JsonSubTypes.Type(value = AvroFixed.class, name = AvroType.FIXED), }) public class Avro extends AvroMetadata { - public Avro(@NotNull AvroType avroType) { + public Avro(@NotNull String avroType) { this.type = avroType; } @@ -46,7 +47,7 @@ public Avro(@NotNull AvroType avroType) { * Avro Schema type. */ @NotNull - private AvroType type; + private String type; @Nullable private Integer scale; @@ -59,36 +60,36 @@ public Avro(@NotNull AvroType avroType) { private Integer precision; @Nullable - private LogicalType logicalType; + private String logicalType; - public enum LogicalType { + public static class LogicalType { @JsonProperty("decimal") - DECIMAL, + public static final String DECIMAL = "decimal"; @JsonProperty("big-decimal") - BIG_DECIMAL, + public static final String BIG_DECIMAL = "big-decimal"; @JsonProperty("uuid") - UUID, + public static final String UUID = "uuid"; @JsonProperty("date") - DATE, + public static final String DATE = "date"; @JsonProperty("time-millis") - TIME_MILLIS, + public static final String TIME_MILLIS = "time-millis"; @JsonProperty("time-micros") - TIME_MICROS, + public static final String TIME_MICROS = "time-micros"; @JsonProperty("timestamp-millis") - TIMESTAMP_MILLIS, + public static final String TIMESTAMP_MILLIS = "timestamp-millis"; @JsonProperty("timestamp-micros") - TIMESTAMP_MICROS, + public static final String TIMESTAMP_MICROS = "timestamp-micros"; @JsonProperty("duration") - DURATION + public static final String DURATION = "duration"; } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java index 53b315ba..1d382c2f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java @@ -48,11 +48,11 @@ public AvroArray( @NotNull @Override - public AvroType getType() { + public String getType() { return AvroType.ARRAY; } - public void setType(@NotNull AvroType type) { + public void setType(@NotNull String type) { super.setType(AvroType.ARRAY); } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java index 2975cc02..9f1fb529 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java @@ -48,11 +48,11 @@ public AvroMap( @NotNull @Override - public AvroType getType() { + public String getType() { return AvroType.MAP; } - public void setType(@NotNull AvroType type) { + public void setType(@NotNull String type) { super.setType(AvroType.MAP); } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java index 272bd6d5..1c8d1bef 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java @@ -24,7 +24,7 @@ public AvroRecord() { @Builder(builderMethodName = "recordBuilder") public AvroRecord( - @Nullable AvroType type, + @Nullable String type, @NotNull String name, @Nullable String namespace, @Nullable String doc, @@ -76,11 +76,11 @@ public AvroRecord( @NotNull @Override - public AvroType getType() { + public String getType() { return AvroType.RECORD; } - public void setType(@NotNull AvroType type) { + public void setType(@NotNull String type) { super.setType(AvroType.RECORD); } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java index 913320ee..2ee2bab1 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java @@ -11,7 +11,7 @@ * @see Avro Schema Primitive Types * @see Avro Schema Complex Types */ -public enum AvroType { +public class AvroType { /* Primitive Types. @@ -19,59 +19,59 @@ public enum AvroType { @JsonProperty("null") @JsonPropertyDescription("no value") - NULL, + public static final String NULL = "null"; @JsonProperty("boolean") @JsonPropertyDescription("a binary value") - BOOLEAN, + public static final String BOOLEAN = "boolean"; @JsonProperty("int") @JsonPropertyDescription("32-bit signed integer") - INT, + public static final String INT = "int"; @JsonProperty("long") @JsonPropertyDescription("64-bit signed integer") - LONG, + public static final String LONG = "long"; @JsonProperty("float") @JsonPropertyDescription("single precision (32-bit) IEEE 754 floating-point number") - FLOAT, + public static final String FLOAT = "float"; @JsonProperty("double") @JsonPropertyDescription("double precision (64-bit) IEEE 754 floating-point number") - DOUBLE, + public static final String DOUBLE = "double"; @JsonProperty("bytes") @JsonPropertyDescription("sequence of 8-bit unsigned bytes") - BYTES, + public static final String BYTES = "bytes"; @JsonProperty("string") @JsonPropertyDescription("unicode character sequence") - STRING, + public static final String STRING = "string"; /* Complex Types. */ @JsonProperty("record") - RECORD, + public static final String RECORD = "record"; @JsonProperty("error") - ERROR, + public static final String ERROR = "error"; @JsonProperty("enum") - ENUM, + public static final String ENUM = "enum"; @JsonProperty("array") - ARRAY, + public static final String ARRAY = "array"; @JsonProperty("map") - MAP, + public static final String MAP = "map"; @JsonProperty("unions") - UNIONS, + public static final String UNIONS = "unions"; @JsonProperty("fixed") - FIXED; + public static final String FIXED = "fixed"; } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java index 0f97ec03..87788bb5 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.jetbrains.annotations.NotNull; +import java.util.Arrays; import java.util.LinkedList; /** @@ -39,6 +40,11 @@ public AvroUnion() { super(); } + public AvroUnion(@NotNull Object ...variant) { + super(); + addAll(Arrays.asList(variant)); + } + public AvroUnion(@NotNull Object variantA, @NotNull Object variantB) { super(); add(0, variantA); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java index 2f2f11f7..d45ca745 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java @@ -38,7 +38,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) case OBJECT: return jsonParser.readValueAs(Avro.class); case STRING: - return jsonParser.readValueAs(AvroType.class); + return jsonParser.readValueAs(String.class); case BINARY: case POJO: case MISSING: diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index e50678a2..563ac3be 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -1,6 +1,7 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.schema.avro.v1._9_0.* +import com.asyncapi.v3.schema.avro.v1._9_0.Avro.LogicalType class AvroSchemasProvider { @@ -870,4 +871,37 @@ class AvroSchemasProvider { ) } + fun unionAndFixedFields(): AvroRecord { + return AvroRecord.recordBuilder() + .name("UnionAndFixedFields") + .doc("Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code") + .namespace("org.apache.avro.specific") + .fields(listOf( + AvroRecordField.builder() + .name("u") + .type(AvroUnion( + AvroType.BOOLEAN, AvroType.INT, AvroType.LONG, AvroType.FLOAT, AvroType.STRING + )) + .build(), + AvroRecordField.builder() + .name("l") + .type(AvroUnion( + AvroType.STRING, Avro.builder() + .type(AvroType.LONG) + .logicalType(LogicalType.TIMESTAMP_MILLIS) + .build() + )) + .build(), + AvroRecordField.builder() + .name("f") + .type(AvroFixed.fixedBuilder() + .name("md5") + .size(16) + .build() + ) + .build() + )) + .build() + } + } \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt index dc17cd5b..b8e14903 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt @@ -41,7 +41,7 @@ class AvroSchemaTest { override fun provideArguments(context: ExtensionContext?): Stream { return Stream.of( -// Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchemasProvider().applicationEventTest()), // TODO: fix - Cannot deserialize value of type `com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaType` from String "model.DocumentInfo" + Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", Avro::class.java, AvroSchemasProvider().applicationEventTest()), Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", Avro::class.java, AvroSchemasProvider().documentInfo()), Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", Avro::class.java, AvroSchemasProvider().fooBar()), Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", Avro::class.java, AvroSchemasProvider().fullRecordV1()), @@ -58,6 +58,7 @@ class AvroSchemaTest { Arguments.of("/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithLogicalTypes()), Arguments.of("/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithMapsAndArrays()), Arguments.of("/json/v3/schema/avro/TestUnionRecord.avsc", AvroUnion::class.java, AvroSchemasProvider().testUnionRecord()), + Arguments.of("/json/v3/schema/avro/union_and_fixed_fields.avsc", Avro::class.java, AvroSchemasProvider().unionAndFixedFields()), ) } From 2319ae979a47d9d3127373b2747b7dc843f37fed Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Thu, 18 Apr 2024 01:40:50 +0400 Subject: [PATCH 35/44] feat(avro schema): MultiFormatSchema with Avro https://github.com/asyncapi/jasyncapi/issues/185 --- .../_9_0/jackson/AvroSchemaDeserializer.java | 59 +++ .../schema/multiformat/AvroFormatSchema.java | 55 +++ .../schema/multiformat/MultiFormatSchema.java | 26 ++ .../multiformat/MultiFormatSchemaTest.kt | 38 ++ .../multiformat/avro/AvroFormatSchemaTest.kt | 36 ++ .../avro/AvroFormatSchemaV1_10_0Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_10_1Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_10_2Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_11_0Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_11_1Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_9_0Test.kt | 340 +++++++++++++++++ .../avro/AvroFormatSchemaV1_9_1Test.kt | 342 ++++++++++++++++++ .../avro/AvroFormatSchemaV1_9_2Test.kt | 342 ++++++++++++++++++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.10.0/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.10.0/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.10.0/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.10.0/vnd.apache.avro/MyResponse.json | 16 + .../1.10.0/vnd.apache.avro/MyResponse.yaml | 10 + .../1.10.0/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.10.0/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.10.0/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.10.0/vnd.apache.avro/foo.Bar.yaml | 13 + .../vnd.apache.avro/full_record_v1.json | 33 ++ .../vnd.apache.avro/full_record_v1.yaml | 28 ++ .../vnd.apache.avro/full_record_v2.json | 33 ++ .../vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.10.0/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.10.0/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.10.0/vnd.apache.avro/simple_record.json | 11 + .../1.10.0/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.10.1/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.10.1/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.10.1/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.10.1/vnd.apache.avro/MyResponse.json | 16 + .../1.10.1/vnd.apache.avro/MyResponse.yaml | 10 + .../1.10.1/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.10.1/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.10.1/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.10.1/vnd.apache.avro/foo.Bar.yaml | 13 + .../vnd.apache.avro/full_record_v1.json | 33 ++ .../vnd.apache.avro/full_record_v1.yaml | 28 ++ .../vnd.apache.avro/full_record_v2.json | 33 ++ .../vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.10.1/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.10.1/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.10.1/vnd.apache.avro/simple_record.json | 11 + .../1.10.1/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.10.2/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.10.2/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.10.2/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.10.2/vnd.apache.avro/MyResponse.json | 16 + .../1.10.2/vnd.apache.avro/MyResponse.yaml | 10 + .../1.10.2/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.10.2/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.10.2/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.10.2/vnd.apache.avro/foo.Bar.yaml | 13 + .../vnd.apache.avro/full_record_v1.json | 33 ++ .../vnd.apache.avro/full_record_v1.yaml | 28 ++ .../vnd.apache.avro/full_record_v2.json | 33 ++ .../vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.10.2/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.10.2/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.10.2/vnd.apache.avro/simple_record.json | 11 + .../1.10.2/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.11.0/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.11.0/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.11.0/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.11.0/vnd.apache.avro/MyResponse.json | 16 + .../1.11.0/vnd.apache.avro/MyResponse.yaml | 10 + .../1.11.0/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.11.0/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.11.0/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.11.0/vnd.apache.avro/foo.Bar.yaml | 13 + .../vnd.apache.avro/full_record_v1.json | 33 ++ .../vnd.apache.avro/full_record_v1.yaml | 28 ++ .../vnd.apache.avro/full_record_v2.json | 33 ++ .../vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.11.0/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.11.0/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.11.0/vnd.apache.avro/simple_record.json | 11 + .../1.11.0/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.11.1/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.11.1/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.11.1/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.11.1/vnd.apache.avro/MyResponse.json | 16 + .../1.11.1/vnd.apache.avro/MyResponse.yaml | 10 + .../1.11.1/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.11.1/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.11.1/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.11.1/vnd.apache.avro/foo.Bar.yaml | 13 + .../vnd.apache.avro/full_record_v1.json | 33 ++ .../vnd.apache.avro/full_record_v1.yaml | 28 ++ .../vnd.apache.avro/full_record_v2.json | 33 ++ .../vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.11.1/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.11.1/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.11.1/vnd.apache.avro/simple_record.json | 11 + .../1.11.1/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.9.0/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.9.0/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.9.0/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.9.0/vnd.apache.avro/MyResponse.json | 16 + .../1.9.0/vnd.apache.avro/MyResponse.yaml | 10 + .../1.9.0/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.9.0/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.9.0/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.9.0/vnd.apache.avro/foo.Bar.yaml | 13 + .../1.9.0/vnd.apache.avro/full_record_v1.json | 33 ++ .../1.9.0/vnd.apache.avro/full_record_v1.yaml | 28 ++ .../1.9.0/vnd.apache.avro/full_record_v2.json | 33 ++ .../1.9.0/vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.9.0/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.9.0/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.9.0/vnd.apache.avro/simple_record.json | 11 + .../1.9.0/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.9.1/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.9.1/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.9.1/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.9.1/vnd.apache.avro/MyResponse.json | 16 + .../1.9.1/vnd.apache.avro/MyResponse.yaml | 10 + .../1.9.1/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.9.1/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.9.1/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.9.1/vnd.apache.avro/foo.Bar.yaml | 13 + .../1.9.1/vnd.apache.avro/full_record_v1.json | 33 ++ .../1.9.1/vnd.apache.avro/full_record_v1.yaml | 28 ++ .../1.9.1/vnd.apache.avro/full_record_v2.json | 33 ++ .../1.9.1/vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.9.1/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.9.1/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.9.1/vnd.apache.avro/simple_record.json | 11 + .../1.9.1/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ .../ApplicationEvent.json | 33 ++ .../vnd.apache.avro+json/DocumentInfo.json | 21 ++ .../vnd.apache.avro+json/MyResponse.json | 16 + .../vnd.apache.avro+json/SchemaBuilder.json | 287 +++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../vnd.apache.avro+json/TestUnionRecord.json | 26 ++ .../1.9.2/vnd.apache.avro+json/foo.Bar.json | 24 ++ .../vnd.apache.avro+json/full_record_v1.json | 33 ++ .../vnd.apache.avro+json/full_record_v2.json | 33 ++ .../vnd.apache.avro+json/logical-uuid.json | 33 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../regression_error_field_in_record.json | 25 ++ .../schema-location-read.json | 31 ++ .../schema-location-write.json | 31 ++ .../vnd.apache.avro+json/schema-location.json | 17 + .../vnd.apache.avro+json/simple_record.json | 11 + .../union_and_fixed_fields.json | 21 ++ .../ApplicationEvent.yaml | 20 + .../vnd.apache.avro+yaml/DocumentInfo.yaml | 13 + .../vnd.apache.avro+yaml/MyResponse.yaml | 10 + .../vnd.apache.avro+yaml/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro+yaml/TestUnionRecord.yaml | 15 + .../1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml | 13 + .../vnd.apache.avro+yaml/full_record_v1.yaml | 28 ++ .../vnd.apache.avro+yaml/full_record_v2.yaml | 27 ++ .../vnd.apache.avro+yaml/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.yaml | 23 ++ .../schema-location-read.yaml | 27 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro+yaml/schema-location.yaml | 14 + .../vnd.apache.avro+yaml/simple_record.yaml | 12 + .../union_and_fixed_fields.yaml | 26 ++ .../vnd.apache.avro/ApplicationEvent.json | 33 ++ .../vnd.apache.avro/ApplicationEvent.yaml | 20 + .../1.9.2/vnd.apache.avro/DocumentInfo.json | 21 ++ .../1.9.2/vnd.apache.avro/DocumentInfo.yaml | 13 + .../1.9.2/vnd.apache.avro/MyResponse.json | 16 + .../1.9.2/vnd.apache.avro/MyResponse.yaml | 10 + .../1.9.2/vnd.apache.avro/SchemaBuilder.json | 287 +++++++++++++++ .../1.9.2/vnd.apache.avro/SchemaBuilder.yaml | 275 ++++++++++++++ .../TestRecordWithLogicalTypes.json | 54 +++ .../TestRecordWithLogicalTypes.yaml | 40 ++ .../TestRecordWithMapsAndArrays.json | 26 ++ .../TestRecordWithMapsAndArrays.yaml | 16 + .../vnd.apache.avro/TestUnionRecord.json | 26 ++ .../vnd.apache.avro/TestUnionRecord.yaml | 15 + .../avro/1.9.2/vnd.apache.avro/foo.Bar.json | 24 ++ .../avro/1.9.2/vnd.apache.avro/foo.Bar.yaml | 13 + .../1.9.2/vnd.apache.avro/full_record_v1.json | 33 ++ .../1.9.2/vnd.apache.avro/full_record_v1.yaml | 28 ++ .../1.9.2/vnd.apache.avro/full_record_v2.json | 33 ++ .../1.9.2/vnd.apache.avro/full_record_v2.yaml | 27 ++ .../1.9.2/vnd.apache.avro/logical-uuid.json | 33 ++ .../1.9.2/vnd.apache.avro/logical-uuid.yaml | 21 ++ .../logical_types_with_multiple_fields.json | 33 ++ .../logical_types_with_multiple_fields.yaml | 19 + .../regression_error_field_in_record.json | 25 ++ .../regression_error_field_in_record.yaml | 23 ++ .../vnd.apache.avro/schema-location-read.json | 31 ++ .../vnd.apache.avro/schema-location-read.yaml | 27 ++ .../schema-location-write.json | 31 ++ .../schema-location-write.yaml | 27 ++ .../vnd.apache.avro/schema-location.json | 17 + .../vnd.apache.avro/schema-location.yaml | 14 + .../1.9.2/vnd.apache.avro/simple_record.json | 11 + .../1.9.2/vnd.apache.avro/simple_record.yaml | 12 + .../union_and_fixed_fields.json | 21 ++ .../union_and_fixed_fields.yaml | 26 ++ 589 files changed, 25044 insertions(+) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json create mode 100644 asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java new file mode 100644 index 00000000..09398fdc --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java @@ -0,0 +1,59 @@ +package com.asyncapi.v3.schema.avro.v1._9_0.jackson; + +import com.asyncapi.v3.schema.avro.v1._9_0.Avro; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; + +import java.io.IOException; + +public class AvroSchemaDeserializer extends JsonDeserializer { + + @Override + final public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + ObjectCodec objectCodec = p.getCodec(); + JsonNode node = objectCodec.readTree(p); + + return chooseKnownPojo(node, objectCodec); + } + + private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = jsonNode.traverse(objectCodec)) { + JsonNodeType nodeType = jsonNode.getNodeType(); + + switch (nodeType) { + case ARRAY: + return readAsUnion((ArrayNode) jsonNode, objectCodec); + case OBJECT: + return jsonParser.readValueAs(Avro.class); + case STRING: + return jsonParser.readValueAs(String.class); + case BOOLEAN: + case NUMBER: + case BINARY: + case POJO: + case MISSING: + case NULL: + return null; + } + + return null; + } + } + + private AvroUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroUnion avroUnion = new AvroUnion(); + for (JsonNode childNode : arrayNode) { + avroUnion.add(chooseKnownPojo(childNode, objectCodec)); + } + + return avroUnion; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java new file mode 100644 index 00000000..a6816e56 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java @@ -0,0 +1,55 @@ +package com.asyncapi.v3.schema.multiformat; + +import com.asyncapi.v3.schema.AsyncAPISchema; +import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroSchemaDeserializer; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The Multi Format Schema Object represents a schema definition. It differs from the {@link AsyncAPISchema} in that it supports + * multiple schema formats or languages (e.g., JSON Schema, Avro, etc.). + * + * @see Multi Format Schema + * @see Schema + * @author Pavel Bodiachevskii + * @version 3.0.0 + */ +@EqualsAndHashCode(callSuper = true) +public class AvroFormatSchema extends MultiFormatSchema { + + public AvroFormatSchema(@NotNull @JsonDeserialize(using = AvroSchemaDeserializer.class) Object schema) { + super("application/vnd.apache.avro;version=1.9.0", schema); + } + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public AvroFormatSchema( + @JsonProperty("schemaFormat") @Nullable String schemaFormat, + @JsonProperty("schema") @NotNull @JsonDeserialize(using = AvroSchemaDeserializer.class) Object schema + ) { + super(schemaFormat(schemaFormat), schema); + } + + @Override + public void setSchema(@NotNull Object schema) { + super.setSchema(schema); + } + + @NotNull + public Object getSchema() { + return super.getSchema(); + } + + @NotNull + private static String schemaFormat(@Nullable String schemaFormat) { + if (schemaFormat == null || schemaFormat.isEmpty()) { + return "application/vnd.apache.avro;version=1.9.0"; + } + + return schemaFormat; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java index b5e2209a..f8aab37b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/MultiFormatSchema.java @@ -69,6 +69,32 @@ "application/vnd.aai.asyncapi;version=3.0.0", "application/vnd.aai.asyncapi+json;version=3.0.0", "application/vnd.aai.asyncapi+yaml;version=3.0.0" + }), + @JsonSubTypes.Type(value = AvroFormatSchema.class, names = { + "application/vnd.apache.avro;version=1.9.0", + "application/vnd.apache.avro+json;version=1.9.0", + "application/vnd.apache.avro+yaml;version=1.9.0", + "application/vnd.apache.avro;version=1.9.1", + "application/vnd.apache.avro+json;version=1.9.1", + "application/vnd.apache.avro+yaml;version=1.9.1", + "application/vnd.apache.avro;version=1.9.2", + "application/vnd.apache.avro+json;version=1.9.2", + "application/vnd.apache.avro+yaml;version=1.9.2", + "application/vnd.apache.avro;version=1.10.0", + "application/vnd.apache.avro+json;version=1.10.0", + "application/vnd.apache.avro+yaml;version=1.10.0", + "application/vnd.apache.avro;version=1.10.1", + "application/vnd.apache.avro+json;version=1.10.1", + "application/vnd.apache.avro+yaml;version=1.10.1", + "application/vnd.apache.avro;version=1.10.2", + "application/vnd.apache.avro+json;version=1.10.2", + "application/vnd.apache.avro+yaml;version=1.10.2", + "application/vnd.apache.avro;version=1.11.0", + "application/vnd.apache.avro+json;version=1.11.0", + "application/vnd.apache.avro+yaml;version=1.11.0", + "application/vnd.apache.avro;version=1.11.1", + "application/vnd.apache.avro+json;version=1.11.1", + "application/vnd.apache.avro+yaml;version=1.11.1" }) }) @EqualsAndHashCode(callSuper = true) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt index ac1e0875..5f4132bd 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/MultiFormatSchemaTest.kt @@ -1,6 +1,7 @@ package com.asyncapi.v3.schema.multiformat import com.asyncapi.v3.schema.multiformat.asyncapi.* +import com.asyncapi.v3.schema.multiformat.avro.* import com.asyncapi.v3.schema.multiformat.json.JsonFormatSchemaTest import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_1Test @@ -60,6 +61,43 @@ class MultiFormatSchemaTest { } + @Nested + inner class AvroSchema { + + @Nested + @DisplayName("1.9.0") + inner class V1_9_0: AvroFormatSchemaV1_9_0Test() + + @Nested + @DisplayName("1.9.1") + inner class V1_9_1: AvroFormatSchemaV1_9_1Test() + + @Nested + @DisplayName("1.9.2") + inner class V1_9_2: AvroFormatSchemaV1_9_2Test() + + @Nested + @DisplayName("1.10.0") + inner class V1_10_0: AvroFormatSchemaV1_10_0Test() + + @Nested + @DisplayName("1.10.1") + inner class V1_10_1: AvroFormatSchemaV1_10_1Test() + + @Nested + @DisplayName("1.10.2") + inner class V1_10_2: AvroFormatSchemaV1_10_2Test() + + @Nested + @DisplayName("1.11.0") + inner class V1_11_0: AvroFormatSchemaV1_11_0Test() + + @Nested + @DisplayName("1.11.1") + inner class V1_11_1: AvroFormatSchemaV1_11_1Test() + + } + @Nested inner class JsonSchema { diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt new file mode 100644 index 00000000..af4a4912 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.ClasspathUtils +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import org.junit.jupiter.api.Assertions + +abstract class AvroFormatSchemaTest { + + private val objectMapper: ObjectMapper = ObjectMapper(YAMLFactory()) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .findAndRegisterModules() + + fun compareSchemas( + avroFormatSchemaToCompareWithFilePath: String, + schemaToCheck: AvroFormatSchema + ) { + val schemaAsJson = ClasspathUtils.readAsString(avroFormatSchemaToCompareWithFilePath) + val schema = objectMapper.readValue(schemaAsJson, AvroFormatSchema::class.java) + + Assertions.assertEquals(schema, schemaToCheck) + } + + abstract fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) + + abstract fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt new file mode 100644 index 00000000..fe65350c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt new file mode 100644 index 00000000..b618c349 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt new file mode 100644 index 00000000..253b09ad --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_10_2Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.10.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt new file mode 100644 index 00000000..ab4afe62 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_11_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt new file mode 100644 index 00000000..08c002ac --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_11_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.11.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt new file mode 100644 index 00000000..9bd6c750 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt @@ -0,0 +1,340 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_0Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.0", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt new file mode 100644 index 00000000..320ba19b --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_1Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.1", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt new file mode 100644 index 00000000..ee9ee832 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt @@ -0,0 +1,342 @@ +package com.asyncapi.v3.schema.multiformat.avro + +import com.asyncapi.v3.schema.avro.AvroSchemasProvider +import com.asyncapi.v3.schema.avro.v1._9_0.Avro +import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource +import java.util.stream.Stream + +abstract class AvroFormatSchemaV1_9_2Test: AvroFormatSchemaTest() { + + @ArgumentsSource(JsonFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseJson( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + @ArgumentsSource(YamlFormat::class) + @ParameterizedTest(name = "Read: {0}") + override fun parseYaml( + avroFormatSchemaToCompareWithFilePath: String, + avroFormatSchema: AvroFormatSchema + ) { + compareSchemas(avroFormatSchemaToCompareWithFilePath, avroFormatSchema) + } + + class JsonFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro+json;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + + class YamlFormat: ArgumentsProvider { + + override fun provideArguments(context: ExtensionContext?): Stream { + return Stream.of( + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro+yaml;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().applicationEventTest()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().documentInfo()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fooBar()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV1()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().fullRecordV2()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalUUID()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().logicalTypesWithMultipleFields()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().myResponse()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().regressionErrorFieldInRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocation()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationRead()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaLocationWrite()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().schemaBuilder()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().simpleRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithLogicalTypes()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testRecordWithMapsAndArrays()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().testUnionRecord()) + ), + Arguments.of( + "/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml", + AvroFormatSchema("application/vnd.apache.avro;version=1.9.2", AvroSchemasProvider().unionAndFixedFields()) + ), + ) + } + + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..6784598d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..addba641 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..957b23b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..80ae4a3f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..96317d72 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..45805cfb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..a18d294b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..5996ba21 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..2af6e464 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..f0b29eb5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..ac1ebcfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..0ff839e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..e2d043e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..c5eebe4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..1dabd345 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..53d8bfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..373c5467 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..8d17f257 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..2d0c9267 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..9c5a3156 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..0661e521 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..ffa79186 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..cc6ca4ac --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..fe5960bd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..447765b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..5bbd9250 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..2256e4c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..0366e21b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..695eb8ea --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..103a2b4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..552a8f35 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..0f0a092d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..64f55018 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..48255741 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..53918421 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..3679160b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..94b9383a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..63fa67fc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..1a35ab61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..364460c3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..ac17210c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..fbef0d1e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..7e848a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..8ea98efb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..bfb77ff2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..b037f7cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..533ac151 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..0d35c7b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..a5a51429 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..86b0b054 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..3f0ab400 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..5176e9b4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..4a0f4aa1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..c9e7eda6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..e9d59b9d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..89699204 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..f0ccb928 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..7ce393a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..44bb2aa7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..1feeaab2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..dd638c1b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..3578e507 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..4f0d5526 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..fe80ba0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..5532797b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..a832e70d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..18357b60 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..11e2889d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..e03e2998 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..aed0e550 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..3abf3347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..9be06c34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..a43d0f6f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..686ba97d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..3e162495 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..6b83f55f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..7b6acade --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c3c0346a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..20d1ea68 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..df5a1b7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..316ca67d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..cec3ad41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..f7d69f77 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..9e88a248 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..e9ac2d90 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..6fc34ed4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..a0fca74e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..3f9dcdf0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..6b13de4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..d033ec6d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..e0ee2cda --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..af2975c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..2ac28fce --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..631a0bd0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..f9624a13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..d2623811 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..bc9d1f2b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..b198cf1c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..7ac87480 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..cd4c103f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..d7e5e136 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..885ff7ca --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..68f12374 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..bd75cda3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..a177941b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..b77aa3a2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..a9c031de --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..f3323395 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..c100e124 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..32c75173 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..3a454c65 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..3af8ca73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..3292040d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..98bb02b9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..79037029 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..19cfae6e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..6e6ebc8d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..37bf7ae1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..7dd6053f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..ed45b0f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..79f81e0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..d0e03b67 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..4832c791 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..0908d65a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..ca86f831 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..ae4221c7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..e15c6e07 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..675ade4b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..ac8c6370 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..1c88b8a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..0bb35b65 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..3ccbb235 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..bbcbf6d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..2c73986d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..e3c376b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..d14f3d11 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..f3751913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..92c1d404 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..ffb30a44 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..020b315c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..440925b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..0ed04ed7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..8fba05a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..13fd2fd9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..1319e4df --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..7e36a744 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..9c21f64e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..93cbcb03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..3e1d4926 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..04066c13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..9a394d7c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..b6ec45e5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..1bcb188b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..acbd8d4c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..8ab1d27e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..83c16b37 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..854230e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..f89dfc24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..8d972805 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..6d2aef04 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..3866080d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..a27541c1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.10.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..0e3c8dc4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..0921e297 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..5e5fc560 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..f35068e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..48ce722a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..5ffc7693 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..69b1dae0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..3b1b76b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..6d98a94e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..d9501a4e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..9ba29202 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..7f07d913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..8fd2223c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..5bd4f789 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..5afa1faf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..6233a7ef --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..4e71d612 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..6060855d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.10.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..17a3c1ef --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..5a7c37e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..726e9ffe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..8a752139 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..dfe8240f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..9029df24 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..06446dfc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..2e5dafda --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..ca21c01b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..e07403e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..1742ad71 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..379d44db --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..abeb59a7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..ec5acc73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..3c73fb56 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..4c78ded2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..ba4e8b7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..4c4fd999 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..9988c4d6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..cca79f12 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..a92d39e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..b8d493c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..8961acbd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..b3f02f95 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..1fbc7937 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..944d3a34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..da640be8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..20947e15 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..cea82de0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..6cdda889 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..e75508b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..3ae4ebfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..91bab326 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..7a31802f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..571e97b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.10.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..fbe84270 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.10.2/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.10.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..4a81ed64 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..0a55f74f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..29a06856 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..f4e5567b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..c7f2cf0d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c9cf455b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..9404f855 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..ac9f87b3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..fd6df24f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..eb6551e8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..ee720169 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..ba2c8198 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..3dc0b006 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..7e1a424d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..11abfed4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..eba8c1f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..2e3f27cb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..93d43634 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..03236807 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..22072983 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..aff0e94f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..335d4876 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..296a4d25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..e6cc3384 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..aeea4687 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..7a3db901 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..39a21559 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..542ec781 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..fef0e1e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..5477bb8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..bfb67852 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..4d681e41 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..37d7dd14 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..96eb6bdc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..0a8bd77a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..6c9b12f9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..fd627743 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..3a4eb834 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..a624086d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..08c3c214 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..70eb69e9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..0e556bec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..7b40b630 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..5b28fa84 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..121798e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..c70f7d5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..9b9daa8f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..81344dee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..eedd00a8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..f4e5cfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..941c2170 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..5682fce4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..8ffa4eaa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..d4a745ff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..4203673b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..4977af69 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..9f724db4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..12d128e4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..74394a76 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..4ecac9d4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..77f23d93 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..6d49f053 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..2f80eca3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..1ae5f1b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..d6eed846 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..36fa0df4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..7ab01116 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..637d72a0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..4a72b951 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..a21a5bfa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..be320339 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..2d193668 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..55bff5ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..d23a981e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..7cfc4a53 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..aa1c0d7a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..bd9586f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..02f1d7d3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..3a855ad8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..e29d712a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..11d8b0e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..bc2b9190 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..3f9ea489 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..2f8f8b61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..be3156f3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..5a6d20cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..d0faa673 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..87e9490b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..8d499f33 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..340ec2f0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.11.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..02117872 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..60da782a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..a6debd32 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..b3798c31 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..9f30c293 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..046368b8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..cd0f2f72 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..1623583c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..70d981d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..38e0d4e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..7bdd6104 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..69d248c2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e2f119ee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..662329d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..b63c824e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..74fc0005 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..bbc648fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..dda9e031 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.11.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..4582d1ee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..2695c5d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..a1641a25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..f3022e79 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..2490666e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..39599dd7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..3e35b8b5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..6b2c5376 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..237fc219 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..707aa347 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..3d386ba7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..00a65950 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..469c4e7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..8b3aa2e6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..2aaf4454 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..f9887c87 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..4d37d307 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..3e538d97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..d22becbc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..7c39855f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..43bc837c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..b2bdf139 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..231be206 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..02aea719 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..0d75cb11 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..a308695c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..b40732d1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..b4dc8cdb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..ca67d402 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..cdcb8a74 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..372cae9b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..633329b2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..3b283b46 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..4243d0b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..b894dfa1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.11.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..bdfe223f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.11.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.11.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..ca7eb337 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..3e4b3783 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..f3b67eb4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..ccf455e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..33963477 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..c8720afe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..d3d176c3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..413c4229 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..5ee7034b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..d650fb34 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..d60dda61 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..1272e5be --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..68ef9b6e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..93c04c5d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..6f61a708 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..b89d067f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..e86063a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..1e09d8a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..29fcfb59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..3101930d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..86235632 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..b7df784d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..8a8a0554 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..e678106d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..c01c65e1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..10c9cdab --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..365f7011 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..912c0314 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..2d4948d9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..707a3db2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..4b5d6718 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..dfa3f931 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..7945311c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..cc483a59 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..3eee6ec3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..e3d29a47 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..8224d884 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..45abf7a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..72ad6517 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..8bbb8eff --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..d4cdd5e3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..10b51144 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..2bdc1bd4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..17a3ff05 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..013bf7a5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..857e843e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..8b71297d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..4d4f5a1b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..6abb1ffa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..7eed0342 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..24e79c0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..efc90ef3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..e49d28b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..a52b0350 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..068c40ae --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..364c543d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..ddab914b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..0104cfe9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..6c9b2721 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..8ba4b781 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..56d50f09 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..862317cb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..1b46e9de --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..ad2dde93 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..fd4bb290 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..4a5a12f9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..2d5cd418 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..72e18a97 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..f6846a98 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..ff6d7c33 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..8ba42070 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.0", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..f5d78645 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.0/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.0 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..d81164c7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..16f8d434 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..b1ae31fe --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..e301b4a9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..d7e6e9fa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..2a2243bd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..770e777f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..37d812d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..60c9d726 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..f059abf6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..4d3c337e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..d6508200 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..ea1fce48 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..2cc33aac --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..78ae67d0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..ae51a947 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..8d74cf3b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..3f086c2e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..c5e81408 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..a6b3dda7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..2e0eb07f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..100c5f5a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..a7e67091 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..2b0f711f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..50aaef25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..c1bd4991 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..82cd6c76 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..1510242a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..dd0231cf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..1fa8f74d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..d6debd3b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..42132381 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..e2066186 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..f36ef43d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..5ed1c50d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..7faabc25 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..36057ba6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..50ac9c03 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..bf19adc1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..268d0a69 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..5ff1d878 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..eb9a29f1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..f84503c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..43e23b54 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..ece3bcfd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..347775be --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..f9227b36 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..172a4952 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..e3031ee8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..d4ed2e26 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..71c14f08 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..2f5f8f96 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..accf9aee --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..589f89ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..2135cae5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..768af978 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..773ce745 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..1bdec03e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..2fc46f35 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..607ca47c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..b1f81ddb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e7eb9310 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..772f0a19 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..52fca4ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..40fd8935 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..11c51a43 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..cdbec3a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..7306d724 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..723a34c5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..c28914a4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..b3fb1b0a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.1", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..7453626a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.1/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.1 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json new file mode 100644 index 00000000..eb7106e2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json new file mode 100644 index 00000000..3f5a4d3c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json new file mode 100644 index 00000000..467d03d5 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json new file mode 100644 index 00000000..834f9194 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..7f817591 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..cf881ddb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json new file mode 100644 index 00000000..8390794b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json new file mode 100644 index 00000000..e6088df3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json new file mode 100644 index 00000000..ee9f6726 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json new file mode 100644 index 00000000..8dda3a06 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json new file mode 100644 index 00000000..41d0631d --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..5c10f088 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json new file mode 100644 index 00000000..050e8b88 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json new file mode 100644 index 00000000..17d378fd --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json new file mode 100644 index 00000000..d08d6c6c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json new file mode 100644 index 00000000..f6f04913 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json new file mode 100644 index 00000000..780d81ad --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json new file mode 100644 index 00000000..accadc8c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+json/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro+json;version=1.9.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml new file mode 100644 index 00000000..996a6853 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml new file mode 100644 index 00000000..ead9ad4a --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml new file mode 100644 index 00000000..8d29f1ba --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml new file mode 100644 index 00000000..7e0ad977 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..3747400f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..821c88ed --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml new file mode 100644 index 00000000..d25eb8eb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml new file mode 100644 index 00000000..6f0796b0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml new file mode 100644 index 00000000..1cd2b113 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml new file mode 100644 index 00000000..c14246b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml new file mode 100644 index 00000000..da694e7b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..56e538d7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml new file mode 100644 index 00000000..e3b30f57 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml new file mode 100644 index 00000000..ff424075 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml new file mode 100644 index 00000000..de3c4f4e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml new file mode 100644 index 00000000..5051b798 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml new file mode 100644 index 00000000..2901b30f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml new file mode 100644 index 00000000..71a89248 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro+yaml/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro+yaml;version=1.9.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json new file mode 100644 index 00000000..c5b6168f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "ApplicationEvent", + "fields": [ + { + "name": "applicationId", + "type": "string", + "doc": "Application ID" + }, + { + "name": "status", + "type": "string", + "doc": "Application Status" + }, + { + "name": "documents", + "type": [ + "null", + { + "type": "array", + "items": "model.DocumentInfo" + } + ], + "doc": "", + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml new file mode 100644 index 00000000..c249f3e3 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/ApplicationEvent.yaml @@ -0,0 +1,20 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: ApplicationEvent + fields: + - name: applicationId + type: string + doc: Application ID + - name: status + type: string + doc: Application Status + - name: documents + type: + - 'null' + - type: array + items: model.DocumentInfo + doc: '' + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json new file mode 100644 index 00000000..b18bf5c0 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "DocumentInfo", + "fields": [ + { + "name": "documentId", + "type": "string", + "doc": "Document ID" + }, + { + "name": "filePath", + "type": "string", + "doc": "Document Path" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml new file mode 100644 index 00000000..e8c318f2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/DocumentInfo.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: DocumentInfo + fields: + - name: documentId + type: string + doc: Document ID + - name: filePath + type: string + doc: Document Path diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json new file mode 100644 index 00000000..85b6e9e7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.json @@ -0,0 +1,16 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "model", + "type": "record", + "doc": "", + "name": "MyResponse", + "fields": [ + { + "name": "isSuccessful", + "type": "boolean", + "doc": "Indicator for successful or unsuccessful call" + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml new file mode 100644 index 00000000..3639dab9 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/MyResponse.yaml @@ -0,0 +1,10 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: model + type: record + doc: '' + name: MyResponse + fields: + - name: isSuccessful + type: boolean + doc: Indicator for successful or unsuccessful call diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json new file mode 100644 index 00000000..5ce77610 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.json @@ -0,0 +1,287 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "recordAll", + "fields" : [ { + "name" : "requiredBoolean", + "type" : "boolean" + }, { + "name" : "requiredBooleanWithDefault", + "type" : "boolean", + "default" : true + }, { + "name" : "optionalBoolean", + "type" : [ "null", "boolean" ], + "default" : null + }, { + "name" : "optionalBooleanWithDefault", + "type" : [ "boolean", "null" ], + "default" : true + }, { + "name" : "requiredInt", + "type" : "int" + }, { + "name" : "optionalInt", + "type" : [ "null", "int" ], + "default" : null + }, { + "name" : "optionalIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "requiredLong", + "type" : "long" + }, { + "name" : "optionalLong", + "type" : [ "null", "long" ], + "default" : null + }, { + "name" : "optionalLongWithDefault", + "type" : [ "long", "null" ], + "default" : 1 + }, { + "name" : "requiredFloat", + "type" : "float" + }, { + "name" : "optionalFloat", + "type" : [ "null", "float" ], + "default" : null + }, { + "name" : "optionalFloatWithDefault", + "type" : [ "float", "null" ], + "default" : 1.0 + }, { + "name" : "requiredDouble", + "type" : "double" + }, { + "name" : "optionalDouble", + "type" : [ "null", "double" ], + "default" : null + }, { + "name" : "optionalDoubleWithDefault", + "type" : [ "double", "null" ], + "default" : 1.0 + }, { + "name" : "requiredBytes", + "type" : "bytes" + }, { + "name" : "optionalBytes", + "type" : [ "null", "bytes" ], + "default" : null + }, { + "name" : "optionalBytesWithDefault", + "type" : [ "bytes", "null" ], + "default" : "A" + }, { + "name" : "requiredString", + "type" : "string" + }, { + "name" : "optionalString", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "optionalStringWithDefault", + "type" : [ "string", "null" ], + "default" : "a" + }, { + "name" : "requiredRecord", + "type" : { + "type" : "record", + "name" : "nestedRequiredRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } + }, { + "name" : "optionalRecord", + "type" : [ "null", { + "type" : "record", + "name" : "nestedOptionalRecord", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + } ], + "default" : null + }, { + "name" : "optionalRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedOptionalRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "null" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "requiredEnum", + "type" : { + "type" : "enum", + "name" : "requiredEnum", + "symbols" : [ "a", "b" ] + } + }, { + "name" : "optionalEnum", + "type" : [ "null", { + "type" : "enum", + "name" : "optionalEnum", + "symbols" : [ "a", "b" ] + } ], + "default" : null + }, { + "name" : "optionalEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "optionalEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "null" ], + "default" : "b" + }, { + "name" : "requiredArray", + "type" : { + "type" : "array", + "items" : "string" + } + }, { + "name" : "optionalArray", + "type" : [ "null", { + "type" : "array", + "items" : "string" + } ], + "default" : null + }, { + "name" : "optionalArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "null" ], + "default" : [ "a" ] + }, { + "name" : "requiredMap", + "type" : { + "type" : "map", + "values" : "string" + } + }, { + "name" : "optionalMap", + "type" : [ "null", { + "type" : "map", + "values" : "string" + } ], + "default" : null + }, { + "name" : "optionalMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "null" ], + "default" : { + "a" : "b" + } + }, { + "name" : "requiredFixed", + "type" : { + "type" : "fixed", + "name" : "requiredFixed", + "size" : 1 + } + }, { + "name" : "optionalFixed", + "type" : [ "null", { + "type" : "fixed", + "name" : "optionalFixed", + "size" : 1 + } ], + "default" : null + }, { + "name" : "optionalFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "optionalFixedWithDefault", + "size" : 1 + }, "null" ], + "default" : "A" + }, { + "name" : "unionType", + "type" : [ "long", "null" ] + }, { + "name" : "unionBooleanWithDefault", + "type" : [ "boolean", "int" ], + "default" : true + }, { + "name" : "unionIntWithDefault", + "type" : [ "int", "null" ], + "default" : 1 + }, { + "name" : "unionLongWithDefault", + "type" : [ "long", "int" ], + "default" : 1 + }, { + "name" : "unionFloatWithDefault", + "type" : [ "float", "int" ], + "default" : 1.0 + }, { + "name" : "unionDoubleWithDefault", + "type" : [ "double", "int" ], + "default" : 1.0 + }, { + "name" : "unionBytesWithDefault", + "type" : [ "bytes", "int" ], + "default" : "A" + }, { + "name" : "unionStringWithDefault", + "type" : [ "string", "int" ], + "default" : "a" + }, { + "name" : "unionRecordWithDefault", + "type" : [ { + "type" : "record", + "name" : "nestedUnionRecordWithDefault", + "fields" : [ { + "name" : "nestedRequiredBoolean", + "type" : "boolean" + } ] + }, "int" ], + "default" : { + "nestedRequiredBoolean" : true + } + }, { + "name" : "unionEnumWithDefault", + "type" : [ { + "type" : "enum", + "name" : "nestedUnionEnumWithDefault", + "symbols" : [ "a", "b" ] + }, "int" ], + "default" : "b" + }, { + "name" : "unionArrayWithDefault", + "type" : [ { + "type" : "array", + "items" : "string" + }, "int" ], + "default" : [ "a" ] + }, { + "name" : "unionMapWithDefault", + "type" : [ { + "type" : "map", + "values" : "string" + }, "int" ], + "default" : { + "a" : "b" + } + }, { + "name" : "unionFixedWithDefault", + "type" : [ { + "type" : "fixed", + "name" : "nestedUnionFixedWithDefault", + "size" : 1 + }, "int" ], + "default" : "A" + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml new file mode 100644 index 00000000..4a9273f4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/SchemaBuilder.yaml @@ -0,0 +1,275 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: recordAll + fields: + - name: requiredBoolean + type: boolean + - name: requiredBooleanWithDefault + type: boolean + default: true + - name: optionalBoolean + type: + - 'null' + - boolean + default: null + - name: optionalBooleanWithDefault + type: + - boolean + - 'null' + default: true + - name: requiredInt + type: int + - name: optionalInt + type: + - 'null' + - int + default: null + - name: optionalIntWithDefault + type: + - int + - 'null' + default: 1 + - name: requiredLong + type: long + - name: optionalLong + type: + - 'null' + - long + default: null + - name: optionalLongWithDefault + type: + - long + - 'null' + default: 1 + - name: requiredFloat + type: float + - name: optionalFloat + type: + - 'null' + - float + default: null + - name: optionalFloatWithDefault + type: + - float + - 'null' + default: 1.0 + - name: requiredDouble + type: double + - name: optionalDouble + type: + - 'null' + - double + default: null + - name: optionalDoubleWithDefault + type: + - double + - 'null' + default: 1.0 + - name: requiredBytes + type: bytes + - name: optionalBytes + type: + - 'null' + - bytes + default: null + - name: optionalBytesWithDefault + type: + - bytes + - 'null' + default: A + - name: requiredString + type: string + - name: optionalString + type: + - 'null' + - string + default: null + - name: optionalStringWithDefault + type: + - string + - 'null' + default: a + - name: requiredRecord + type: + type: record + name: nestedRequiredRecord + fields: + - name: nestedRequiredBoolean + type: boolean + - name: optionalRecord + type: + - 'null' + - type: record + name: nestedOptionalRecord + fields: + - name: nestedRequiredBoolean + type: boolean + default: null + - name: optionalRecordWithDefault + type: + - type: record + name: nestedOptionalRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - 'null' + default: + nestedRequiredBoolean: true + - name: requiredEnum + type: + type: enum + name: requiredEnum + symbols: + - a + - b + - name: optionalEnum + type: + - 'null' + - type: enum + name: optionalEnum + symbols: + - a + - b + default: null + - name: optionalEnumWithDefault + type: + - type: enum + name: optionalEnumWithDefault + symbols: + - a + - b + - 'null' + default: b + - name: requiredArray + type: + type: array + items: string + - name: optionalArray + type: + - 'null' + - type: array + items: string + default: null + - name: optionalArrayWithDefault + type: + - type: array + items: string + - 'null' + default: + - a + - name: requiredMap + type: + type: map + values: string + - name: optionalMap + type: + - 'null' + - type: map + values: string + default: null + - name: optionalMapWithDefault + type: + - type: map + values: string + - 'null' + default: + a: b + - name: requiredFixed + type: + type: fixed + name: requiredFixed + size: 1 + - name: optionalFixed + type: + - 'null' + - type: fixed + name: optionalFixed + size: 1 + default: null + - name: optionalFixedWithDefault + type: + - type: fixed + name: optionalFixedWithDefault + size: 1 + - 'null' + default: A + - name: unionType + type: + - long + - 'null' + - name: unionBooleanWithDefault + type: + - boolean + - int + default: true + - name: unionIntWithDefault + type: + - int + - 'null' + default: 1 + - name: unionLongWithDefault + type: + - long + - int + default: 1 + - name: unionFloatWithDefault + type: + - float + - int + default: 1.0 + - name: unionDoubleWithDefault + type: + - double + - int + default: 1.0 + - name: unionBytesWithDefault + type: + - bytes + - int + default: A + - name: unionStringWithDefault + type: + - string + - int + default: a + - name: unionRecordWithDefault + type: + - type: record + name: nestedUnionRecordWithDefault + fields: + - name: nestedRequiredBoolean + type: boolean + - int + default: + nestedRequiredBoolean: true + - name: unionEnumWithDefault + type: + - type: enum + name: nestedUnionEnumWithDefault + symbols: + - a + - b + - int + default: b + - name: unionArrayWithDefault + type: + - type: array + items: string + - int + default: + - a + - name: unionMapWithDefault + type: + - type: map + values: string + - int + default: + a: b + - name: unionFixedWithDefault + type: + - type: fixed + name: nestedUnionFixedWithDefault + size: 1 + - int + default: A diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json new file mode 100644 index 00000000..77209ce1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.json @@ -0,0 +1,54 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + }, { + "name" : "bd", + "type" : { + "type" : "bytes", + "logicalType" : "big-decimal" + } + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml new file mode 100644 index 00000000..c4773a45 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithLogicalTypes.yaml @@ -0,0 +1,40 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: TestRecordWithLogicalTypes + doc: >- + Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see + TestSpecificLogicalTypes + namespace: org.apache.avro.specific + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: d + type: + type: int + logicalType: date + - name: t + type: + type: int + logicalType: time-millis + - name: ts + type: + type: long + logicalType: timestamp-millis + - name: bd + type: + type: bytes + logicalType: big-decimal diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json new file mode 100644 index 00000000..9f2fb2af --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "TestRecordWithMapsAndArrays", + "namespace": "org.apache.avro.specific", + "fields": [ + { + "name": "arr", + "type": { + "type": "array", + "items": "string", + "default": [] + } + }, + { + "name": "map", + "type": { + "type": "map", + "values": "long", + "default": {} + } + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml new file mode 100644 index 00000000..aca3814c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestRecordWithMapsAndArrays.yaml @@ -0,0 +1,16 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: TestRecordWithMapsAndArrays + namespace: org.apache.avro.specific + fields: + - name: arr + type: + type: array + items: string + default: [] + - name: map + type: + type: map + values: long + default: {} diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json new file mode 100644 index 00000000..ab88efd1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.json @@ -0,0 +1,26 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": [ + "null", + { + "namespace": "org.apache.avro.specific", + "type": "record", + "name": "TestUnionRecord", + "fields": [ + { + "name": "amount", + "type": [ + "null", + { + "type": "bytes", + "logicalType": "decimal", + "precision": 31, + "scale": 8 + } + ], + "default": null + } + ] + } + ] +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml new file mode 100644 index 00000000..a0ff23ec --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/TestUnionRecord.yaml @@ -0,0 +1,15 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + - 'null' + - namespace: org.apache.avro.specific + type: record + name: TestUnionRecord + fields: + - name: amount + type: + - 'null' + - type: bytes + logicalType: decimal + precision: 31 + scale: 8 + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json new file mode 100644 index 00000000..db4af2d8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.json @@ -0,0 +1,24 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "fields" : [ + { + "name" : "title", + "type" : "string" + }, + { + "name" : "created_at", + "type" : [ + "null", + { + "logicalType" : "timestamp-millis", + "type" : "long" + } + ] + } + ], + "name" : "Bar", + "namespace" : "foo", + "type" : "record" + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml new file mode 100644 index 00000000..6d02b0da --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/foo.Bar.yaml @@ -0,0 +1,13 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + fields: + - name: title + type: string + - name: created_at + type: + - 'null' + - logicalType: timestamp-millis + type: long + name: Bar + namespace: foo + type: record diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json new file mode 100644 index 00000000..d47bc55b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV1", + "doc" : "Test schema changes: this is the 'old' schema the SpecificRecord expects to see", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "h", + "type" : [ "null", "string" ] + } ] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml new file mode 100644 index 00000000..02de22b6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v1.yaml @@ -0,0 +1,28 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: FullRecordV1 + doc: >- + Test schema changes: this is the 'old' schema the SpecificRecord expects to + see + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i32 + type: int + - name: i64 + type: long + - name: f32 + type: float + - name: f64 + type: double + - name: s + type: + - 'null' + - string + default: null + - name: h + type: + - 'null' + - string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json new file mode 100644 index 00000000..b41231f7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "FullRecordV2", + "doc" : "Test schema changes: this is the 'new' schema actually used to write data", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i64", + "type" : "int" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "f64", + "type" : "long" + }, { + "name" : "f32", + "type" : [ "float", "null" ] + }, { + "name" : "newfield", + "type" : "string" + }, { + "name" : "h", + "type" : "bytes" + }, + { "name" : "myMap", "type" : { "type" : "map", "values" : "string" } }] + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml new file mode 100644 index 00000000..8d2b05d6 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/full_record_v2.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: FullRecordV2 + doc: 'Test schema changes: this is the ''new'' schema actually used to write data' + namespace: org.apache.avro.specific.test + fields: + - name: b + type: boolean + - name: i64 + type: int + - name: i32 + type: int + - name: f64 + type: long + - name: f32 + type: + - float + - 'null' + - name: newfield + type: string + - name: h + type: bytes + - name: myMap + type: + type: map + values: string diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json new file mode 100644 index 00000000..43b066bc --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "guid", + "type": { "type": "string", "logicalType": "uuid" } + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml new file mode 100644 index 00000000..f11e7f13 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical-uuid.yaml @@ -0,0 +1,21 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: guid + type: + type: string + logicalType: uuid + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json new file mode 100644 index 00000000..aa26b45f --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.json @@ -0,0 +1,33 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "namespace": "schema.common", + "type": "record", + "name": "Action", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "uuid", + "type": "string" + }, + { + "name": "time", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "requestId", + "type": [ + "null", + "string" + ], + "default": null + } + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml new file mode 100644 index 00000000..f7d355c4 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/logical_types_with_multiple_fields.yaml @@ -0,0 +1,19 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + namespace: schema.common + type: record + name: Action + fields: + - name: name + type: string + - name: uuid + type: string + - name: time + type: + type: long + logicalType: timestamp-millis + - name: requestId + type: + - 'null' + - string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json new file mode 100644 index 00000000..2009d089 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.json @@ -0,0 +1,25 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "RecordWithErrorField", + "doc" : "With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.", + "namespace" : "org.apache.avro.specific.test", + "fields" : [ { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name": "e", + "type": [ "null", { + "type" : "error", + "name" : "TestError", + "fields" : [ { + "name" : "message", + "type" : "string" + } ] + } ], + "default": null + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml new file mode 100644 index 00000000..c5e4a5b1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/regression_error_field_in_record.yaml @@ -0,0 +1,23 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: RecordWithErrorField + doc: >- + With custom coders in Avro 1.9, previously successful records with error + fields now fail to compile. + namespace: org.apache.avro.specific.test + fields: + - name: s + type: + - 'null' + - string + default: null + - name: e + type: + - 'null' + - type: error + name: TestError + fields: + - name: message + type: string + default: null diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json new file mode 100644 index 00000000..5f9720f8 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long_r2", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml new file mode 100644 index 00000000..9a86ed73 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-read.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long_r2 + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json new file mode 100644 index 00000000..499e7c48 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.json @@ -0,0 +1,31 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "table", + "fields": [{ + "name": "location", + "type": ["null", { + "type": "map", + "values": ["null", { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + }], + "key-id": 6, + "value-id": 7 + }], + "default": null, + "field-id": 5 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml new file mode 100644 index 00000000..faf855d7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location-write.yaml @@ -0,0 +1,27 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: table + fields: + - name: location + type: + - 'null' + - type: map + values: + - 'null' + - type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 + key-id: 6 + value-id: 7 + default: null + field-id: 5 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json new file mode 100644 index 00000000..a49c689e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.json @@ -0,0 +1,17 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "r7", + "fields": [{ + "name": "lat", + "type": "float", + "field-id": 1 + }, { + "name": "long", + "type": ["null", "float"], + "default": null, + "field-id": 2 + }] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml new file mode 100644 index 00000000..232ce831 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/schema-location.yaml @@ -0,0 +1,14 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: r7 + fields: + - name: lat + type: float + field-id: 1 + - name: long + type: + - 'null' + - float + default: null + field-id: 2 diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json new file mode 100644 index 00000000..0730227b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.json @@ -0,0 +1,11 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type": "record", + "name": "SimpleRecord", + "fields" : [ + {"name": "value", "type": "int"}, + {"name": "nullableValue", "type": ["null","int"], "doc" : "doc"} + ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml new file mode 100644 index 00000000..8eee36aa --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/simple_record.yaml @@ -0,0 +1,12 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: SimpleRecord + fields: + - name: value + type: int + - name: nullableValue + type: + - 'null' + - int + doc: doc diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json new file mode 100644 index 00000000..a6d84671 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.json @@ -0,0 +1,21 @@ +{ + "schemaFormat": "application/vnd.apache.avro;version=1.9.2", + "schema": { + "type" : "record", + "name" : "UnionAndFixedFields", + "doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code", + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "u", + "type" : [ "boolean", "int", "long", "float", "string" ] + }, + { + "name" : "l", + "type" : [ "string", { "type": "long", "logicalType": "timestamp-millis" } ] + }, + { + "name" : "f", + "type" : {"type": "fixed", "size": 16, "name": "md5"} + } ] + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml new file mode 100644 index 00000000..b0b94ea7 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/v3/schema/multiformat/avro/1.9.2/vnd.apache.avro/union_and_fixed_fields.yaml @@ -0,0 +1,26 @@ +schemaFormat: application/vnd.apache.avro;version=1.9.2 +schema: + type: record + name: UnionAndFixedFields + doc: >- + Schema for UnionAndFixedFields designed to trigger fixed compiler warnings + in generated code + namespace: org.apache.avro.specific + fields: + - name: u + type: + - boolean + - int + - long + - float + - string + - name: l + type: + - string + - type: long + logicalType: timestamp-millis + - name: f + type: + type: fixed + size: 16 + name: md5 From 6caac9c1c0da6c54731dba2bfc2403af7a07c426 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 19 Apr 2024 01:38:33 +0400 Subject: [PATCH 36/44] feat(avro schema): new Builder hierarchy https://github.com/asyncapi/jasyncapi/issues/185 --- .../asyncapi/v3/schema/avro/v1/_9_0/Avro.java | 95 +++++++++++++++- .../v3/schema/avro/v1/_9_0/AvroArray.java | 54 ++++++++- .../v3/schema/avro/v1/_9_0/AvroEnum.java | 103 +++++++++++++++++- .../v3/schema/avro/v1/_9_0/AvroFixed.java | 83 +++++++++++++- .../v3/schema/avro/v1/_9_0/AvroMap.java | 54 ++++++++- .../v3/schema/avro/v1/_9_0/AvroMetadata.java | 10 +- .../v3/schema/avro/v1/_9_0/AvroRecord.java | 98 ++++++++++++++++- .../schema/avro/v1/_9_0/AvroRecordField.java | 87 ++++++++++++++- .../v3/schema/avro/AvroSchemasProvider.kt | 92 ++++++++-------- 9 files changed, 604 insertions(+), 72 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java index cb0b3a2b..b5920616 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java @@ -3,10 +3,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Map; + /** * Apache Avro Schema. * @@ -15,9 +18,6 @@ * @see Avro Specification */ @Data -@Builder -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true) @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, @@ -39,10 +39,22 @@ }) public class Avro extends AvroMetadata { + public Avro() { + this.type = AvroType.NULL; + } + public Avro(@NotNull String avroType) { this.type = avroType; } + public Avro(@NotNull Builder builder) { + this.type = builder.type; + this.scale = builder.scale; + this.precision = builder.precision; + this.logicalType = builder.logicalType; + super.metadata = builder.metadata; + } + /** * Avro Schema type. */ @@ -62,6 +74,81 @@ public Avro(@NotNull String avroType) { @Nullable private String logicalType; + public static Builder builder() { + + return new Builder() { + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public Avro build() { + return new Avro(this); + } + + }; + + } + + public static abstract class Builder> { + + @NotNull + protected String type = AvroType.NULL; + + @Nullable + private Integer scale; + + @Nullable + private Integer precision; + + @Nullable + private String logicalType; + + @Nullable + protected Map metadata; + + @NotNull + public BuilderVariant type(@NotNull String type) { + this.type = type; + return getThis(); + } + + @NotNull + public BuilderVariant scale(@Nullable Integer scale) { + this.scale = scale; + return getThis(); + } + + @NotNull + public BuilderVariant precision(@Nullable Integer precision) { + this.precision = precision; + return getThis(); + } + + @NotNull + public BuilderVariant logicalType(@Nullable String logicalType) { + this.logicalType = logicalType; + return getThis(); + } + + @NotNull + public BuilderVariant metadata(@Nullable Map metadata) { + this.metadata = metadata; + return getThis(); + } + + @NotNull + protected abstract BuilderVariant getThis(); + + @NotNull + public abstract AvroSchemaVariant build(); + + } + public static class LogicalType { @JsonProperty("decimal") diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java index 1d382c2f..8c12693b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java @@ -3,13 +3,14 @@ import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; import java.util.List; +import java.util.Map; /** * @see Arrays @@ -27,14 +28,23 @@ public AvroArray(@NotNull Object items) { this.items = items; } - @Builder(builderMethodName = "arrayBuilder") public AvroArray( @NotNull Object items, - @Nullable List defaultValue + @Nullable List defaultValue, + @Nullable Map metadata ) { super(AvroType.ARRAY); this.items = items; this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroArray(@NotNull Builder builder) { + super(AvroType.ARRAY); + + this.items = builder.items; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; } @NotNull @@ -56,4 +66,42 @@ public void setType(@NotNull String type) { super.setType(AvroType.ARRAY); } + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends Avro.Builder { + + @NotNull + private Object items = Collections.emptyList(); + + @Nullable + private List defaultValue; + + @NotNull + public Builder items(@NotNull Object items) { + this.items = items; + return this; + } + + @NotNull + public Builder defaultValue(@NotNull List defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroArray build() { + return new AvroArray(this); + } + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java index fe0446b8..6f282f77 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java @@ -3,7 +3,6 @@ import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; @@ -11,6 +10,7 @@ import java.util.Collections; import java.util.List; +import java.util.Map; /** * Avro Enum Schema @@ -25,14 +25,14 @@ public AvroEnum() { super(AvroType.ENUM); } - @Builder(builderMethodName = "enumBuilder") public AvroEnum( @NotNull String name, @Nullable String namespace, @Nullable String doc, @NotNull List<@NotNull String> symbols, @Nullable List<@NotNull String> aliases, - @Nullable Object defaultValue + @Nullable Object defaultValue, + @Nullable Map metadata ) { super(AvroType.ENUM); @@ -42,6 +42,19 @@ public AvroEnum( this.symbols = symbols; this.aliases = aliases; this.defaultValue = defaultValue; + this.metadata = metadata; + } + + public AvroEnum(@NotNull Builder builder) { + super(AvroType.ENUM); + + this.name = builder.name; + this.namespace = builder.namespace; + this.doc = builder.doc; + this.symbols = builder.symbols; + this.aliases = builder.aliases; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; } @NotNull @@ -88,4 +101,88 @@ public AvroEnum( @JsonDeserialize(using = AvroTypeDeserializer.class) private Object defaultValue; + @NotNull + @Override + public String getType() { + return AvroType.ENUM; + } + + public void setType(@NotNull String type) { + super.setType(AvroType.ENUM); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends Avro.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private String doc; + + @NotNull + private List<@NotNull String> symbols = Collections.emptyList(); + + @Nullable + private List<@NotNull String> aliases; + + @Nullable + private Object defaultValue; + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder symbols(@NotNull List<@NotNull String> symbols) { + this.symbols = symbols; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroEnum build() { + return new AvroEnum(this); + } + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java index c74e4e2d..a2a940f9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java @@ -1,13 +1,13 @@ package com.asyncapi.v3.schema.avro.v1._9_0; import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; +import java.util.Map; /** * @see Arrays @@ -20,12 +20,12 @@ public AvroFixed() { super(AvroType.FIXED); } - @Builder(builderMethodName = "fixedBuilder") public AvroFixed( @NotNull String name, @Nullable String namespace, @Nullable List<@NotNull String> aliases, - @NotNull Integer size + @NotNull Integer size, + @Nullable Map metadata ) { super(AvroType.FIXED); @@ -33,6 +33,17 @@ public AvroFixed( this.namespace = namespace; this.aliases = aliases; this.size = size; + this.metadata = metadata; + } + + public AvroFixed(@NotNull Builder builder) { + super(AvroType.FIXED); + + this.name = builder.name; + this.namespace = builder.namespace; + this.aliases = builder.aliases; + this.size = builder.size; + this.metadata = builder.metadata; } @NotNull @@ -58,4 +69,70 @@ public AvroFixed( @NotNull private Integer size; + @NotNull + @Override + public String getType() { + return AvroType.FIXED; + } + + public void setType(@NotNull String type) { + super.setType(AvroType.FIXED); + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends Avro.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private List<@NotNull String> aliases; + + @NotNull + private Integer size = 0; + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder size(@NotNull Integer size) { + this.size = size; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroFixed build() { + return new AvroFixed(this); + } + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java index 9f1fb529..f02af80c 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java @@ -3,12 +3,13 @@ import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.SuperBuilder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; import java.util.Map; /** @@ -23,20 +24,31 @@ public AvroMap() { } public AvroMap(@NotNull Object values) { + super(AvroType.MAP); + this.values = values; } - @Builder(builderMethodName = "mapBuilder") public AvroMap( @NotNull Object values, @Nullable Map defaultValue, @Nullable Map metadata ) { + super(AvroType.MAP); + this.values = values; this.defaultValue = defaultValue; this.metadata = metadata; } + public AvroMap(@NotNull Builder builder) { + super(AvroType.MAP); + + this.values = builder.values; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + @NotNull @JsonProperty("values") @JsonDeserialize(using = AvroTypeDeserializer.class) @@ -56,4 +68,42 @@ public void setType(@NotNull String type) { super.setType(AvroType.MAP); } + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends Avro.Builder { + + @NotNull + private Object values = Collections.emptyMap(); + + @Nullable + private Map defaultValue; + + @NotNull + public Builder values(@NotNull Object values) { + this.values = values; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Map defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @NotNull + @Override + public AvroMap build() { + return new AvroMap(this); + } + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java index 628bd1cf..d625f600 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java @@ -3,20 +3,22 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @Data -@NoArgsConstructor -@AllArgsConstructor @JsonIgnoreProperties({"metadata"}) public class AvroMetadata { + public AvroMetadata() {} + + public AvroMetadata(@Nullable Map metadata) { + this.metadata = metadata; + } + @Nullable @JsonAnyGetter protected Map metadata; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java index 1c8d1bef..c7a4824a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java @@ -1,6 +1,7 @@ package com.asyncapi.v3.schema.avro.v1._9_0; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -22,7 +23,6 @@ public AvroRecord() { super(AvroType.RECORD); } - @Builder(builderMethodName = "recordBuilder") public AvroRecord( @Nullable String type, @NotNull String name, @@ -31,9 +31,9 @@ public AvroRecord( @Nullable List<@NotNull String> aliases, @NotNull List<@NotNull AvroRecordField> fields ) { - if (AvroType.RECORD.equals(type) || AvroType.ERROR.equals(type)) { - super.setType(type); - } else { + super(AvroType.RECORD); + + if (AvroType.ERROR.equals(type)) { super.setType(AvroType.RECORD); } @@ -44,6 +44,20 @@ public AvroRecord( this.fields = fields; } + public AvroRecord(@NotNull Builder builder) { + super(AvroType.RECORD); + + if (AvroType.ERROR.equals(builder.type)) { + super.setType(AvroType.RECORD); + } + + this.name = builder.name; + this.namespace = builder.namespace; + this.doc = builder.doc; + this.aliases = builder.aliases; + this.fields = builder.fields; + } + /** * A JSON string providing the name of the record (required). */ @@ -84,4 +98,78 @@ public void setType(@NotNull String type) { super.setType(AvroType.RECORD); } + @NotNull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends Avro.Builder { + + @NotNull + private String name = ""; + + @Nullable + private String namespace; + + @Nullable + private String doc; + + @NotNull + private List<@NotNull String> symbols = Collections.emptyList(); + + @Nullable + private List<@NotNull String> aliases; + + @NotNull + private List<@NotNull AvroRecordField> fields = Collections.emptyList(); + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder namespace(@Nullable String namespace) { + this.namespace = namespace; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder symbols(@NotNull List<@NotNull String> symbols) { + this.symbols = symbols; + return this; + } + + @NotNull + public Builder aliases(@NotNull List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder fields(@NotNull List<@NotNull AvroRecordField> fields) { + this.fields = fields; + return this; + } + + @NotNull + @Override + protected Builder getThis() { + return this; + } + + @Override + public @NotNull AvroRecord build() { + return new AvroRecord(this); + } + + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java index 5d62e8b8..b950446d 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java @@ -3,7 +3,6 @@ import com.asyncapi.v3.schema.avro.v1._9_0.jackson.AvroTypeDeserializer; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; @@ -27,7 +26,6 @@ public AvroRecordField() { this.type = AvroType.RECORD; } - @Builder public AvroRecordField( @NotNull Object type, @NotNull String name, @@ -46,6 +44,16 @@ public AvroRecordField( this.metadata = metadata; } + public AvroRecordField(@NotNull Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.order = builder.order ; + this.doc = builder.doc; + this.aliases = builder.aliases; + this.defaultValue = builder.defaultValue; + this.metadata = builder.metadata; + } + /** * Field type. */ @@ -195,4 +203,79 @@ public enum Order { } + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + @NotNull + private Object type = AvroType.RECORD; + + @NotNull + private String name = ""; + + @Nullable + private Order order = Order.ASCENDING; + + @Nullable + private String doc; + + @Nullable + private List<@NotNull String> aliases; + + @Nullable + private Object defaultValue; + + @Nullable + private Map metadata; + + @NotNull + public Builder type(@NotNull Object type) { + this.type = type; + return this; + } + + @NotNull + public Builder name(@NotNull String name) { + this.name = name; + return this; + } + + @NotNull + public Builder order(@Nullable Order order) { + this.order = order == null ? Order.ASCENDING : order; + return this; + } + + @NotNull + public Builder doc(@Nullable String doc) { + this.doc = doc; + return this; + } + + @NotNull + public Builder aliases(@Nullable List<@NotNull String> aliases) { + this.aliases = aliases; + return this; + } + + @NotNull + public Builder defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @NotNull + public Builder metadata(@Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public AvroRecordField build() { + return new AvroRecordField(this); + } + + } + } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index 563ac3be..27b495f7 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -6,7 +6,7 @@ import com.asyncapi.v3.schema.avro.v1._9_0.Avro.LogicalType class AvroSchemasProvider { fun applicationEventTest(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("ApplicationEvent") .namespace("model") .doc("") @@ -35,7 +35,7 @@ class AvroSchemasProvider { } fun documentInfo(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("DocumentInfo") .namespace("model") .doc("") @@ -55,7 +55,7 @@ class AvroSchemasProvider { } fun fooBar(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("Bar") .namespace("foo") .fields(listOf( @@ -78,7 +78,7 @@ class AvroSchemasProvider { } fun fullRecordV1(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("FullRecordV1") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'old' schema the SpecificRecord expects to see") @@ -120,7 +120,7 @@ class AvroSchemasProvider { } fun fullRecordV2(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("FullRecordV2") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'new' schema actually used to write data") @@ -164,7 +164,7 @@ class AvroSchemasProvider { } fun logicalUUID(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("Action") .namespace("schema.common") .fields(listOf( @@ -201,7 +201,7 @@ class AvroSchemasProvider { } fun logicalTypesWithMultipleFields(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("Action") .namespace("schema.common") .fields(listOf( @@ -233,7 +233,7 @@ class AvroSchemasProvider { } fun myResponse(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("MyResponse") .namespace("model") .doc("") @@ -248,7 +248,7 @@ class AvroSchemasProvider { } fun regressionErrorFieldInRecord(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("RecordWithErrorField") .namespace("org.apache.avro.specific.test") .doc("With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.") @@ -263,7 +263,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("e") .type(AvroUnion( - AvroType.NULL, AvroRecord.recordBuilder() + AvroType.NULL, AvroRecord.builder() .type(AvroType.ERROR) .name("TestError") .fields(listOf( @@ -294,23 +294,23 @@ class AvroSchemasProvider { .build() long.metadata = mapOf(Pair("field-id", 2)) - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("r7") .fields(listOf(lat, long)) .build() } fun schemaLocationRead(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("table") .fields(listOf( AvroRecordField.builder() .name("location") .type(AvroUnion( - AvroType.NULL, AvroMap.mapBuilder() + AvroType.NULL, AvroMap.builder() .values(AvroUnion( AvroType.NULL, - AvroRecord.recordBuilder() + AvroRecord.builder() .name("r7") .fields(listOf( AvroRecordField.builder() @@ -341,16 +341,16 @@ class AvroSchemasProvider { } fun schemaLocationWrite(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("table") .fields(listOf( AvroRecordField.builder() .name("location") .type(AvroUnion( - AvroType.NULL, AvroMap.mapBuilder() + AvroType.NULL, AvroMap.builder() .values(AvroUnion( AvroType.NULL, - AvroRecord.recordBuilder() + AvroRecord.builder() .name("r7") .fields(listOf( AvroRecordField.builder() @@ -381,7 +381,7 @@ class AvroSchemasProvider { } fun schemaBuilder(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("recordAll") .fields(listOf( AvroRecordField.builder() @@ -490,7 +490,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("requiredRecord") .type( - AvroRecord.recordBuilder() + AvroRecord.builder() .name("nestedRequiredRecord") .fields(listOf( AvroRecordField.builder() @@ -504,7 +504,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalRecord") .type(AvroUnion( - AvroType.NULL, AvroRecord.recordBuilder() + AvroType.NULL, AvroRecord.builder() .name("nestedOptionalRecord") .fields(listOf( AvroRecordField.builder() @@ -519,7 +519,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalRecordWithDefault") .type(AvroUnion( - AvroRecord.recordBuilder() + AvroRecord.builder() .name("nestedOptionalRecordWithDefault") .fields(listOf( AvroRecordField.builder() @@ -534,7 +534,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("requiredEnum") .type( - AvroEnum.enumBuilder() + AvroEnum.builder() .name("requiredEnum") .symbols(listOf("a", "b")) .build() @@ -543,7 +543,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalEnum") .type(AvroUnion( - AvroType.NULL, AvroEnum.enumBuilder() + AvroType.NULL, AvroEnum.builder() .name("optionalEnum") .symbols(listOf("a", "b")) .build() @@ -553,7 +553,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalEnumWithDefault") .type(AvroUnion( - AvroEnum.enumBuilder() + AvroEnum.builder() .name("optionalEnumWithDefault") .symbols(listOf("a", "b")) .build(), AvroType.NULL, @@ -563,7 +563,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("requiredArray") .type( - AvroArray.arrayBuilder() + AvroArray.builder() .items(AvroType.STRING) .build() ) @@ -571,7 +571,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalArray") .type(AvroUnion( - AvroType.NULL, AvroArray.arrayBuilder() + AvroType.NULL, AvroArray.builder() .items(AvroType.STRING) .build() )) @@ -580,7 +580,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalArrayWithDefault") .type(AvroUnion( - AvroArray.arrayBuilder() + AvroArray.builder() .items(AvroType.STRING) .build(), AvroType.NULL )) @@ -589,7 +589,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("requiredMap") .type( - AvroMap.mapBuilder() + AvroMap.builder() .values(AvroType.STRING) .build() ) @@ -597,7 +597,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalMap") .type(AvroUnion( - AvroType.NULL, AvroMap.mapBuilder() + AvroType.NULL, AvroMap.builder() .values(AvroType.STRING) .build() )) @@ -606,7 +606,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalMapWithDefault") .type(AvroUnion( - AvroMap.mapBuilder() + AvroMap.builder() .values(AvroType.STRING) .build(), AvroType.NULL )) @@ -615,7 +615,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("requiredFixed") .type( - AvroFixed.fixedBuilder() + AvroFixed.builder() .name("requiredFixed") .size(1) .build() @@ -624,7 +624,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalFixed") .type(AvroUnion( - AvroType.NULL, AvroFixed.fixedBuilder() + AvroType.NULL, AvroFixed.builder() .name("optionalFixed") .size(1) .build() @@ -634,7 +634,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("optionalFixedWithDefault") .type(AvroUnion( - AvroFixed.fixedBuilder() + AvroFixed.builder() .name("optionalFixedWithDefault") .size(1) .build(), AvroType.NULL @@ -683,7 +683,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("unionRecordWithDefault") .type(listOf( - AvroRecord.recordBuilder() + AvroRecord.builder() .name("nestedUnionRecordWithDefault") .fields(listOf( AvroRecordField.builder() @@ -698,7 +698,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("unionEnumWithDefault") .type(listOf( - AvroEnum.enumBuilder() + AvroEnum.builder() .name("nestedUnionEnumWithDefault") .symbols(listOf("a", "b")) .build(), AvroType.INT @@ -708,7 +708,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("unionArrayWithDefault") .type(listOf( - AvroArray.arrayBuilder() + AvroArray.builder() .items(AvroType.STRING) .build(), AvroType.INT )) @@ -717,7 +717,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("unionMapWithDefault") .type(listOf( - AvroMap.mapBuilder() + AvroMap.builder() .values(AvroType.STRING) .build(), AvroType.INT )) @@ -726,7 +726,7 @@ class AvroSchemasProvider { AvroRecordField.builder() .name("unionFixedWithDefault") .type(listOf( - AvroFixed.fixedBuilder() + AvroFixed.builder() .name("nestedUnionFixedWithDefault") .size(1) .build(), AvroType.INT @@ -738,7 +738,7 @@ class AvroSchemasProvider { } fun simpleRecord(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("SimpleRecord") .fields(listOf( AvroRecordField.builder() @@ -755,7 +755,7 @@ class AvroSchemasProvider { } fun testRecordWithLogicalTypes(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("TestRecordWithLogicalTypes") .doc("Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes") .namespace("org.apache.avro.specific") @@ -822,13 +822,13 @@ class AvroSchemasProvider { } fun testRecordWithMapsAndArrays(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("TestRecordWithMapsAndArrays") .namespace("org.apache.avro.specific") .fields(listOf( AvroRecordField.builder() .name("arr") - .type(AvroArray.arrayBuilder() + .type(AvroArray.builder() .items(AvroType.STRING) .defaultValue(emptyList()) .build() @@ -836,7 +836,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("map") - .type(AvroMap.mapBuilder() + .type(AvroMap.builder() .values(AvroType.LONG) .defaultValue(emptyMap()) .build() @@ -849,7 +849,7 @@ class AvroSchemasProvider { fun testUnionRecord(): AvroUnion { return AvroUnion( AvroType.NULL, - AvroRecord.recordBuilder() + AvroRecord.builder() .name("TestUnionRecord") .namespace("org.apache.avro.specific") .fields(listOf( @@ -872,7 +872,7 @@ class AvroSchemasProvider { } fun unionAndFixedFields(): AvroRecord { - return AvroRecord.recordBuilder() + return AvroRecord.builder() .name("UnionAndFixedFields") .doc("Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code") .namespace("org.apache.avro.specific") @@ -894,7 +894,7 @@ class AvroSchemasProvider { .build(), AvroRecordField.builder() .name("f") - .type(AvroFixed.fixedBuilder() + .type(AvroFixed.builder() .name("md5") .size(16) .build() From 26a8d9960e5d4fa0d2e391f0bb90e954b0f8aedd Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 19 Apr 2024 01:47:11 +0400 Subject: [PATCH 37/44] refactor(avro schema): rename Avro* to AvroSchema* https://github.com/asyncapi/jasyncapi/issues/185 --- .../v1/_9_0/{Avro.java => AvroSchema.java} | 36 +- .../{AvroArray.java => AvroSchemaArray.java} | 28 +- .../{AvroEnum.java => AvroSchemaEnum.java} | 24 +- .../{AvroFixed.java => AvroSchemaFixed.java} | 24 +- .../_9_0/{AvroMap.java => AvroSchemaMap.java} | 29 +- ...oMetadata.java => AvroSchemaMetadata.java} | 6 +- ...{AvroRecord.java => AvroSchemaRecord.java} | 40 +- ...dField.java => AvroSchemaRecordField.java} | 16 +- .../{AvroType.java => AvroSchemaType.java} | 2 +- .../{AvroUnion.java => AvroSchemaUnion.java} | 8 +- .../_9_0/jackson/AvroSchemaDeserializer.java | 14 +- .../v1/_9_0/jackson/AvroTypeDeserializer.java | 15 +- .../v3/schema/avro/AvroSchemasProvider.kt | 1024 ++++++++++------- .../com/asyncapi/v3/schema/avro/AvroTest.kt | 42 +- ...t => AvroSchemaFormatSchemaV1_10_0Test.kt} | 2 - ...t => AvroSchemaFormatSchemaV1_10_1Test.kt} | 2 - ...t => AvroSchemaFormatSchemaV1_10_2Test.kt} | 2 - ...t => AvroSchemaFormatSchemaV1_11_0Test.kt} | 2 - ...t => AvroSchemaFormatSchemaV1_11_1Test.kt} | 2 - ...kt => AvroSchemaFormatSchemaV1_9_0Test.kt} | 0 ...kt => AvroSchemaFormatSchemaV1_9_1Test.kt} | 2 - ...kt => AvroSchemaFormatSchemaV1_9_2Test.kt} | 2 - 22 files changed, 733 insertions(+), 589 deletions(-) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{Avro.java => AvroSchema.java} (75%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroArray.java => AvroSchemaArray.java} (76%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroEnum.java => AvroSchemaEnum.java} (89%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroFixed.java => AvroSchemaFixed.java} (83%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroMap.java => AvroSchemaMap.java} (77%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroMetadata.java => AvroSchemaMetadata.java} (83%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroRecord.java => AvroSchemaRecord.java} (74%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroRecordField.java => AvroSchemaRecordField.java} (94%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroType.java => AvroSchemaType.java} (98%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/{AvroUnion.java => AvroSchemaUnion.java} (87%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_10_0Test.kt => AvroSchemaFormatSchemaV1_10_0Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_10_1Test.kt => AvroSchemaFormatSchemaV1_10_1Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_10_2Test.kt => AvroSchemaFormatSchemaV1_10_2Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_11_0Test.kt => AvroSchemaFormatSchemaV1_11_0Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_11_1Test.kt => AvroSchemaFormatSchemaV1_11_1Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_9_0Test.kt => AvroSchemaFormatSchemaV1_9_0Test.kt} (100%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_9_1Test.kt => AvroSchemaFormatSchemaV1_9_1Test.kt} (99%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/{AvroFormatSchemaV1_9_2Test.kt => AvroSchemaFormatSchemaV1_9_2Test.kt} (99%) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java similarity index 75% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java index b5920616..07d0c067 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/Avro.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java @@ -23,31 +23,31 @@ use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", - defaultImpl = AvroUnion.class, + defaultImpl = AvroSchemaUnion.class, visible = true ) @JsonSubTypes({ - @JsonSubTypes.Type(value = Avro.class, names = { - AvroType.NULL, AvroType.BOOLEAN, AvroType.INT, AvroType.LONG, - AvroType.FLOAT, AvroType.DOUBLE, AvroType.BYTES, AvroType.STRING + @JsonSubTypes.Type(value = AvroSchema.class, names = { + AvroSchemaType.NULL, AvroSchemaType.BOOLEAN, AvroSchemaType.INT, AvroSchemaType.LONG, + AvroSchemaType.FLOAT, AvroSchemaType.DOUBLE, AvroSchemaType.BYTES, AvroSchemaType.STRING }), - @JsonSubTypes.Type(value = AvroRecord.class, names = {AvroType.RECORD, AvroType.ERROR}), - @JsonSubTypes.Type(value = AvroArray.class, name = AvroType.ARRAY), - @JsonSubTypes.Type(value = AvroMap.class, name = AvroType.MAP), - @JsonSubTypes.Type(value = AvroEnum.class, name = AvroType.ENUM), - @JsonSubTypes.Type(value = AvroFixed.class, name = AvroType.FIXED), + @JsonSubTypes.Type(value = AvroSchemaRecord.class, names = {AvroSchemaType.RECORD, AvroSchemaType.ERROR}), + @JsonSubTypes.Type(value = AvroSchemaArray.class, name = AvroSchemaType.ARRAY), + @JsonSubTypes.Type(value = AvroSchemaMap.class, name = AvroSchemaType.MAP), + @JsonSubTypes.Type(value = AvroSchemaEnum.class, name = AvroSchemaType.ENUM), + @JsonSubTypes.Type(value = AvroSchemaFixed.class, name = AvroSchemaType.FIXED), }) -public class Avro extends AvroMetadata { +public class AvroSchema extends AvroSchemaMetadata { - public Avro() { - this.type = AvroType.NULL; + public AvroSchema() { + this.type = AvroSchemaType.NULL; } - public Avro(@NotNull String avroType) { + public AvroSchema(@NotNull String avroType) { this.type = avroType; } - public Avro(@NotNull Builder builder) { + public AvroSchema(@NotNull Builder builder) { this.type = builder.type; this.scale = builder.scale; this.precision = builder.precision; @@ -86,18 +86,18 @@ protected Builder getThis() { @NotNull @Override - public Avro build() { - return new Avro(this); + public AvroSchema build() { + return new AvroSchema(this); } }; } - public static abstract class Builder> { + public static abstract class Builder> { @NotNull - protected String type = AvroType.NULL; + protected String type = AvroSchemaType.NULL; @Nullable private Integer scale; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java similarity index 76% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java index 8c12693b..9b2959a9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroArray.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java @@ -17,30 +17,30 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroArray extends Avro { +public class AvroSchemaArray extends AvroSchema { - public AvroArray() { - super(AvroType.ARRAY); + public AvroSchemaArray() { + super(AvroSchemaType.ARRAY); } - public AvroArray(@NotNull Object items) { - super(AvroType.ARRAY); + public AvroSchemaArray(@NotNull Object items) { + super(AvroSchemaType.ARRAY); this.items = items; } - public AvroArray( + public AvroSchemaArray( @NotNull Object items, @Nullable List defaultValue, @Nullable Map metadata ) { - super(AvroType.ARRAY); + super(AvroSchemaType.ARRAY); this.items = items; this.defaultValue = defaultValue; this.metadata = metadata; } - public AvroArray(@NotNull Builder builder) { - super(AvroType.ARRAY); + public AvroSchemaArray(@NotNull Builder builder) { + super(AvroSchemaType.ARRAY); this.items = builder.items; this.defaultValue = builder.defaultValue; @@ -59,18 +59,18 @@ public AvroArray(@NotNull Builder builder) { @NotNull @Override public String getType() { - return AvroType.ARRAY; + return AvroSchemaType.ARRAY; } public void setType(@NotNull String type) { - super.setType(AvroType.ARRAY); + super.setType(AvroSchemaType.ARRAY); } public static Builder builder() { return new Builder(); } - public static class Builder extends Avro.Builder { + public static class Builder extends AvroSchema.Builder { @NotNull private Object items = Collections.emptyList(); @@ -98,8 +98,8 @@ protected Builder getThis() { @NotNull @Override - public AvroArray build() { - return new AvroArray(this); + public AvroSchemaArray build() { + return new AvroSchemaArray(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java similarity index 89% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java index 6f282f77..2db885ac 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroEnum.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java @@ -19,13 +19,13 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroEnum extends Avro { +public class AvroSchemaEnum extends AvroSchema { - public AvroEnum() { - super(AvroType.ENUM); + public AvroSchemaEnum() { + super(AvroSchemaType.ENUM); } - public AvroEnum( + public AvroSchemaEnum( @NotNull String name, @Nullable String namespace, @Nullable String doc, @@ -34,7 +34,7 @@ public AvroEnum( @Nullable Object defaultValue, @Nullable Map metadata ) { - super(AvroType.ENUM); + super(AvroSchemaType.ENUM); this.name = name; this.namespace = namespace; @@ -45,8 +45,8 @@ public AvroEnum( this.metadata = metadata; } - public AvroEnum(@NotNull Builder builder) { - super(AvroType.ENUM); + public AvroSchemaEnum(@NotNull Builder builder) { + super(AvroSchemaType.ENUM); this.name = builder.name; this.namespace = builder.namespace; @@ -104,18 +104,18 @@ public AvroEnum(@NotNull Builder builder) { @NotNull @Override public String getType() { - return AvroType.ENUM; + return AvroSchemaType.ENUM; } public void setType(@NotNull String type) { - super.setType(AvroType.ENUM); + super.setType(AvroSchemaType.ENUM); } public static Builder builder() { return new Builder(); } - public static class Builder extends Avro.Builder { + public static class Builder extends AvroSchema.Builder { @NotNull private String name = ""; @@ -179,8 +179,8 @@ protected Builder getThis() { @NotNull @Override - public AvroEnum build() { - return new AvroEnum(this); + public AvroSchemaEnum build() { + return new AvroSchemaEnum(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java similarity index 83% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java index a2a940f9..f4090fb7 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroFixed.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java @@ -14,20 +14,20 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroFixed extends Avro { +public class AvroSchemaFixed extends AvroSchema { - public AvroFixed() { - super(AvroType.FIXED); + public AvroSchemaFixed() { + super(AvroSchemaType.FIXED); } - public AvroFixed( + public AvroSchemaFixed( @NotNull String name, @Nullable String namespace, @Nullable List<@NotNull String> aliases, @NotNull Integer size, @Nullable Map metadata ) { - super(AvroType.FIXED); + super(AvroSchemaType.FIXED); this.name = name; this.namespace = namespace; @@ -36,8 +36,8 @@ public AvroFixed( this.metadata = metadata; } - public AvroFixed(@NotNull Builder builder) { - super(AvroType.FIXED); + public AvroSchemaFixed(@NotNull Builder builder) { + super(AvroSchemaType.FIXED); this.name = builder.name; this.namespace = builder.namespace; @@ -72,18 +72,18 @@ public AvroFixed(@NotNull Builder builder) { @NotNull @Override public String getType() { - return AvroType.FIXED; + return AvroSchemaType.FIXED; } public void setType(@NotNull String type) { - super.setType(AvroType.FIXED); + super.setType(AvroSchemaType.FIXED); } public static Builder builder() { return new Builder(); } - public static class Builder extends Avro.Builder { + public static class Builder extends AvroSchema.Builder { @NotNull private String name = ""; @@ -129,8 +129,8 @@ protected Builder getThis() { @NotNull @Override - public AvroFixed build() { - return new AvroFixed(this); + public AvroSchemaFixed build() { + return new AvroSchemaFixed(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java similarity index 77% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java index f02af80c..1ab2667f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMap.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMap.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.experimental.SuperBuilder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,32 +16,32 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroMap extends Avro { +public class AvroSchemaMap extends AvroSchema { - public AvroMap() { - super(AvroType.MAP); + public AvroSchemaMap() { + super(AvroSchemaType.MAP); } - public AvroMap(@NotNull Object values) { - super(AvroType.MAP); + public AvroSchemaMap(@NotNull Object values) { + super(AvroSchemaType.MAP); this.values = values; } - public AvroMap( + public AvroSchemaMap( @NotNull Object values, @Nullable Map defaultValue, @Nullable Map metadata ) { - super(AvroType.MAP); + super(AvroSchemaType.MAP); this.values = values; this.defaultValue = defaultValue; this.metadata = metadata; } - public AvroMap(@NotNull Builder builder) { - super(AvroType.MAP); + public AvroSchemaMap(@NotNull Builder builder) { + super(AvroSchemaType.MAP); this.values = builder.values; this.defaultValue = builder.defaultValue; @@ -61,18 +60,18 @@ public AvroMap(@NotNull Builder builder) { @NotNull @Override public String getType() { - return AvroType.MAP; + return AvroSchemaType.MAP; } public void setType(@NotNull String type) { - super.setType(AvroType.MAP); + super.setType(AvroSchemaType.MAP); } public static Builder builder() { return new Builder(); } - public static class Builder extends Avro.Builder { + public static class Builder extends AvroSchema.Builder { @NotNull private Object values = Collections.emptyMap(); @@ -100,8 +99,8 @@ protected Builder getThis() { @NotNull @Override - public AvroMap build() { - return new AvroMap(this); + public AvroSchemaMap build() { + return new AvroSchemaMap(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java similarity index 83% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java index d625f600..0299cf7c 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroMetadata.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaMetadata.java @@ -11,11 +11,11 @@ @Data @JsonIgnoreProperties({"metadata"}) -public class AvroMetadata { +public class AvroSchemaMetadata { - public AvroMetadata() {} + public AvroSchemaMetadata() {} - public AvroMetadata(@Nullable Map metadata) { + public AvroSchemaMetadata(@Nullable Map metadata) { this.metadata = metadata; } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java similarity index 74% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java index c7a4824a..1dd0066a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecord.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java @@ -17,24 +17,24 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroRecord extends Avro { +public class AvroSchemaRecord extends AvroSchema { - public AvroRecord() { - super(AvroType.RECORD); + public AvroSchemaRecord() { + super(AvroSchemaType.RECORD); } - public AvroRecord( + public AvroSchemaRecord( @Nullable String type, @NotNull String name, @Nullable String namespace, @Nullable String doc, @Nullable List<@NotNull String> aliases, - @NotNull List<@NotNull AvroRecordField> fields + @NotNull List<@NotNull AvroSchemaRecordField> fields ) { - super(AvroType.RECORD); + super(AvroSchemaType.RECORD); - if (AvroType.ERROR.equals(type)) { - super.setType(AvroType.RECORD); + if (AvroSchemaType.ERROR.equals(type)) { + super.setType(AvroSchemaType.RECORD); } this.name = name; @@ -44,11 +44,11 @@ public AvroRecord( this.fields = fields; } - public AvroRecord(@NotNull Builder builder) { - super(AvroType.RECORD); + public AvroSchemaRecord(@NotNull Builder builder) { + super(AvroSchemaType.RECORD); - if (AvroType.ERROR.equals(builder.type)) { - super.setType(AvroType.RECORD); + if (AvroSchemaType.ERROR.equals(builder.type)) { + super.setType(AvroSchemaType.RECORD); } this.name = builder.name; @@ -86,16 +86,16 @@ public AvroRecord(@NotNull Builder builder) { * A JSON array, listing fields (required). */ @NotNull - private List<@NotNull AvroRecordField> fields = Collections.emptyList(); + private List<@NotNull AvroSchemaRecordField> fields = Collections.emptyList(); @NotNull @Override public String getType() { - return AvroType.RECORD; + return AvroSchemaType.RECORD; } public void setType(@NotNull String type) { - super.setType(AvroType.RECORD); + super.setType(AvroSchemaType.RECORD); } @NotNull @@ -103,7 +103,7 @@ public static Builder builder() { return new Builder(); } - public static class Builder extends Avro.Builder { + public static class Builder extends AvroSchema.Builder { @NotNull private String name = ""; @@ -121,7 +121,7 @@ public static class Builder extends Avro.Builder { private List<@NotNull String> aliases; @NotNull - private List<@NotNull AvroRecordField> fields = Collections.emptyList(); + private List<@NotNull AvroSchemaRecordField> fields = Collections.emptyList(); @NotNull public Builder name(@NotNull String name) { @@ -154,7 +154,7 @@ public Builder aliases(@NotNull List<@NotNull String> aliases) { } @NotNull - public Builder fields(@NotNull List<@NotNull AvroRecordField> fields) { + public Builder fields(@NotNull List<@NotNull AvroSchemaRecordField> fields) { this.fields = fields; return this; } @@ -166,8 +166,8 @@ protected Builder getThis() { } @Override - public @NotNull AvroRecord build() { - return new AvroRecord(this); + public @NotNull AvroSchemaRecord build() { + return new AvroSchemaRecord(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java similarity index 94% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java index b950446d..c07d97e0 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroRecordField.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecordField.java @@ -20,13 +20,13 @@ */ @Data @EqualsAndHashCode(callSuper = true) -public class AvroRecordField extends AvroMetadata { +public class AvroSchemaRecordField extends AvroSchemaMetadata { - public AvroRecordField() { - this.type = AvroType.RECORD; + public AvroSchemaRecordField() { + this.type = AvroSchemaType.RECORD; } - public AvroRecordField( + public AvroSchemaRecordField( @NotNull Object type, @NotNull String name, @Nullable Order order, @@ -44,7 +44,7 @@ public AvroRecordField( this.metadata = metadata; } - public AvroRecordField(@NotNull Builder builder) { + public AvroSchemaRecordField(@NotNull Builder builder) { this.type = builder.type; this.name = builder.name; this.order = builder.order ; @@ -210,7 +210,7 @@ public static Builder builder() { public static class Builder { @NotNull - private Object type = AvroType.RECORD; + private Object type = AvroSchemaType.RECORD; @NotNull private String name = ""; @@ -272,8 +272,8 @@ public Builder metadata(@Nullable Map metadata) { return this; } - public AvroRecordField build() { - return new AvroRecordField(this); + public AvroSchemaRecordField build() { + return new AvroSchemaRecordField(this); } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java similarity index 98% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java index 2ee2bab1..4b0f77a3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroType.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaType.java @@ -11,7 +11,7 @@ * @see Avro Schema Primitive Types * @see Avro Schema Complex Types */ -public class AvroType { +public class AvroSchemaType { /* Primitive Types. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java similarity index 87% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java index 87788bb5..f21e6ec5 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroUnion.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java @@ -34,18 +34,18 @@ * @see Record */ @JsonDeserialize(contentUsing = AvroTypeDeserializer.class) -public class AvroUnion extends LinkedList { +public class AvroSchemaUnion extends LinkedList { - public AvroUnion() { + public AvroSchemaUnion() { super(); } - public AvroUnion(@NotNull Object ...variant) { + public AvroSchemaUnion(@NotNull Object ...variant) { super(); addAll(Arrays.asList(variant)); } - public AvroUnion(@NotNull Object variantA, @NotNull Object variantB) { + public AvroSchemaUnion(@NotNull Object variantA, @NotNull Object variantB) { super(); add(0, variantA); add(1, variantB); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java index 09398fdc..e7ae59b9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java @@ -1,7 +1,7 @@ package com.asyncapi.v3.schema.avro.v1._9_0.jackson; -import com.asyncapi.v3.schema.avro.v1._9_0.Avro; -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -31,7 +31,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) case ARRAY: return readAsUnion((ArrayNode) jsonNode, objectCodec); case OBJECT: - return jsonParser.readValueAs(Avro.class); + return jsonParser.readValueAs(AvroSchema.class); case STRING: return jsonParser.readValueAs(String.class); case BOOLEAN: @@ -47,13 +47,13 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) } } - private AvroUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { - AvroUnion avroUnion = new AvroUnion(); + private AvroSchemaUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroSchemaUnion avroSchemaUnion = new AvroSchemaUnion(); for (JsonNode childNode : arrayNode) { - avroUnion.add(chooseKnownPojo(childNode, objectCodec)); + avroSchemaUnion.add(chooseKnownPojo(childNode, objectCodec)); } - return avroUnion; + return avroSchemaUnion; } } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java index d45ca745..0673d418 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroTypeDeserializer.java @@ -1,8 +1,7 @@ package com.asyncapi.v3.schema.avro.v1._9_0.jackson; -import com.asyncapi.v3.schema.avro.v1._9_0.Avro; -import com.asyncapi.v3.schema.avro.v1._9_0.AvroType; -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema; +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; @@ -36,7 +35,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) case NUMBER: return jsonParser.readValueAs(Number.class); case OBJECT: - return jsonParser.readValueAs(Avro.class); + return jsonParser.readValueAs(AvroSchema.class); case STRING: return jsonParser.readValueAs(String.class); case BINARY: @@ -50,13 +49,13 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) } } - private AvroUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { - AvroUnion avroUnion = new AvroUnion(); + private AvroSchemaUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec) throws IOException { + AvroSchemaUnion avroSchemaUnion = new AvroSchemaUnion(); for (JsonNode childNode : arrayNode) { - avroUnion.add(chooseKnownPojo(childNode, objectCodec)); + avroSchemaUnion.add(chooseKnownPojo(childNode, objectCodec)); } - return avroUnion; + return avroSchemaUnion; } } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index 27b495f7..9af11f29 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -1,32 +1,34 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.schema.avro.v1._9_0.* -import com.asyncapi.v3.schema.avro.v1._9_0.Avro.LogicalType +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema.LogicalType class AvroSchemasProvider { - fun applicationEventTest(): AvroRecord { - return AvroRecord.builder() + fun applicationEventTest(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("ApplicationEvent") .namespace("model") .doc("") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("applicationId") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .doc("Application ID") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("status") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .doc("Application Status") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("documents") - .type(AvroUnion( - AvroType.NULL, - AvroArray("model.DocumentInfo") - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaArray("model.DocumentInfo") + ) + ) .doc("") .defaultValue(null) .build() @@ -34,304 +36,330 @@ class AvroSchemasProvider { .build() } - fun documentInfo(): AvroRecord { - return AvroRecord.builder() + fun documentInfo(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("DocumentInfo") .namespace("model") .doc("") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("documentId") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .doc("Document ID") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("filePath") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .doc("Document Path") .build() )) .build() } - fun fooBar(): AvroRecord { - return AvroRecord.builder() + fun fooBar(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("Bar") .namespace("foo") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("title") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("created_at") - .type(AvroUnion( - AvroType.NULL, - Avro.builder() - .type(AvroType.LONG) - .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(LogicalType.TIMESTAMP_MILLIS) + .build() + ) + ) .build() )) .build() } - fun fullRecordV1(): AvroRecord { - return AvroRecord.builder() + fun fullRecordV1(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("FullRecordV1") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'old' schema the SpecificRecord expects to see") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("b") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("i32") - .type(AvroType.INT) + .type(AvroSchemaType.INT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("i64") - .type(AvroType.LONG) + .type(AvroSchemaType.LONG) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("f32") - .type(AvroType.FLOAT) + .type(AvroSchemaType.FLOAT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("f64") - .type(AvroType.DOUBLE) + .type(AvroSchemaType.DOUBLE) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("s") - .type(AvroUnion( - AvroType.NULL, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("h") - .type(AvroUnion( - AvroType.NULL, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) .build() )) .build() } - fun fullRecordV2(): AvroRecord { - return AvroRecord.builder() + fun fullRecordV2(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("FullRecordV2") .namespace("org.apache.avro.specific.test") .doc("Test schema changes: this is the 'new' schema actually used to write data") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("b") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("i64") - .type(AvroType.INT) + .type(AvroSchemaType.INT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("i32") - .type(AvroType.INT) + .type(AvroSchemaType.INT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("f64") - .type(AvroType.LONG) + .type(AvroSchemaType.LONG) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("f32") - .type(AvroUnion( - AvroType.FLOAT, AvroType.NULL - )) + .type( + AvroSchemaUnion( + AvroSchemaType.FLOAT, AvroSchemaType.NULL + ) + ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("newfield") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("h") - .type(AvroType.BYTES) + .type(AvroSchemaType.BYTES) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("myMap") - .type(AvroMap(AvroType.STRING)) + .type(AvroSchemaMap(AvroSchemaType.STRING)) .build() )) .build() } - fun logicalUUID(): AvroRecord { - return AvroRecord.builder() + fun logicalUUID(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("Action") .namespace("schema.common") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("name") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("guid") .type( - Avro.builder() - .type(AvroType.STRING) - .logicalType(Avro.LogicalType.UUID) + AvroSchema.builder() + .type(AvroSchemaType.STRING) + .logicalType(AvroSchema.LogicalType.UUID) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("time") .type( - Avro.builder() - .type(AvroType.LONG) - .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requestId") - .type(AvroUnion( - AvroType.NULL, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) .build() )) .build() } - fun logicalTypesWithMultipleFields(): AvroRecord { - return AvroRecord.builder() + fun logicalTypesWithMultipleFields(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("Action") .namespace("schema.common") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("name") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("uuid") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("time") .type( - Avro.builder() - .type(AvroType.LONG) - .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requestId") - .type(AvroUnion( - AvroType.NULL, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) .build() )) .build() } - fun myResponse(): AvroRecord { - return AvroRecord.builder() + fun myResponse(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("MyResponse") .namespace("model") .doc("") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("isSuccessful") .doc("Indicator for successful or unsuccessful call") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build() )) .build() } - fun regressionErrorFieldInRecord(): AvroRecord { - return AvroRecord.builder() + fun regressionErrorFieldInRecord(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("RecordWithErrorField") .namespace("org.apache.avro.specific.test") .doc("With custom coders in Avro 1.9, previously successful records with error fields now fail to compile.") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("s") - .type(AvroUnion( - AvroType.NULL, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaType.STRING + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("e") - .type(AvroUnion( - AvroType.NULL, AvroRecord.builder() - .type(AvroType.ERROR) - .name("TestError") - .fields(listOf( - AvroRecordField.builder() - .name("message") - .type(AvroType.STRING) - .build() - )) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaRecord.builder() + .type(AvroSchemaType.ERROR) + .name("TestError") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("message") + .type(AvroSchemaType.STRING) + .build() + ) + ) + .build() + ) + ) .defaultValue(null) .build() )) .build() } - fun schemaLocation(): AvroRecord { - val lat = AvroRecordField.builder() + fun schemaLocation(): AvroSchemaRecord { + val lat = AvroSchemaRecordField.builder() .name("lat") - .type(AvroType.FLOAT) + .type(AvroSchemaType.FLOAT) .build() lat.metadata = mapOf(Pair("field-id", 1)) - val long = AvroRecordField.builder() + val long = AvroSchemaRecordField.builder() .name("long") - .type(listOf(AvroType.NULL, AvroType.FLOAT)) + .type(listOf(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) .defaultValue(null) .build() long.metadata = mapOf(Pair("field-id", 2)) - return AvroRecord.builder() + return AvroSchemaRecord.builder() .name("r7") .fields(listOf(lat, long)) .build() } - fun schemaLocationRead(): AvroRecord { - return AvroRecord.builder() + fun schemaLocationRead(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("table") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("location") - .type(AvroUnion( - AvroType.NULL, AvroMap.builder() - .values(AvroUnion( - AvroType.NULL, - AvroRecord.builder() - .name("r7") - .fields(listOf( - AvroRecordField.builder() - .name("lat") - .type(AvroType.FLOAT) - .metadata(mapOf(Pair("field-id", 1))) - .build(), - AvroRecordField.builder() - .name("long_r2") - .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) - .defaultValue(null) - .metadata(mapOf(Pair("field-id", 2))) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() + .name("r7") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroSchemaRecordField.builder() + .name("long_r2") + .type(AvroSchemaUnion(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + ) + ) + .build() + ) + ) + .metadata( + mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + ) + ) .build() - )) - .metadata(mapOf( - Pair("key-id", 6), - Pair("value-id", 7) - )) - .build()) + ) ) .defaultValue(null) .metadata(mapOf(Pair("field-id", 5))) @@ -340,38 +368,46 @@ class AvroSchemasProvider { .build() } - fun schemaLocationWrite(): AvroRecord { - return AvroRecord.builder() + fun schemaLocationWrite(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("table") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("location") - .type(AvroUnion( - AvroType.NULL, AvroMap.builder() - .values(AvroUnion( - AvroType.NULL, - AvroRecord.builder() - .name("r7") - .fields(listOf( - AvroRecordField.builder() - .name("lat") - .type(AvroType.FLOAT) - .metadata(mapOf(Pair("field-id", 1))) - .build(), - AvroRecordField.builder() - .name("long") - .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) - .defaultValue(null) - .metadata(mapOf(Pair("field-id", 2))) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() + .name("r7") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("lat") + .type(AvroSchemaType.FLOAT) + .metadata(mapOf(Pair("field-id", 1))) + .build(), + AvroSchemaRecordField.builder() + .name("long") + .type(AvroSchemaUnion(AvroSchemaType.NULL, AvroSchemaType.FLOAT)) + .defaultValue(null) + .metadata(mapOf(Pair("field-id", 2))) + .build() + ) + ) + .build() + ) + ) + .metadata( + mapOf( + Pair("key-id", 6), + Pair("value-id", 7) + ) + ) .build() - )) - .metadata(mapOf( - Pair("key-id", 6), - Pair("value-id", 7) - )) - .build()) + ) ) .defaultValue(null) .metadata(mapOf(Pair("field-id", 5))) @@ -380,356 +416,451 @@ class AvroSchemasProvider { .build() } - fun schemaBuilder(): AvroRecord { - return AvroRecord.builder() + fun schemaBuilder(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("recordAll") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredBoolean") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredBooleanWithDefault") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .defaultValue(true) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalBoolean") - .type(AvroUnion(AvroType.NULL, AvroType.BOOLEAN)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.BOOLEAN + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalBooleanWithDefault") - .type(AvroUnion(AvroType.BOOLEAN, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.BOOLEAN, + AvroSchemaType.NULL + ) + ) .defaultValue(true) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredInt") - .type(AvroType.INT) + .type(AvroSchemaType.INT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalInt") - .type(AvroUnion(AvroType.NULL, AvroType.INT)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.INT + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalIntWithDefault") - .type(AvroUnion(AvroType.INT, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.INT, + AvroSchemaType.NULL + ) + ) .defaultValue(1) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredLong") - .type(AvroType.LONG) + .type(AvroSchemaType.LONG) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalLong") - .type(AvroUnion(AvroType.NULL, AvroType.LONG)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.LONG + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalLongWithDefault") - .type(AvroUnion(AvroType.LONG, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.LONG, + AvroSchemaType.NULL + ) + ) .defaultValue(1) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredFloat") - .type(AvroType.FLOAT) + .type(AvroSchemaType.FLOAT) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalFloat") - .type(AvroUnion(AvroType.NULL, AvroType.FLOAT)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.FLOAT + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalFloatWithDefault") - .type(AvroUnion(AvroType.FLOAT, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.FLOAT, + AvroSchemaType.NULL + ) + ) .defaultValue(1.0) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredDouble") - .type(AvroType.DOUBLE) + .type(AvroSchemaType.DOUBLE) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalDouble") - .type(AvroUnion(AvroType.NULL, AvroType.DOUBLE)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.DOUBLE + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalDoubleWithDefault") - .type(AvroUnion(AvroType.DOUBLE, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.DOUBLE, + AvroSchemaType.NULL + ) + ) .defaultValue(1.0) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredBytes") - .type(AvroType.BYTES) + .type(AvroSchemaType.BYTES) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalBytes") - .type(AvroUnion(AvroType.NULL, AvroType.BYTES)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.BYTES + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalBytesWithDefault") - .type(AvroUnion(AvroType.BYTES, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.BYTES, + AvroSchemaType.NULL + ) + ) .defaultValue("A") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredString") - .type(AvroType.STRING) + .type(AvroSchemaType.STRING) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalString") - .type(AvroUnion(AvroType.NULL, AvroType.STRING)) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.STRING + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalStringWithDefault") - .type(AvroUnion(AvroType.STRING, AvroType.NULL)) + .type( + AvroSchemaUnion( + AvroSchemaType.STRING, + AvroSchemaType.NULL + ) + ) .defaultValue("a") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredRecord") .type( - AvroRecord.builder() + AvroSchemaRecord.builder() .name("nestedRequiredRecord") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build()) ) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalRecord") - .type(AvroUnion( - AvroType.NULL, AvroRecord.builder() - .name("nestedOptionalRecord") - .fields(listOf( - AvroRecordField.builder() - .name("nestedRequiredBoolean") - .type(AvroType.BOOLEAN) - .build()) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaRecord.builder() + .name("nestedOptionalRecord") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + ) + ) + .build() ) - .build() - )) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalRecordWithDefault") - .type(AvroUnion( - AvroRecord.builder() - .name("nestedOptionalRecordWithDefault") - .fields(listOf( - AvroRecordField.builder() - .name("nestedRequiredBoolean") - .type(AvroType.BOOLEAN) - .build()) + .type( + AvroSchemaUnion( + AvroSchemaRecord.builder() + .name("nestedOptionalRecordWithDefault") + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("nestedRequiredBoolean") + .type(AvroSchemaType.BOOLEAN) + .build() + ) + ) + .build(), AvroSchemaType.NULL ) - .build(), AvroType.NULL - )) + ) .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredEnum") .type( - AvroEnum.builder() + AvroSchemaEnum.builder() .name("requiredEnum") .symbols(listOf("a", "b")) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalEnum") - .type(AvroUnion( - AvroType.NULL, AvroEnum.builder() - .name("optionalEnum") - .symbols(listOf("a", "b")) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaEnum.builder() + .name("optionalEnum") + .symbols(listOf("a", "b")) + .build() + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalEnumWithDefault") - .type(AvroUnion( - AvroEnum.builder() - .name("optionalEnumWithDefault") - .symbols(listOf("a", "b")) - .build(), AvroType.NULL, - )) + .type( + AvroSchemaUnion( + AvroSchemaEnum.builder() + .name("optionalEnumWithDefault") + .symbols(listOf("a", "b")) + .build(), + AvroSchemaType.NULL, + ) + ) .defaultValue("b") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredArray") .type( - AvroArray.builder() - .items(AvroType.STRING) + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalArray") - .type(AvroUnion( - AvroType.NULL, AvroArray.builder() - .items(AvroType.STRING) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build() + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalArrayWithDefault") - .type(AvroUnion( - AvroArray.builder() - .items(AvroType.STRING) - .build(), AvroType.NULL - )) + .type( + AvroSchemaUnion( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + ) + ) .defaultValue(listOf("a")) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredMap") .type( - AvroMap.builder() - .values(AvroType.STRING) + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalMap") - .type(AvroUnion( - AvroType.NULL, AvroMap.builder() - .values(AvroType.STRING) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build() + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalMapWithDefault") - .type(AvroUnion( - AvroMap.builder() - .values(AvroType.STRING) - .build(), AvroType.NULL - )) + .type( + AvroSchemaUnion( + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.NULL + ) + ) .defaultValue(mapOf(Pair("a", "b"))) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("requiredFixed") .type( - AvroFixed.builder() + AvroSchemaFixed.builder() .name("requiredFixed") .size(1) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalFixed") - .type(AvroUnion( - AvroType.NULL, AvroFixed.builder() - .name("optionalFixed") - .size(1) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, AvroSchemaFixed.builder() + .name("optionalFixed") + .size(1) + .build() + ) + ) .defaultValue(null) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("optionalFixedWithDefault") - .type(AvroUnion( - AvroFixed.builder() - .name("optionalFixedWithDefault") - .size(1) - .build(), AvroType.NULL - )) + .type( + AvroSchemaUnion( + AvroSchemaFixed.builder() + .name("optionalFixedWithDefault") + .size(1) + .build(), AvroSchemaType.NULL + ) + ) .defaultValue("A") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionType") - .type(listOf(AvroType.LONG, AvroType.NULL)) + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.NULL)) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionBooleanWithDefault") - .type(listOf(AvroType.BOOLEAN, AvroType.INT)) + .type(listOf(AvroSchemaType.BOOLEAN, AvroSchemaType.INT)) .defaultValue(true) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionIntWithDefault") - .type(listOf(AvroType.INT, AvroType.NULL)) + .type(listOf(AvroSchemaType.INT, AvroSchemaType.NULL)) .defaultValue(1) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionLongWithDefault") - .type(listOf(AvroType.LONG, AvroType.INT)) + .type(listOf(AvroSchemaType.LONG, AvroSchemaType.INT)) .defaultValue(1) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionFloatWithDefault") - .type(listOf(AvroType.FLOAT, AvroType.INT)) + .type(listOf(AvroSchemaType.FLOAT, AvroSchemaType.INT)) .defaultValue(1.0) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionDoubleWithDefault") - .type(listOf(AvroType.DOUBLE, AvroType.INT)) + .type(listOf(AvroSchemaType.DOUBLE, AvroSchemaType.INT)) .defaultValue(1.0) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionBytesWithDefault") - .type(listOf(AvroType.BYTES, AvroType.INT)) + .type(listOf(AvroSchemaType.BYTES, AvroSchemaType.INT)) .defaultValue("A") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionStringWithDefault") - .type(listOf(AvroType.STRING, AvroType.INT)) + .type(listOf(AvroSchemaType.STRING, AvroSchemaType.INT)) .defaultValue("a") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionRecordWithDefault") .type(listOf( - AvroRecord.builder() + AvroSchemaRecord.builder() .name("nestedUnionRecordWithDefault") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("nestedRequiredBoolean") - .type(AvroType.BOOLEAN) + .type(AvroSchemaType.BOOLEAN) .build() )) - .build(), AvroType.INT + .build(), AvroSchemaType.INT )) .defaultValue(mapOf(Pair("nestedRequiredBoolean", true))) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionEnumWithDefault") .type(listOf( - AvroEnum.builder() + AvroSchemaEnum.builder() .name("nestedUnionEnumWithDefault") .symbols(listOf("a", "b")) - .build(), AvroType.INT + .build(), AvroSchemaType.INT )) .defaultValue("b") .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionArrayWithDefault") .type(listOf( - AvroArray.builder() - .items(AvroType.STRING) - .build(), AvroType.INT + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT )) .defaultValue(listOf("a")) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionMapWithDefault") .type(listOf( - AvroMap.builder() - .values(AvroType.STRING) - .build(), AvroType.INT + AvroSchemaMap.builder() + .values(AvroSchemaType.STRING) + .build(), AvroSchemaType.INT )) .defaultValue(mapOf(Pair("a", "b"))) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("unionFixedWithDefault") .type(listOf( - AvroFixed.builder() + AvroSchemaFixed.builder() .name("nestedUnionFixedWithDefault") .size(1) - .build(), AvroType.INT + .build(), AvroSchemaType.INT )) .defaultValue("A") .build(), @@ -737,16 +868,21 @@ class AvroSchemasProvider { .build() } - fun simpleRecord(): AvroRecord { - return AvroRecord.builder() + fun simpleRecord(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("SimpleRecord") .fields(listOf( - AvroRecordField.builder() - .type(AvroType.INT) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.INT) .name("value") .build(), - AvroRecordField.builder() - .type(AvroUnion(AvroType.NULL, AvroType.INT)) + AvroSchemaRecordField.builder() + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.INT + ) + ) .name("nullableValue") .doc("doc") .build() @@ -754,65 +890,74 @@ class AvroSchemasProvider { .build() } - fun testRecordWithLogicalTypes(): AvroRecord { - return AvroRecord.builder() + fun testRecordWithLogicalTypes(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("TestRecordWithLogicalTypes") .doc("Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes") .namespace("org.apache.avro.specific") .fields(listOf( - AvroRecordField.builder() - .type(AvroType.BOOLEAN) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.BOOLEAN) .name("b") .build(), - AvroRecordField.builder() - .type(AvroType.INT) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.INT) .name("i32") .build(), - AvroRecordField.builder() - .type(AvroType.LONG) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.LONG) .name("i64") .build(), - AvroRecordField.builder() - .type(AvroType.FLOAT) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.FLOAT) .name("f32") .build(), - AvroRecordField.builder() - .type(AvroType.DOUBLE) + AvroSchemaRecordField.builder() + .type(AvroSchemaType.DOUBLE) .name("f64") .build(), - AvroRecordField.builder() - .type(AvroUnion(AvroType.NULL, AvroType.STRING)) + AvroSchemaRecordField.builder() + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaType.STRING + ) + ) .name("s") .defaultValue(null) .build(), - AvroRecordField.builder() - .type(Avro.builder() - .type(AvroType.INT) - .logicalType(Avro.LogicalType.DATE) + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.INT) + .logicalType(AvroSchema.LogicalType.DATE) .build() ) .name("d") .build(), - AvroRecordField.builder() - .type(Avro.builder() - .type(AvroType.INT) - .logicalType(Avro.LogicalType.TIME_MILLIS) + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.INT) + .logicalType(AvroSchema.LogicalType.TIME_MILLIS) .build() ) .name("t") .build(), - AvroRecordField.builder() - .type(Avro.builder() - .type(AvroType.LONG) - .logicalType(Avro.LogicalType.TIMESTAMP_MILLIS) + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) .build() ) .name("ts") .build(), - AvroRecordField.builder() - .type(Avro.builder() - .type(AvroType.BYTES) - .logicalType(Avro.LogicalType.BIG_DECIMAL) + AvroSchemaRecordField.builder() + .type( + AvroSchema.builder() + .type(AvroSchemaType.BYTES) + .logicalType(AvroSchema.LogicalType.BIG_DECIMAL) .build() ) .name("bd") @@ -821,23 +966,25 @@ class AvroSchemasProvider { .build() } - fun testRecordWithMapsAndArrays(): AvroRecord { - return AvroRecord.builder() + fun testRecordWithMapsAndArrays(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("TestRecordWithMapsAndArrays") .namespace("org.apache.avro.specific") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("arr") - .type(AvroArray.builder() - .items(AvroType.STRING) + .type( + AvroSchemaArray.builder() + .items(AvroSchemaType.STRING) .defaultValue(emptyList()) .build() ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("map") - .type(AvroMap.builder() - .values(AvroType.LONG) + .type( + AvroSchemaMap.builder() + .values(AvroSchemaType.LONG) .defaultValue(emptyMap()) .build() ) @@ -846,55 +993,68 @@ class AvroSchemasProvider { .build() } - fun testUnionRecord(): AvroUnion { - return AvroUnion( - AvroType.NULL, - AvroRecord.builder() + fun testUnionRecord(): AvroSchemaUnion { + return AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchemaRecord.builder() .name("TestUnionRecord") .namespace("org.apache.avro.specific") - .fields(listOf( - AvroRecordField.builder() - .name("amount") - .type(AvroUnion( - AvroType.NULL, - Avro.builder() - .type(AvroType.BYTES) - .logicalType(Avro.LogicalType.DECIMAL) - .precision(31) - .scale(8) - .build() - )) - .defaultValue(null) - .build() - )) + .fields( + listOf( + AvroSchemaRecordField.builder() + .name("amount") + .type( + AvroSchemaUnion( + AvroSchemaType.NULL, + AvroSchema.builder() + .type(AvroSchemaType.BYTES) + .logicalType(LogicalType.DECIMAL) + .precision(31) + .scale(8) + .build() + ) + ) + .defaultValue(null) + .build() + ) + ) .build() ) } - fun unionAndFixedFields(): AvroRecord { - return AvroRecord.builder() + fun unionAndFixedFields(): AvroSchemaRecord { + return AvroSchemaRecord.builder() .name("UnionAndFixedFields") .doc("Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code") .namespace("org.apache.avro.specific") .fields(listOf( - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("u") - .type(AvroUnion( - AvroType.BOOLEAN, AvroType.INT, AvroType.LONG, AvroType.FLOAT, AvroType.STRING - )) + .type( + AvroSchemaUnion( + AvroSchemaType.BOOLEAN, + AvroSchemaType.INT, + AvroSchemaType.LONG, + AvroSchemaType.FLOAT, + AvroSchemaType.STRING + ) + ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("l") - .type(AvroUnion( - AvroType.STRING, Avro.builder() - .type(AvroType.LONG) - .logicalType(LogicalType.TIMESTAMP_MILLIS) - .build() - )) + .type( + AvroSchemaUnion( + AvroSchemaType.STRING, AvroSchema.builder() + .type(AvroSchemaType.LONG) + .logicalType(LogicalType.TIMESTAMP_MILLIS) + .build() + ) + ) .build(), - AvroRecordField.builder() + AvroSchemaRecordField.builder() .name("f") - .type(AvroFixed.builder() + .type( + AvroSchemaFixed.builder() .name("md5") .size(16) .build() diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt index b8e14903..ec2b0d6a 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroTest.kt @@ -1,8 +1,8 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.ClasspathUtils -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory @@ -14,7 +14,7 @@ import org.junit.jupiter.params.provider.ArgumentsProvider import org.junit.jupiter.params.provider.ArgumentsSource import java.util.stream.Stream -class AvroSchemaTest { +class AvroSchemaSchemaTest { fun compareSchemas( schemaToCheckPath: String, @@ -41,24 +41,24 @@ class AvroSchemaTest { override fun provideArguments(context: ExtensionContext?): Stream { return Stream.of( - Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", Avro::class.java, AvroSchemasProvider().applicationEventTest()), - Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", Avro::class.java, AvroSchemasProvider().documentInfo()), - Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", Avro::class.java, AvroSchemasProvider().fooBar()), - Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", Avro::class.java, AvroSchemasProvider().fullRecordV1()), - Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", Avro::class.java, AvroSchemasProvider().fullRecordV2()), - Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", Avro::class.java, AvroSchemasProvider().logicalUUID()), - Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", Avro::class.java, AvroSchemasProvider().logicalTypesWithMultipleFields()), - Arguments.of("/json/v3/schema/avro/MyResponse.avsc", Avro::class.java, AvroSchemasProvider().myResponse()), - Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", Avro::class.java, AvroSchemasProvider().regressionErrorFieldInRecord()), - Arguments.of("/json/v3/schema/avro/schema-location.json", Avro::class.java, AvroSchemasProvider().schemaLocation()), - Arguments.of("/json/v3/schema/avro/schema-location-read.json", Avro::class.java, AvroSchemasProvider().schemaLocationRead()), - Arguments.of("/json/v3/schema/avro/schema-location-write.json", Avro::class.java, AvroSchemasProvider().schemaLocationWrite()), - Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", Avro::class.java, AvroSchemasProvider().schemaBuilder()), - Arguments.of("/json/v3/schema/avro/simple_record.avsc", Avro::class.java, AvroSchemasProvider().simpleRecord()), - Arguments.of("/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithLogicalTypes()), - Arguments.of("/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc", Avro::class.java, AvroSchemasProvider().testRecordWithMapsAndArrays()), - Arguments.of("/json/v3/schema/avro/TestUnionRecord.avsc", AvroUnion::class.java, AvroSchemasProvider().testUnionRecord()), - Arguments.of("/json/v3/schema/avro/union_and_fixed_fields.avsc", Avro::class.java, AvroSchemasProvider().unionAndFixedFields()), + Arguments.of("/json/v3/schema/avro/ApplicationEvent.avsc", AvroSchema::class.java, AvroSchemasProvider().applicationEventTest()), + Arguments.of("/json/v3/schema/avro/DocumentInfo.avsc", AvroSchema::class.java, AvroSchemasProvider().documentInfo()), + Arguments.of("/json/v3/schema/avro/foo.Bar.avsc", AvroSchema::class.java, AvroSchemasProvider().fooBar()), + Arguments.of("/json/v3/schema/avro/full_record_v1.avsc", AvroSchema::class.java, AvroSchemasProvider().fullRecordV1()), + Arguments.of("/json/v3/schema/avro/full_record_v2.avsc", AvroSchema::class.java, AvroSchemasProvider().fullRecordV2()), + Arguments.of("/json/v3/schema/avro/logical-uuid.avsc", AvroSchema::class.java, AvroSchemasProvider().logicalUUID()), + Arguments.of("/json/v3/schema/avro/logical_types_with_multiple_fields.avsc", AvroSchema::class.java, AvroSchemasProvider().logicalTypesWithMultipleFields()), + Arguments.of("/json/v3/schema/avro/MyResponse.avsc", AvroSchema::class.java, AvroSchemasProvider().myResponse()), + Arguments.of("/json/v3/schema/avro/regression_error_field_in_record.avsc", AvroSchema::class.java, AvroSchemasProvider().regressionErrorFieldInRecord()), + Arguments.of("/json/v3/schema/avro/schema-location.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocation()), + Arguments.of("/json/v3/schema/avro/schema-location-read.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocationRead()), + Arguments.of("/json/v3/schema/avro/schema-location-write.json", AvroSchema::class.java, AvroSchemasProvider().schemaLocationWrite()), + Arguments.of("/json/v3/schema/avro/SchemaBuilder.avsc", AvroSchema::class.java, AvroSchemasProvider().schemaBuilder()), + Arguments.of("/json/v3/schema/avro/simple_record.avsc", AvroSchema::class.java, AvroSchemasProvider().simpleRecord()), + Arguments.of("/json/v3/schema/avro/TestRecordWithLogicalTypes.avsc", AvroSchema::class.java, AvroSchemasProvider().testRecordWithLogicalTypes()), + Arguments.of("/json/v3/schema/avro/TestRecordWithMapsAndArrays.avsc", AvroSchema::class.java, AvroSchemasProvider().testRecordWithMapsAndArrays()), + Arguments.of("/json/v3/schema/avro/TestUnionRecord.avsc", AvroSchemaUnion::class.java, AvroSchemasProvider().testUnionRecord()), + Arguments.of("/json/v3/schema/avro/union_and_fixed_fields.avsc", AvroSchema::class.java, AvroSchemasProvider().unionAndFixedFields()), ) } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt index fe65350c..8b28c946 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_0Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_0Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt index b618c349..b9291bab 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_1Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_1Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt index 253b09ad..d6ddda20 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_10_2Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_10_2Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt index ab4afe62..13ee0c27 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_0Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_0Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt index 08c002ac..d972a95f 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_11_1Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_11_1Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_0Test.kt similarity index 100% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_0Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_0Test.kt diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt index 320ba19b..5cbe22bc 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_1Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_1Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt similarity index 99% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt index ee9ee832..9d8e448b 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroFormatSchemaV1_9_2Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/avro/AvroSchemaFormatSchemaV1_9_2Test.kt @@ -1,8 +1,6 @@ package com.asyncapi.v3.schema.multiformat.avro import com.asyncapi.v3.schema.avro.AvroSchemasProvider -import com.asyncapi.v3.schema.avro.v1._9_0.Avro -import com.asyncapi.v3.schema.avro.v1._9_0.AvroUnion import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest From 474edd0dde930150f28361a94f5480b6f7aa1d84 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 19 Apr 2024 01:53:25 +0400 Subject: [PATCH 38/44] refactor(avro schema): extract AvroSchemaLogicalType https://github.com/asyncapi/jasyncapi/issues/185 --- .../v3/schema/avro/v1/_9_0/AvroSchema.java | 32 ----------------- .../avro/v1/_9_0/AvroSchemaLogicalType.java | 34 +++++++++++++++++++ .../v3/schema/avro/AvroSchemasProvider.kt | 23 +++++++------ 3 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java index 07d0c067..9f11ed4a 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java @@ -1,6 +1,5 @@ package com.asyncapi.v3.schema.avro.v1._9_0; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import lombok.Data; @@ -149,35 +148,4 @@ public BuilderVariant metadata(@Nullable Map metadata) { } - public static class LogicalType { - - @JsonProperty("decimal") - public static final String DECIMAL = "decimal"; - - @JsonProperty("big-decimal") - public static final String BIG_DECIMAL = "big-decimal"; - - @JsonProperty("uuid") - public static final String UUID = "uuid"; - - @JsonProperty("date") - public static final String DATE = "date"; - - @JsonProperty("time-millis") - public static final String TIME_MILLIS = "time-millis"; - - @JsonProperty("time-micros") - public static final String TIME_MICROS = "time-micros"; - - @JsonProperty("timestamp-millis") - public static final String TIMESTAMP_MILLIS = "timestamp-millis"; - - @JsonProperty("timestamp-micros") - public static final String TIMESTAMP_MICROS = "timestamp-micros"; - - @JsonProperty("duration") - public static final String DURATION = "duration"; - - } - } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java new file mode 100644 index 00000000..98f4dd8f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaLogicalType.java @@ -0,0 +1,34 @@ +package com.asyncapi.v3.schema.avro.v1._9_0; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AvroSchemaLogicalType { + + @JsonProperty("decimal") + public static final String DECIMAL = "decimal"; + + @JsonProperty("big-decimal") + public static final String BIG_DECIMAL = "big-decimal"; + + @JsonProperty("uuid") + public static final String UUID = "uuid"; + + @JsonProperty("date") + public static final String DATE = "date"; + + @JsonProperty("time-millis") + public static final String TIME_MILLIS = "time-millis"; + + @JsonProperty("time-micros") + public static final String TIME_MICROS = "time-micros"; + + @JsonProperty("timestamp-millis") + public static final String TIMESTAMP_MILLIS = "timestamp-millis"; + + @JsonProperty("timestamp-micros") + public static final String TIMESTAMP_MICROS = "timestamp-micros"; + + @JsonProperty("duration") + public static final String DURATION = "duration"; + +} diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt index 9af11f29..6e708296 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/avro/AvroSchemasProvider.kt @@ -1,7 +1,8 @@ package com.asyncapi.v3.schema.avro import com.asyncapi.v3.schema.avro.v1._9_0.* -import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema.LogicalType +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaLogicalType +import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaType class AvroSchemasProvider { @@ -72,7 +73,7 @@ class AvroSchemasProvider { AvroSchemaType.NULL, AvroSchema.builder() .type(AvroSchemaType.LONG) - .logicalType(LogicalType.TIMESTAMP_MILLIS) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) .build() ) ) @@ -187,7 +188,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.STRING) - .logicalType(AvroSchema.LogicalType.UUID) + .logicalType(AvroSchemaLogicalType.UUID) .build() ) .build(), @@ -196,7 +197,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) .build() ) .build(), @@ -230,7 +231,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) .build() ) .build(), @@ -930,7 +931,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.INT) - .logicalType(AvroSchema.LogicalType.DATE) + .logicalType(AvroSchemaLogicalType.DATE) .build() ) .name("d") @@ -939,7 +940,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.INT) - .logicalType(AvroSchema.LogicalType.TIME_MILLIS) + .logicalType(AvroSchemaLogicalType.TIME_MILLIS) .build() ) .name("t") @@ -948,7 +949,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.LONG) - .logicalType(AvroSchema.LogicalType.TIMESTAMP_MILLIS) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) .build() ) .name("ts") @@ -957,7 +958,7 @@ class AvroSchemasProvider { .type( AvroSchema.builder() .type(AvroSchemaType.BYTES) - .logicalType(AvroSchema.LogicalType.BIG_DECIMAL) + .logicalType(AvroSchemaLogicalType.BIG_DECIMAL) .build() ) .name("bd") @@ -1008,7 +1009,7 @@ class AvroSchemasProvider { AvroSchemaType.NULL, AvroSchema.builder() .type(AvroSchemaType.BYTES) - .logicalType(LogicalType.DECIMAL) + .logicalType(AvroSchemaLogicalType.DECIMAL) .precision(31) .scale(8) .build() @@ -1046,7 +1047,7 @@ class AvroSchemasProvider { AvroSchemaUnion( AvroSchemaType.STRING, AvroSchema.builder() .type(AvroSchemaType.LONG) - .logicalType(LogicalType.TIMESTAMP_MILLIS) + .logicalType(AvroSchemaLogicalType.TIMESTAMP_MILLIS) .build() ) ) From f7cd205b64b5c6bf89e5b526bdba2c10526cbb93 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 20 Apr 2024 14:09:08 +0400 Subject: [PATCH 39/44] refactor(avro schema): SchemaFormat can hold Avro, AvroUnion, Reference https://github.com/asyncapi/jasyncapi/issues/185 --- .../_9_0/jackson/AvroSchemaDeserializer.java | 14 +++++++++++++- .../schema/multiformat/AvroFormatSchema.java | 18 ++++++++++++++++++ .../v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt | 12 +++++------- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java index e7ae59b9..40e94f64 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/jackson/AvroSchemaDeserializer.java @@ -1,5 +1,6 @@ package com.asyncapi.v3.schema.avro.v1._9_0.jackson; +import com.asyncapi.v3.Reference; import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema; import com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion; import com.fasterxml.jackson.core.JsonParser; @@ -10,6 +11,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; @@ -31,7 +33,7 @@ private Object chooseKnownPojo(JsonNode jsonNode, final ObjectCodec objectCodec) case ARRAY: return readAsUnion((ArrayNode) jsonNode, objectCodec); case OBJECT: - return jsonParser.readValueAs(AvroSchema.class); + return readAvroSchema((ObjectNode) jsonNode, objectCodec); case STRING: return jsonParser.readValueAs(String.class); case BOOLEAN: @@ -56,4 +58,14 @@ private AvroSchemaUnion readAsUnion(ArrayNode arrayNode, ObjectCodec objectCodec return avroSchemaUnion; } + private Object readAvroSchema(ObjectNode objectNode, ObjectCodec objectCodec) throws IOException { + try (JsonParser jsonParser = objectNode.traverse(objectCodec)) { + if (objectNode.size() == 1 && objectNode.has("$ref")) { + return jsonParser.readValueAs(Reference.class); + } + + return jsonParser.readValueAs(AvroSchema.class); + } + } + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java index a6816e56..8ef1618c 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/AvroFormatSchema.java @@ -33,11 +33,29 @@ public AvroFormatSchema( super(schemaFormat(schemaFormat), schema); } + /** + * Schema MUST be one of: + *
    + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema}
  • + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion}
  • + *
  • {@link com.asyncapi.v3.Reference}
  • + *
+ * + * @param schema Avro Schema or Reference + */ @Override public void setSchema(@NotNull Object schema) { super.setSchema(schema); } + /** + * Schema: + *
    + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchema}
  • + *
  • {@link com.asyncapi.v3.schema.avro.v1._9_0.AvroSchemaUnion}
  • + *
  • {@link com.asyncapi.v3.Reference}
  • + *
+ */ @NotNull public Object getSchema() { return super.getSchema(); 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 cf06e2f7..c1e3b6a0 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/AdeoKafkaRequestReplyAsyncAPI.kt @@ -19,12 +19,10 @@ import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicCleanupPolicy import com.asyncapi.v3.binding.channel.kafka.KafkaChannelTopicConfiguration import com.asyncapi.v3.binding.operation.kafka.KafkaOperationBinding import com.asyncapi.v3.binding.server.kafka.KafkaServerBinding -import com.asyncapi.v3.schema.multiformat.MultiFormatSchema import com.asyncapi.v3.schema.AsyncAPISchema +import com.asyncapi.v3.schema.multiformat.AvroFormatSchema import com.asyncapi.v3.security_scheme.SecurityScheme -import org.junit.jupiter.api.Disabled -@Disabled("Implement Avro Schema") class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { override fun specificationLocation(): String = "/examples/v3.0.0/adeo-kafka-request-reply-asyncapi.yml" @@ -253,9 +251,9 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { )) .build() ) - .payload(MultiFormatSchema( + .payload(AvroFormatSchema( "application/vnd.apache.avro;version=1.9.0", - mapOf(Pair("\$ref", "https://www.asyncapi.com/resources/casestudies/adeo/CostingRequestPayload.avsc")) + Reference("https://www.asyncapi.com/resources/casestudies/adeo/CostingRequestPayload.avsc") )) .build() ), @@ -289,9 +287,9 @@ class AdeoKafkaRequestReplyAsyncAPI: AbstractExampleValidationTest() { )) .build() ) - .payload(MultiFormatSchema( + .payload(AvroFormatSchema( "application/vnd.apache.avro;version=1.9.0", - mapOf(Pair("\$ref", "https://www.asyncapi.com/resources/casestudies/adeo/CostingResponsePayload.avsc")) + Reference("https://www.asyncapi.com/resources/casestudies/adeo/CostingResponsePayload.avsc") )) .build() ) From 2fbcbf9d88c8efe6c94c940623ac3a17d578e49e Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 20 Apr 2024 14:20:30 +0400 Subject: [PATCH 40/44] refactor(avro schema): check schemas before merge https://github.com/asyncapi/jasyncapi/issues/185 --- .../v3/schema/avro/v1/_9_0/AvroSchema.java | 33 ++++++++++++++++++- .../schema/avro/v1/_9_0/AvroSchemaArray.java | 3 ++ .../schema/avro/v1/_9_0/AvroSchemaEnum.java | 2 ++ .../schema/avro/v1/_9_0/AvroSchemaFixed.java | 2 ++ .../schema/avro/v1/_9_0/AvroSchemaRecord.java | 15 ++++----- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java index 9f11ed4a..df2d7734 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchema.java @@ -1,5 +1,6 @@ package com.asyncapi.v3.schema.avro.v1._9_0; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import lombok.Data; @@ -58,19 +59,49 @@ public AvroSchema(@NotNull Builder builder) { * Avro Schema type. */ @NotNull + @JsonProperty("type") private String type; + /** + * A JSON integer representing the scale (optional). + *

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

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

+ *

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

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

+ * If a logical type is invalid, for example a decimal with scale greater than its precision, then implementations + * should ignore the logical type and use the underlying Avro type. + * + * @see Logical Types + */ @Nullable + @JsonProperty("logicalType") private String logicalType; public static Builder builder() { diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java index 9b2959a9..a51a1c4e 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaArray.java @@ -47,6 +47,9 @@ public AvroSchemaArray(@NotNull Builder builder) { this.metadata = builder.metadata; } + /** + * The schema of the array's items. + */ @NotNull @JsonProperty("items") @JsonDeserialize(using = AvroTypeDeserializer.class) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java index 2db885ac..965239d8 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaEnum.java @@ -69,6 +69,7 @@ public AvroSchemaEnum(@NotNull Builder builder) { * A JSON string providing documentation to the user of this schema (optional). */ @Nullable + @JsonProperty("doc") private String doc; /** @@ -79,6 +80,7 @@ public AvroSchemaEnum(@NotNull Builder builder) { * Every symbol must match the regular expression [A-Za-z_][A-Za-z0-9_]* (the same requirement as for names). */ @NotNull + @JsonProperty("symbols") private List<@NotNull String> symbols = Collections.emptyList(); /** diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java index f4090fb7..18e8abc9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaFixed.java @@ -61,12 +61,14 @@ public AvroSchemaFixed(@NotNull Builder builder) { * A JSON array of strings, providing alternate names for this record (optional). */ @Nullable + @JsonProperty("aliases") private List<@NotNull String> aliases; /** * An integer, specifying the number of bytes per value (required). */ @NotNull + @JsonProperty("size") private Integer size; @NotNull diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java index 1dd0066a..684742e6 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaRecord.java @@ -1,5 +1,6 @@ package com.asyncapi.v3.schema.avro.v1._9_0; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; @@ -62,30 +63,35 @@ public AvroSchemaRecord(@NotNull Builder builder) { * A JSON string providing the name of the record (required). */ @NotNull + @JsonProperty("name") private String name = ""; /** * A JSON string that qualifies the name. */ @Nullable + @JsonProperty("namespace") private String namespace; /** * A JSON string providing documentation to the user of this schema (optional). */ @Nullable + @JsonProperty("doc") private String doc; /** * A JSON array of strings, providing alternate names for this record (optional). */ @Nullable + @JsonProperty("aliases") private List<@NotNull String> aliases; /** * A JSON array, listing fields (required). */ @NotNull + @JsonProperty("fields") private List<@NotNull AvroSchemaRecordField> fields = Collections.emptyList(); @NotNull @@ -114,9 +120,6 @@ public static class Builder extends AvroSchema.Builder { @Nullable private String doc; - @NotNull - private List<@NotNull String> symbols = Collections.emptyList(); - @Nullable private List<@NotNull String> aliases; @@ -141,12 +144,6 @@ public Builder doc(@Nullable String doc) { return this; } - @NotNull - public Builder symbols(@NotNull List<@NotNull String> symbols) { - this.symbols = symbols; - return this; - } - @NotNull public Builder aliases(@NotNull List<@NotNull String> aliases) { this.aliases = aliases; From 5138ac32c73129e1502806a451a86c921bf52240 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 20 Apr 2024 15:00:50 +0400 Subject: [PATCH 41/44] refactor(openapi): move OpenAPI Schema from openapi to openapi.v3._0_0 https://github.com/asyncapi/jasyncapi/issues/185 --- .../OpenAPISchemaAdditionalPropertiesDeserializer.java | 2 +- .../openapi/OpenAPISchemaAnyValueDeserializer.java | 2 +- .../v3/schema/multiformat/OpenAPIFormatSchema.java | 2 +- .../v3/schema/openapi/{ => v3/_0_0}/OpenAPISchema.java | 10 +++++----- .../{ => v3/_0_0}/properties/Discriminator.java | 2 +- .../openapi/{ => v3/_0_0}/properties/Extensions.java | 2 +- .../_0_0}/properties/ExternalDocumentation.java | 2 +- .../schema/openapi/{ => v3/_0_0}/properties/XML.java | 2 +- .../kotlin/com/asyncapi/v3/schema/SchemaProvider.kt | 2 +- .../openapi/OpenAPIFormatSchemaV3_0_0Test.kt | 2 +- .../openapi/OpenAPIFormatSchemaV3_0_1Test.kt | 4 +--- .../openapi/OpenAPIFormatSchemaV3_0_2Test.kt | 4 +--- .../openapi/OpenAPIFormatSchemaV3_0_3Test.kt | 4 +--- .../schema/openapi/{ => v3/_0_0}/OpenAPISchemaTest.kt | 4 ++-- .../v3/schema/openapi/{ => v3/_0_0}/SchemaTest.kt | 8 ++++---- .../_0_0}/properties/ExampleEnumDefaultArrayTest.kt | 4 ++-- .../_0_0}/properties/ExampleEnumDefaultNullTest.kt | 4 ++-- 17 files changed, 27 insertions(+), 33 deletions(-) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/OpenAPISchema.java (98%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/Discriminator.java (97%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/Extensions.java (95%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/ExternalDocumentation.java (96%) rename asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/XML.java (98%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/OpenAPISchemaTest.kt (98%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/SchemaTest.kt (96%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/ExampleEnumDefaultArrayTest.kt (89%) rename asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/{ => v3/_0_0}/properties/ExampleEnumDefaultNullTest.kt (74%) diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java index e9470ce5..faa5c83b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAdditionalPropertiesDeserializer.java @@ -1,6 +1,6 @@ package com.asyncapi.v3.jackson.schema.openapi; -import com.asyncapi.v3.schema.openapi.OpenAPISchema; +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java index b881e1ba..1dd7a133 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/jackson/schema/openapi/OpenAPISchemaAnyValueDeserializer.java @@ -1,7 +1,7 @@ package com.asyncapi.v3.jackson.schema.openapi; import com.asyncapi.v3.jackson.schema.SchemaAnyValueDeserializer; -import com.asyncapi.v3.schema.openapi.OpenAPISchema; +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; /** * @author Pavel Bodiachevskii diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java index 5df7f198..3f1f4bc9 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/multiformat/OpenAPIFormatSchema.java @@ -1,7 +1,7 @@ package com.asyncapi.v3.schema.multiformat; import com.asyncapi.v3.schema.AsyncAPISchema; -import com.asyncapi.v3.schema.openapi.OpenAPISchema; +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java similarity index 98% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java index 313094b0..4620d686 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/OpenAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java @@ -1,11 +1,11 @@ -package com.asyncapi.v3.schema.openapi; +package com.asyncapi.v3.schema.openapi.v3._0_0; import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAdditionalPropertiesDeserializer; import com.asyncapi.v3.jackson.schema.openapi.OpenAPISchemaAnyValueDeserializer; -import com.asyncapi.v3.schema.openapi.properties.Discriminator; -import com.asyncapi.v3.schema.openapi.properties.Extensions; -import com.asyncapi.v3.schema.openapi.properties.ExternalDocumentation; -import com.asyncapi.v3.schema.openapi.properties.XML; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Discriminator; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Extensions; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.ExternalDocumentation; +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.XML; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java similarity index 97% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java index ca5ab32c..fc12e2ae 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Discriminator.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Discriminator.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.openapi.properties; +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java similarity index 95% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java index 042bd076..b243003f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/Extensions.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/Extensions.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.openapi.properties; +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java similarity index 96% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java index e3cb9e9d..7289f546 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/ExternalDocumentation.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExternalDocumentation.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.openapi.properties; +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java similarity index 98% rename from asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java rename to asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java index cfd5a0de..539b26d0 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/properties/XML.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java @@ -1,4 +1,4 @@ -package com.asyncapi.v3.schema.openapi.properties; +package com.asyncapi.v3.schema.openapi.v3._0_0.properties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt index 6e5037c1..1174ee68 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/SchemaProvider.kt @@ -2,7 +2,7 @@ package com.asyncapi.v3.schema import com.asyncapi.v3.schema.multiformat.AsyncAPIFormatSchema import com.asyncapi.v3.schema.multiformat.JsonFormatSchema -import com.asyncapi.v3.schema.openapi.OpenAPISchema +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema interface SchemaProvider { diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt index 7238a76e..1643aae4 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_0Test.kt @@ -1,7 +1,7 @@ package com.asyncapi.v3.schema.multiformat.openapi import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema -import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt index fb7bf3eb..f4de776d 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_1Test.kt @@ -1,9 +1,7 @@ package com.asyncapi.v3.schema.multiformat.openapi import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat -import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt index 72865dbc..8bab13d0 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_2Test.kt @@ -1,9 +1,7 @@ package com.asyncapi.v3.schema.multiformat.openapi import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat -import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt index 8a25911b..b432763d 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/multiformat/openapi/OpenAPIFormatSchemaV3_0_3Test.kt @@ -1,9 +1,7 @@ package com.asyncapi.v3.schema.multiformat.openapi import com.asyncapi.v3.schema.multiformat.OpenAPIFormatSchema -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.JsonFormat -import com.asyncapi.v3.schema.multiformat.openapi.OpenAPIFormatSchemaV3_0_0Test.YamlFormat -import com.asyncapi.v3.schema.openapi.SchemaTest +import com.asyncapi.v3.schema.openapi.v3._0_0.SchemaTest import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt similarity index 98% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt index 13ccc763..b3e92b4f 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/OpenAPISchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchemaTest.kt @@ -1,8 +1,8 @@ -package com.asyncapi.v3.schema.openapi +package com.asyncapi.v3.schema.openapi.v3._0_0 import com.asyncapi.v3.ClasspathUtils import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.openapi.properties.* +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.* import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.ObjectMapper import org.junit.jupiter.api.Assertions diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt similarity index 96% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt index c0c9f91f..5e8f9532 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/SchemaTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/SchemaTest.kt @@ -1,9 +1,9 @@ -package com.asyncapi.v3.schema.openapi +package com.asyncapi.v3.schema.openapi.v3._0_0 import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.openapi.properties.Discriminator -import com.asyncapi.v3.schema.openapi.properties.ExternalDocumentation -import com.asyncapi.v3.schema.openapi.properties.XML +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.Discriminator +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.ExternalDocumentation +import com.asyncapi.v3.schema.openapi.v3._0_0.properties.XML import java.math.BigDecimal class SchemaTest: SchemaProvider { diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt similarity index 89% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt index e4c435ac..3c1c877e 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultArrayTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultArrayTest.kt @@ -1,7 +1,7 @@ -package com.asyncapi.v3.schema.openapi.properties +package com.asyncapi.v3.schema.openapi.v3._0_0.properties import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.openapi.OpenAPISchema +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema class ExampleEnumDefaultArrayTest: SchemaProvider { diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt similarity index 74% rename from asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt rename to asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt index 4e79cd5e..805357c8 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/properties/ExampleEnumDefaultNullTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/ExampleEnumDefaultNullTest.kt @@ -1,7 +1,7 @@ -package com.asyncapi.v3.schema.openapi.properties +package com.asyncapi.v3.schema.openapi.v3._0_0.properties import com.asyncapi.v3.schema.SchemaProvider -import com.asyncapi.v3.schema.openapi.OpenAPISchema +import com.asyncapi.v3.schema.openapi.v3._0_0.OpenAPISchema class ExampleEnumDefaultNullTest: SchemaProvider { From df17b809a2bfd64b6968045da2fa8b8cb2105bd4 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 20 Apr 2024 15:09:34 +0400 Subject: [PATCH 42/44] release: 1.0.0-RC --- CHANGELOG.md | 13 ++++++++++++- asyncapi-core/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e605ac62..eabdd65d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.0.0-EAP-3] - TBA +## [1.0.0-RC] - 2024-04-20 + +### Added + +- OpenAPI Schema: 3.0.0, 3.0.1, 3.0.2, 3.0.3 +- Avro Schema: 1.9.0, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.11.1 +- JsonSchema: Draft-07 + +### Changed + +- MultiFormatSchema can hold AsyncAPI, OpenAPI, Avro and Json Schemas +- Schema was divided to AsyncAPISchema and JsonSchema ## [1.0.0-EAP-3] - 2024-03-10 diff --git a/asyncapi-core/pom.xml b/asyncapi-core/pom.xml index 47158ee3..c9292752 100644 --- a/asyncapi-core/pom.xml +++ b/asyncapi-core/pom.xml @@ -6,7 +6,7 @@ asyncapi com.asyncapi - 1.0.0-RC-SNAPSHOT + 1.0.0-RC 4.0.0 diff --git a/pom.xml b/pom.xml index 29ac8613..ba543c30 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.asyncapi asyncapi - 1.0.0-RC-SNAPSHOT + 1.0.0-RC AsyncAPI From 90673aaaeee1438143074eed057e82b4e6ac2049 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Sat, 20 Apr 2024 15:59:32 +0400 Subject: [PATCH 43/44] fix: JavaDoc --- .../asyncapi/v3/schema/AsyncAPISchema.java | 17 ++-- .../com/asyncapi/v3/schema/JsonSchema.java | 6 +- .../schema/avro/v1/_9_0/AvroSchemaUnion.java | 8 +- .../schema/openapi/v3/_0_0/OpenAPISchema.java | 94 +++++++++---------- .../openapi/v3/_0_0/properties/XML.java | 2 +- 5 files changed, 60 insertions(+), 67 deletions(-) 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 index 2ef8c200..888b5994 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/AsyncAPISchema.java @@ -26,8 +26,8 @@ *

* 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. @@ -37,7 +37,7 @@ * @author Pavel Bodiachevskii * @version 3.0.0 * @see Schema Object - * @see Multi Format Schema Object + * @see Multi Format Schema Object */ @Data @Builder @@ -449,10 +449,7 @@ Validation Keywords for Numeric Instances (number and integer) public Map patternProperties; /** - * This property has been overwritten by AsyncAPI Specification - maybe boolean value - *

- *

- * The value of "additionalProperties" MUST be a valid JSON Schema. + * The value of "additionalProperties" MUST be a valid JSON Schema or boolean *

* This keyword determines how child instances validate for objects, and does not directly validate the immediate * instance itself. @@ -477,9 +474,9 @@ Validation Keywords for Numeric Instances (number and integer) * 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 diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java index 4feb3dbe..71eba2b0 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/JsonSchema.java @@ -457,9 +457,9 @@ Validation Keywords for Numeric Instances (number and integer) * 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 diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java index f21e6ec5..671a4645 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/avro/v1/_9_0/AvroSchemaUnion.java @@ -13,15 +13,15 @@ * Unions, as mentioned above, are represented using JSON arrays. *

* For example, ["null", "string"] declares a schema which may be either a null or string. - *

- *

+ *
+ *
* Note that when a default value is specified for a record field whose type is a union, * the type of the default value must match the first element of the union. *

* Thus, for unions containing "null", the "null" is usually listed first, * since the default value of such unions is typically null. - *

- *

+ *
+ *
* Unions may not contain more than one schema with the same type, except for the named types record, fixed and enum. *

* For example, unions containing two array types or two map types are not permitted, but two types with different names are permitted. diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java index 4620d686..97f365d3 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/OpenAPISchema.java @@ -109,30 +109,28 @@ public class OpenAPISchema extends Extensions { /** * The word “exclusive” in {@link #exclusiveMinimum} and {@link #exclusiveMaximum} means the corresponding boundary is excluded: - *

-     *     
-     *         
-     *             
-     *             
-     *         
-     *         
-     *             
-     *         
-     *             
-     *         
-     *             
-     *         
-     *             
-     *     
KeywordDescription
exclusiveMinimum: false or not included - * value ≥ minimum - *
exclusiveMinimum: true - * value > minimum - *
exclusiveMaximum: false or not included - * value ≤ maximum - *
exclusiveMaximum: true - * value < maximum - *
- *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
KeywordDescription
exclusiveMinimum: false or not includedvalue ≥ minimum
exclusiveMinimum: truevalue > minimum
exclusiveMaximum: false or not includedvalue ≤ maximum
exclusiveMaximum: truevalue < maximum
* * @see range */ @@ -168,30 +166,28 @@ public class OpenAPISchema extends Extensions { /** * The word “exclusive” in {@link #exclusiveMinimum} and {@link #exclusiveMaximum} means the corresponding boundary is excluded: - *
-     *     
-     *         
-     *             
-     *             
-     *         
-     *         
-     *             
-     *         
-     *             
-     *         
-     *             
-     *         
-     *             
-     *     
KeywordDescription
exclusiveMinimum: false or not included - * value ≥ minimum - *
exclusiveMinimum: true - * value > minimum - *
exclusiveMaximum: false or not included - * value ≤ maximum - *
exclusiveMaximum: true - * value < maximum - *
- *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
KeywordDescription
exclusiveMinimum: false or not includedvalue ≥ minimum
exclusiveMinimum: truevalue > minimum
exclusiveMaximum: false or not includedvalue ≤ maximum
exclusiveMaximum: truevalue < maximum
* * @see range */ @@ -839,7 +835,7 @@ public class OpenAPISchema extends Extensions { * } * * — is represented in the following way in JSON and XML: - *
+ *
* JSON *
{@code
      * {
diff --git a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java
index 539b26d0..7739011f 100644
--- a/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java
+++ b/asyncapi-core/src/main/java/com/asyncapi/v3/schema/openapi/v3/_0_0/properties/XML.java
@@ -46,7 +46,7 @@ public class XML extends Extensions {
     public String namespace;
 
     /**
-     * The prefix to be used for the {@link #getName()}.
+     * The prefix to be used for the {@link #name}.
      *
      * @see XML Fixed Fields: prefix
      */

From f662aa2542cdb3ec6fa599883e5708d450816b00 Mon Sep 17 00:00:00 2001
From: Pavel Bodiachevskii 
Date: Sat, 20 Apr 2024 16:27:01 +0400
Subject: [PATCH 44/44] doc: README.md link to 1.0.0-RC release

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 97d13f95..90105287 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
 > ⚠️ This project doesn't support AsyncAPI 1.x
 ---
 
-[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-EAP-3)
+[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-RC)
 
 ## Overview
 JVM-friendly bindings for AsyncAPI. It allows you to read or write specifications for your asynchronous API  through code