Open JulienBreux opened 6 years ago
I try to unmarshal like this: (in definition.go
)
type Field struct {
// ...
}
func (f Field) UnmarshalJSON(b []byte) error {
var tmp map[string]interface{}
if err := json.Unmarshal(b, &tmp); err != nil {
return err
}
for k, v := range tmp {
switch k {
case "name":
f.Name = v.(string)
break
case "type":
f.Type = v.(Output)
break
case "deprecationReason":
f.DeprecationReason = v.(string)
break
case "description":
f.Description = v.(string)
break
}
}
return nil
}
And I have this message:
panic: interface conversion: map[string]interface {} is not graphql.Output: missing method Description [recovered]
panic: interface conversion: map[string]interface {} is not graphql.Output: missing method Description
I have this JSON:
When I want to unmarshal:
I have this result:
Do you have an idea @chris-ramon or @dvic?