Skip to content

Commit

Permalink
[schema builder] don't generate ref'ed arrays and maps (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg-builder committed Jan 26, 2024
1 parent 9487a8b commit e2849e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
{
"name": "date",
"type": "build.generated.SimpleRecord"
},
{
"name": "unionArrayReference",
"type" :[
"null",
{
"type": "array",
"items": "build.generated.SimpleRecord"
}
]
},
{
"name": "mapReference",
"type": {
"type": "map",
"values": "build.generated.SimpleRecord"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,16 @@ private static List<AvroNamedSchema> getNestedInternalSchemaListForRecord(AvroRe
});
break;
case MAP:
schemaQueue.add(((AvroMapSchema) fieldSchema).getValueSchema());
AvroMapSchema mapSchema = (AvroMapSchema) fieldSchema;
if (mapSchema.getValueSchemaOrRef().getRef() == null) {
schemaQueue.add(mapSchema.getValueSchema());
}
break;
case ARRAY:
schemaQueue.add(((AvroArraySchema) fieldSchema).getValueSchema());
AvroArraySchema arraySchema = (AvroArraySchema) fieldSchema;
if (arraySchema.getValueSchemaOrRef().getRef() == null) {
schemaQueue.add(arraySchema.getValueSchema());
}
break;
}
}
Expand Down

0 comments on commit e2849e7

Please sign in to comment.