Skip to content

Commit

Permalink
fix: handle uuid logical type in avrogen (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored Nov 9, 2023
1 parent 3873c53 commit 210b6b9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ func (g *Generator) resolveLogicalSchema(logicalType avro.LogicalType) string {
typ = "*big.Rat"
case "duration":
typ = "avro.LogicalDuration"
case "uuid":
typ = "string"
}
if strings.Contains(typ, "time") {
g.addImport("time")
Expand Down
7 changes: 7 additions & 0 deletions gen/testdata/golden.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@
{
"name": "ref",
"type": "record2InNullableUnion"
},
{
"name": "uuid",
"type": {
"type": "string",
"logicalType": "uuid"
}
}
]
}
1 change: 1 addition & 0 deletions gen/testdata/golden.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion gen/testdata/golden_encoders.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gen/testdata/golden_fullname.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 210b6b9

Please sign in to comment.