Module: GraphQL::Relay::Node
- Defined in:
- lib/graphql/relay/node.rb
Overview
Helpers for working with Relay-specific Node objects.
Defined Under Namespace
Modules: FindNode
Class Method Summary collapse
-
.field ⇒ GraphQL::Field
A field for finding objects by their global ID.
-
.interface ⇒ GraphQL::InterfaceType
The interface which all Relay types must implement.
Class Method Details
.field ⇒ GraphQL::Field
Returns a field for finding objects by their global ID.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/relay/node.rb', line 6 def self.field # We have to define it fresh each time because # its name will be modified and its description # _may_ be modified. 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.[:relay_node_field] = true node_field end |
.interface ⇒ GraphQL::InterfaceType
Returns The interface which all Relay types must implement.
24 25 26 27 28 29 30 |
# File 'lib/graphql/relay/node.rb', line 24 def self.interface @interface ||= GraphQL::InterfaceType.define do name "Node" description "An object with an ID." field :id, !types.ID, "ID of the object." end end |