DmitryTsepelev / graphql-ruby-persisted_queries

Persisted queries for graphql-ruby
MIT License
171 stars 20 forks source link

fix args for GraphQL::Query::Result #35

Closed ogidow closed 4 years ago

ogidow commented 4 years ago

The fix for #34 was inadequate. I'm sorry.

GraphQL::Result class delegates some methods to @query so @query expects GraphQL::Query class instead of string or nil. If @query is a string or nil, the method will call with an error as below

> result = TestSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
=> #<GraphQL::Query::Result @query=... @to_h={"errors"=>[{"message"=>"PersistedQueryNotFound"}]}>
> result["errors"]
=> [{"message"=>"PersistedQueryNotFound"}]
> result. context
NoMethodError: undefined method `conteext' for #<GraphQL::Query::Result:0x00007f93cb9d9098>