-
Hi all, I want to use typed errors in mutations. For this I have an Error interface defined in schema and some error types implementing such interface:
Result type and mutation defined as:
This generates this Go code:
When I write an integration test using client package I use this structure to store the result:
The test failes with errors:
Regular GraphQL request works fine and the result is as expected - this is only in tests. Any idea what I have wrond here? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Finally I've found solution. The point is that I forgot to specify JSON field name for UpdateUser struct. With this everything' working: var resp struct {
UpdateUser struct {
User *struct {
ID string `json:"id"`
LoginName string `json:"loginName"`
PasswordChangeRequired bool `json:"passwordChangeRequired"`
IsLocked bool `json:"isLocked"`
}
Errors []model.Error `json:"errors"`
} `json:"updateUser"`
} |
Beta Was this translation helpful? Give feedback.
Finally I've found solution. The point is that I forgot to specify JSON field name for UpdateUser struct. With this everything' working: