We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A schema with scalar Map is generated as type map[string]interface{} (https://gqlgen.com/reference/scalars/)
map[string]interface{}
The graphqljson package can't unmarshal responses with this Map type:
func TestUnmarshalGraphql_map(t *testing.T) { t.Parallel() type query struct { Me struct { Name string Height float64 Properties map[string]interface{} } } var jsonStr = `{ "me": { "name": "Luke Skywalker", "height": 1.72, "properties": { "propKey1": "123", "propKey2": "test" } } }` var got query // The default json decoder works as expected if err := json.NewDecoder(strings.NewReader(jsonStr)).Decode(&got); err != nil{ t.Fatalf("Default json implementation failed: %s", err) } err := graphqljson.UnmarshalData([]byte(jsonStr), &got) if err != nil { t.Fatalf("Graphqljson implementation failed: %s", err) } var want query want.Me.Name = "Luke Skywalker" want.Me.Height = 1.72 want.Me.Properties = map[string]interface{}{ "propKey1": "123", "propKey2": "test", } if diff := cmp.Diff(got, want); diff != "" { t.Error(diff) } }
Error: Graphqljson implementation failed: : : struct field for "propKey1" doesn't exist in any of 1 places to unmarshal
Graphqljson implementation failed: : : struct field for "propKey1" doesn't exist in any of 1 places to unmarshal
The text was updated successfully, but these errors were encountered:
No branches or pull requests
A schema with scalar Map is generated as type
map[string]interface{}
(https://gqlgen.com/reference/scalars/)The graphqljson package can't unmarshal responses with this Map type:
Error:
Graphqljson implementation failed: : : struct field for "propKey1" doesn't exist in any of 1 places to unmarshal
The text was updated successfully, but these errors were encountered: