fix(genapi): uint64 fields failing to be unmarshalled (#2492)
uint64 fields get marshalled into json by protobuf as strings, so we have to tell the json parser to look for strings when unmarshalling.
This commit is contained in:
3 files changed
+15
-3
No files matched your search
@@ -58,6 +58,7 @@ type fieldInfo struct {
|
||||
SubtypeNames []string
|
||||
Query bool
|
||||
SkipDefault bool
|
||||
JsonTags []string // Appended to a field's `json` tag (comma separated)
|
||||
}
|
||||
|
||||
type structInfo struct {
|
||||
@@ -832,6 +833,13 @@ var inputStructs = []*structInfo{
|
||||
{
|
||||
inProto: &sessions.Connection{},
|
||||
outFile: "sessions/connection.gen.go",
|
||||
fieldOverrides: []fieldInfo{
|
||||
// uint64 fields get marshalled by protobuf as strings, so we have
|
||||
// to tell the json parser that their json representation is a
|
||||
// string but they go into Go uint64 types.
|
||||
{Name: "BytesUp", JsonTags: []string{"string"}},
|
||||
{Name: "BytesDown", JsonTags: []string{"string"}},
|
||||
},
|
||||
},
|
||||
{
|
||||
inProto: &sessions.Session{},
|
||||
|
||||
Reference in new issue
Block a user