heetch / heetch/avro

struct defaults don't work correctly with all field types

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
95
Forks
18
PR merge metrics
No merged PRs in 30d

Description

The code to derive a default value from a Go struct is too naive. It doesn't cope when the JSON-formatted value isn't correct for Avro.

Here's a test case that fails:

```

tests: goTypeStructFieldWithEnum: {
inSchema: {
name: "R"
type: "record"
fields: []
}
goType: "R"
goTypeBody: """
struct {
S S
}
type S struct {
E Enum
}
type Enum int

func (e Enum) String() string {
return []string{"a", "b"}[e]
}
"""
inData: {}
outData: {
S: E: "a"
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.