Skip to content

Conversation

@dpkp
Copy link

@dpkp dpkp commented Nov 29, 2018

ruby-2.5.1 / graphql-1.8.9

The schema default_resolver crashes if a field uses a non-standard hash_key, like so:

field :foo, String, hash_key: :"foo/bar"
field :bar, String, hash_key: "2nd test case"
SyntaxError (/usr/local/rvm/gems/ruby-2.5.1/gems/graphql-1.8.9/lib/graphql/schema/member/has_fields.rb:121: syntax error, unexpected '/', expecting ';' or '\n'
            def foo/bar(**args)
                   ^
/usr/local/rvm/gems/ruby-2.5.1/gems/graphql-1.8.9/lib/graphql/schema/member/has_fields.rb:124: syntax error, unexpected keyword_end, expecting end-of-input
            end
            ^~~):

Putting aside the wisdom of such hash_keys, this PR is intended to allow the user to use any valid string or symbol as a hash_key. I've updated the spec tests to cover.

@dpkp dpkp requested review from Gasparila, bdj, dounan and sheki November 30, 2018 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants