Skip to content

Commit

Permalink
fix(gen): attach the full record schema to the type, including defaul…
Browse files Browse the repository at this point in the history
…t value (#1)

Co-authored-by: fcote <fabien.cote@me.com>
  • Loading branch information
stonalbot and fcote authored Jul 16, 2024
1 parent 582d9c9 commit 47f042a
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 4 deletions.
168 changes: 168 additions & 0 deletions .idea/workspace.xml

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

2 changes: 1 addition & 1 deletion cmd/avrogen/testdata/golden_encoders.go

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

4 changes: 3 additions & 1 deletion gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ func (g *Generator) resolveRecordSchema(schema *avro.RecordSchema) string {

typeName := g.resolveTypeName(schema)
if !g.hasTypeDef(typeName) {
g.typedefs = append(g.typedefs, newType(typeName, schema.Doc(), fields, schema.String()))
schemaBytes, _ := schema.MarshalJSON()

g.typedefs = append(g.typedefs, newType(typeName, schema.Doc(), fields, string(schemaBytes)))
}
return typeName
}
Expand Down
4 changes: 2 additions & 2 deletions gen/testdata/golden_encoders.go

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

0 comments on commit 47f042a

Please sign in to comment.