Module: GraphQL::Types::Relay::HasNodeField
- Defined in:
- lib/graphql/types/relay/has_node_field.rb
Class Method Summary collapse
Class Method Details
.field_block ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/graphql/types/relay/has_node_field.rb', line 23 def field_block Proc.new { argument :id, "ID!", required: true, description: "ID of the object." def resolve(obj, args, ctx) ctx.schema.object_from_id(args[:id], ctx) end def resolve_field(obj, args, ctx) resolve(obj, args, ctx) end } end |
.field_options ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/types/relay/has_node_field.rb', line 12 def { name: "node", owner: nil, type: GraphQL::Types::Relay::Node, null: true, description: "Fetches an object given its ID.", relay_node_field: true, } end |