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