Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Fixed bug that was leading to failure in avro format #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ private Schema toConnectSchema(Descriptors.FieldDescriptor descriptor) {
break;
}

String jsonName = descriptor.getJsonName();
builder = SchemaBuilder.struct().name(jsonName.substring(0, 1).toUpperCase() + jsonName.substring(1));
builder = SchemaBuilder.struct().name(descriptor.getMessageType().getName());
for (Descriptors.FieldDescriptor fieldDescriptor : descriptor.getMessageType().getFields()) {
builder.field(getConnectFieldName(fieldDescriptor), toConnectSchema(fieldDescriptor));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ private Schema getExpectedComplexMapMessageProtoSchema(boolean useConnectMapType
userIdBuilder.field("other_user_id", SchemaBuilder.int32().optional().build());
final SchemaBuilder anotherIdBuilder = SchemaBuilder.struct();
anotherIdBuilder.field("id", SchemaBuilder.string().optional().build());
userIdBuilder.field("another_id", anotherIdBuilder.optional().name("AnotherId").build());
userIdBuilder.field("another_id", anotherIdBuilder.optional().name("MessageId").build());
builder.field("user_id", userIdBuilder.optional().name("UserId").build());
final SchemaBuilder messageIdBuilder = SchemaBuilder.struct().name("Value").optional();
final SchemaBuilder messageIdBuilder = SchemaBuilder.struct().name("MessageId").optional();
messageIdBuilder.field("id", SchemaBuilder.string().optional().build());
if (useConnectMapType) {
builder.field("user_messages", SchemaBuilder.map(Schema.OPTIONAL_STRING_SCHEMA, messageIdBuilder.schema()).optional().build());
} else {
builder.field("user_messages", SchemaBuilder.array(SchemaBuilder.struct()
.name("UserMessages")
.name("UserMessagesEntry")
.field("key", Schema.OPTIONAL_STRING_SCHEMA)
.field("value", messageIdBuilder.schema()).optional().build())
.optional().build());
Expand All @@ -161,7 +161,7 @@ private Schema getExpectedNestedTestProtoSchema(boolean useConnectMapType) {
userIdBuilder.field("other_user_id", SchemaBuilder.int32().optional().build());
final SchemaBuilder messageIdBuilder = SchemaBuilder.struct();
messageIdBuilder.field("id", SchemaBuilder.string().optional().build());
userIdBuilder.field("another_id", messageIdBuilder.optional().name("AnotherId").build());
userIdBuilder.field("another_id", messageIdBuilder.optional().name("MessageId").build());
builder.field("user_id", userIdBuilder.optional().name("UserId").build());
builder.field("is_active", SchemaBuilder.bool().optional().build());
builder.field("experiments_active", SchemaBuilder.array(SchemaBuilder.string().optional().build()).optional().build());
Expand All @@ -171,7 +171,7 @@ private Schema getExpectedNestedTestProtoSchema(boolean useConnectMapType) {
if (useConnectMapType) {
builder.field("map_type", SchemaBuilder.map(Schema.OPTIONAL_STRING_SCHEMA, Schema.OPTIONAL_STRING_SCHEMA).optional().build());
} else {
builder.field("map_type", SchemaBuilder.array(SchemaBuilder.struct().field("key", Schema.OPTIONAL_STRING_SCHEMA).field("value", Schema.OPTIONAL_STRING_SCHEMA).optional().name("MapType").build()).optional().build());
builder.field("map_type", SchemaBuilder.array(SchemaBuilder.struct().field("key", Schema.OPTIONAL_STRING_SCHEMA).field("value", Schema.OPTIONAL_STRING_SCHEMA).optional().name("MapTypeEntry").build()).optional().build());
}
return builder.build();
}
Expand Down