Skip to content

Commit d706340

Browse files
author
Patrick Donovan
authored
Fix relay root-level node declaration syntax
While following this guide verbatim, I ran into the following error: ``` GraphQL::Field was passed as the second argument, use the `field:` keyword for this instead. /Users/Patrick/.gem/ruby/2.5.1/gems/graphql-1.8.6/lib/graphql/schema/field.rb:61:in `from_options' /Users/Patrick/.gem/ruby/2.5.1/gems/graphql-1.8.6/lib/graphql/schema/member/has_fields.rb:52:in `field' ... ``` I don't know when the docs got out of date, but it turns out that a `field: ` keyword is required before the argument, as of at latest 1.8.6.
1 parent be5439d commit d706340

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/relay/object_identification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ You should also provide a root-level `node` field so that Relay can refetch obje
107107
```ruby
108108
class Types::QueryType < GraphQL::Schema::Object
109109
# Used by Relay to lookup objects by UUID:
110-
field :node, GraphQL::Relay::Node.field
110+
field :node, field: GraphQL::Relay::Node.field
111111
# ...
112112
end
113113
```
@@ -119,7 +119,7 @@ You can also provide a root-level `nodes` field so that Relay can refetch object
119119
```ruby
120120
class QueryType < GraphQL::Schema::Object
121121
# Fetches a list of objects given a list of IDs
122-
field :nodes, GraphQL::Relay::Node.plural_field
122+
field :nodes, field: GraphQL::Relay::Node.plural_field
123123
# ...
124124
end
125125
```

0 commit comments

Comments
 (0)