graphql-zeus icon indicating copy to clipboard operation
graphql-zeus copied to clipboard

Serialization of JSONObject not working

Open cjanietz opened this issue 5 years ago • 9 comments

Hi @aexol Still appreciating your great work on this lib I have come across a new issue unfortunately, which is a custom GraphQL Scalar.

The scalar in question is: https://github.com/taion/graphql-type-json While of course its arguably weird to be able to specify arbitrary objects in a GQL query, JSON and JSONObject are as of today valid usages. Would you mind extending the ScalarResolver to accommodate these types as well for input? Otherwise if okay with you I can also create a PR

Regards, Christopher

cjanietz avatar Apr 13 '20 19:04 cjanietz

Hi @cjanietz I am a little busy now so I will be happy with your PR :) if you have time of course. Regards, Artur

aexol avatar Apr 14 '20 07:04 aexol

I've encountered this and am willing to write a pr if this is reopened

Gozala avatar Oct 06 '21 20:10 Gozala

Is there any news here? I am struggling with the same problem as I am using the open source headless CMS Strapi with associated Graphql plugins (strapi-plugin-graphql until version 3 and @strapi/plugin-graphql from version 4) which uses the mentioned above plugin. Now I would like to use Graphql Zeus in the frontend but it doesn't work, because zeus adds quotes to the JSON objects, e.g.

Gql('query')({ user: [ { where: { active: true, }, }, { id: true } ], });

results to

query { user(where: { "active": true }) { id } }

instead of

query { user(where: { active: true }) { id } }

Are there any workarounds?

machiaveli88 avatar Jan 24 '22 07:01 machiaveli88

Having the same problem, also trying to implement using StrapiCMS schema, any updates @Gozala @aexol? Lmk if u guys need any help, I'm not so experienced with GraphQL but I'm here if needed.

Thanks for the awesome work :)

gfsd3v avatar Mar 12 '22 14:03 gfsd3v

Any updates here?

machiaveli88 avatar May 28 '22 14:05 machiaveli88

Got stuck on this too... Had to change my DB schema to work around this. No more JSONB for me...

I prefer to change my DB schema instead of working without graphql-zeus. god bless this library - changed my life.

assafnoahkoren avatar Jul 13 '22 22:07 assafnoahkoren

Use serializers check scalars section inside docs

aexol avatar Jul 14 '22 18:07 aexol

@AsafKaravani

aexol avatar Jul 15 '22 08:07 aexol