graphlient icon indicating copy to clipboard operation
graphlient copied to clipboard

disable schema dump

Open leoGalani opened this issue 6 years ago • 3 comments

Hi, is there a way to avoid automatic schema dump/introspection query?

Graphql for ruby (v1.9.7 ++) have the ability to disable those for production and I couldn't find a way of disabling the automatic fetch locally.

This is the message I'm getting and trying to client.schema or any operation (which in the end hits https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/schema/loader.rb#L16 )

(byebug) client.schema
*** KeyError Exception: key not found: "data"

Any thoughts besides mocking the schema?

leoGalani avatar Aug 14 '19 13:08 leoGalani

Disabling them in production makes sense to me, but I do not think there is an easy way to do so at this point.

@ashkan18 Perhaps something we could accept with a PR?

yuki24 avatar Aug 14 '19 21:08 yuki24

Just quickly skimming the commit logs in graphql-client, but it doesn't seem to have support for it yet.

graphlient depends on graphql-client which depends on graphql-ruby, so it needs to be implemented in graphql-client first.

yuki24 avatar Aug 14 '19 21:08 yuki24

thanks @leoGalani for opening the issue, yes i think at the moment the easiest approach would be either mocking the schema, or (maybe better?) use a local dump of your target schema locally and pass it to the client:

Client.new(url, schema_path: 'config/your_graphql_schema.json')

would this help you out?

ashkan18 avatar Aug 14 '19 22:08 ashkan18