lib/graphql/relay/node.rb in graphql-0.19.0 vs lib/graphql/relay/node.rb in graphql-0.19.1

- old
+ new

@@ -5,15 +5,20 @@ # @return [GraphQL::Field] a field for finding objects by their global ID. def self.field # We have to define it fresh each time because # its name will be modified and its description # _may_ be modified. - GraphQL::Field.define do + node_field = GraphQL::Field.define do type(GraphQL::Relay::Node.interface) description("Fetches an object given its ID") argument(:id, !types.ID, "ID of the object") resolve(GraphQL::Relay::Node::FindNode) end + + # This is used to identify generated fields in the schema + node_field.metadata[:relay_node_field] = true + + node_field end # @return [GraphQL::InterfaceType] The interface which all Relay types must implement def self.interface @interface ||= GraphQL::InterfaceType.define do