JSON scalar types not supported
See original GitHub issueBug description
I have an upstream graphql server that uses JSON scalar types.
When the value returned for this scalar is a JSON object, wundergraph complains with the following error:
2022-12-14T13:53:48+11:00 ERROR apihandler/apihandler.go:801 ResolveGraphQLResponse {"component": "@wundergraph/node", "reqId": "44a4ae5f-ef82-a2e9-3731-7a0284accd0b", "error": "invalid value type 'object' for path /data/bar, expecting string, got: {\"type\":\"string\"}. You can fix this by configuring this field as Int/Float Scalar"}
github.com/wundergraph/wundergraph/pkg/apihandler.(*GraphQLHandler).ServeHTTP
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:801
github.com/wundergraph/wundergraph/pkg/authentication.NewCSRFMw.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/authentication/authentication.go:864
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/authentication.NewLoadUserMw.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/authentication/authentication.go:655
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/rs/cors.(*Cors).Handler.func1
/home/runner/go/pkg/mod/github.com/rs/cors@v1.7.0/cors.go:219
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/apihandler.(*Builder).BuildAndMountApiHandler.func4.1
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:233
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/apihandler.logRequestMiddleware.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:353
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/gorilla/mux.(*Router).ServeHTTP
/home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210
net/http.serverHandler.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2916
net/http.(*conn).serve
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:1966
How to reproduce
I have been able to create a self-contained wundergraph project to reproduce the error, using the in-built graphql server. It is attached: wgtest.zip
To reproduce:
- install dependencies with
yarn
- run with
yarn start
Then visit the following URL: http://localhost:9991/operations/Hello
Expected behavior
The response from the server should be successfully returned to the caller.
For the attached project, that is:
{ "data": {"bar": {"type": "string"}} }
WunderGraph information
Included in the attached project
Environment & setup
- OS: Mint w/kernel 5.4.0-135-generic
- Go version: go version go1.13.8 linux/amd64
- Node.js version: v18.12.1
WunderCtl Version
119.1
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
support JSON scalar type #32 - shurcooL/graphql - GitHub
I have a JSON type and it seems to be expecting the whole object before running my unmarshal. is there any way to...
Read more >JSON type not supported. (Parameter 'ValueKind')\r\nActual ...
it comes from the Gremlin client as System.Linq.Enumerable.SelectEnumerableIterator<System.Text.Json.JsonElement, object> which my method ...
Read more >JSON Data Types - W3Schools
Valid Data Types. In JSON, values must be one of the following data types: a string; a number; an object (JSON object); an...
Read more >What data types are supported by JSON? - Educative.io
What data types are supported by JSON? · String · Number · Boolean · Null · Arrays · Object.
Read more >JSON format properties and data type conversions - IBM
JSON supports a value of type String, Number and Boolean. It does not support octal and hexdecimal values. The data handler will delegate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We know the solution and are currently implementing it.
I also encounter the same problem when the graphql server returns an JSON int literal for the value.