redo type naming

This commit is contained in:
Ben Kraft
2021-03-19 18:40:58 -07:00
parent 58f4aff83b
commit fed38e4f55
20 changed files with 210 additions and 164 deletions
+3 -1
View File
@@ -7,7 +7,7 @@ func (v *{{.Type}}) UnmarshalJSON(b []byte) error {
}
firstPass.{{.Type}} = v
err := json.Unmarshal(b, &typenames)
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
@@ -22,6 +22,7 @@ func (v *{{.Type}}) UnmarshalJSON(b []byte) error {
{{with $field := .}}
{{range $field.ConcreteTypes}}
case "{{.GraphQLName}}":
{{/* TODO: handle repeated fields! */}}
v.{{$field.GoName}} = {{.GoName}}{}
err = json.Unmarshal(
firstPass.{{$field.GoName}}, &v.{{$field.GoName}})
@@ -32,4 +33,5 @@ func (v *{{.Type}}) UnmarshalJSON(b []byte) error {
return err
}
{{end}}
return nil
}