Closed nowakoo closed 5 months ago
It creates the query name based on the generated module's name in Ruby. For example, if you did:
Mutations = client.parse(graphql_code)
Then it would generate Mutations__GenerateKey
. For that to work, the module must be given a constant name. Does it work for you to update your code to assign constants?
I hope you found something that works for you!
I have the following GraphQL code:
I defined GraphQL client as
client
and I parse the code above:mutations = client.parse(graphql_code)
, which returns a Module with three constants:GenerateKey
,ForgotPassword
,ResetPassword
-GraphQL::Client::OperationDefinition
objects. I couldn't execute this mutation withclient.query(mutations.const_get(:GenerateKey), variables: { email: 'my_email@example.com', password: 'my_pass'})
, as I received the following error:So I took a look at executed query using
mutations.const_get(:GenerateKey).document.to_query_string
and received:#<Module:0x0000000107b5ef70>__GenerateKey
mutation name is not a valid GraphQL syntax. Is there a way to workaround it?