Skip to content
Merged
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 @@ -693,7 +693,7 @@ public void testSimpleMessage() throws Exception {
message.setMyStruct(new SimpleExampleMessageData.MyStruct().setStructId(25).setArrayInStruct(
Collections.singletonList(new SimpleExampleMessageData.StructArray().setArrayFieldId(20))
));
message.setMyTaggedStruct(new SimpleExampleMessageData.MyTaggedStruct().setStructId("abc"));
message.setMyTaggedStruct(new SimpleExampleMessageData.TaggedStruct().setStructId("abc"));

message.setProcessId(UUID.randomUUID());
message.setMyNullableString("notNull");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ public void testMyStructUnsupportedVersion() {
@Test
public void testMyTaggedStruct() {
// Verify that we can set and retrieve a nullable struct object.
SimpleExampleMessageData.MyTaggedStruct myStruct =
new SimpleExampleMessageData.MyTaggedStruct().setStructId("abc");
SimpleExampleMessageData.TaggedStruct myStruct =
new SimpleExampleMessageData.TaggedStruct().setStructId("abc");
testRoundTrip(new SimpleExampleMessageData().setMyTaggedStruct(myStruct),
message -> assertEquals(myStruct, message.myTaggedStruct()), (short) 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{ "name": "arrayFieldId", "type": "int32", "versions": "2+"}
]}
]},
{ "name": "myTaggedStruct", "type": "MyTaggedStruct", "versions": "2+", "about": "Test Tagged Struct field",
{ "name": "myTaggedStruct", "type": "TaggedStruct", "versions": "2+", "about": "Test Tagged Struct field",
"taggedVersions": "2+", "tag": 8,
"fields": [
{ "name": "structId", "type": "string", "versions": "2+", "about": "String field in struct"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ void register(MessageSpec message) throws Exception {
private void addStructSpecs(Versions parentVersions, List<FieldSpec> fields) {
for (FieldSpec field : fields) {
String elementName = null;
String typeName = null;
if (field.type().isStructArray()) {
FieldType.ArrayType arrayType = (FieldType.ArrayType) field.type();
elementName = arrayType.elementName();
typeName = arrayType.elementName();
} else if (field.type().isStruct()) {
elementName = field.name();
typeName = field.typeString();
}
if (elementName != null) {
if (commonStructNames.contains(elementName)) {
Expand All @@ -107,7 +110,7 @@ private void addStructSpecs(Versions parentVersions, List<FieldSpec> fields) {
" was specified twice.");
} else {
// Synthesize a StructSpec object out of the fields.
StructSpec spec = new StructSpec(elementName,
StructSpec spec = new StructSpec(typeName,
field.versions().toString(),
field.fields());
structs.put(elementName, new StructInfo(spec, parentVersions));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ public void testSingleStruct() throws Exception {
FieldSpec field2 = testMessageSpec.fields().get(1);
assertTrue(field2.type().isStruct());
assertEquals("TestInlineStruct", field2.type().toString());
assertEquals("field2", field2.name());

assertEquals("field2", structRegistry.findStruct(field2).name());
assertEquals("TestInlineStruct", structRegistry.findStruct(field2).name());
assertFalse(structRegistry.isStructArrayWithKeys(field2));
}
}