Sha256: d8db1d5424101984804be169a17fba9ced6689833d622caa8917780f537a99ed

Contents?: true

Size: 815 Bytes

Versions: 13

Compression:

Stored size: 815 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Types
    module Relay
      # This can be used for implementing `Query.node(id: ...)`,
      # or use it for inspiration for your own field definition.
      #
      # @example Adding this field directly
      #   add_field(GraphQL::Types::Relay::NodeField)
      #
      # @example Implementing a similar field in your own Query root
      #
      #   field :node, GraphQL::Types::Relay::Node, null: true,
      #     description: "Fetches an object given its ID" do
      #       argument :id, ID, required: true
      #     end
      #
      #   def node(id:)
      #     context.schema.object_from_id(id, context)
      #   end
      #
      NodeField = GraphQL::Schema::Field.new(**HasNodeField.field_options, &HasNodeField.field_block)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql-1.12.12 lib/graphql/types/relay/node_field.rb
graphql-1.12.11 lib/graphql/types/relay/node_field.rb
graphql-1.12.10 lib/graphql/types/relay/node_field.rb
graphql-1.12.9 lib/graphql/types/relay/node_field.rb
graphql-1.12.8 lib/graphql/types/relay/node_field.rb
graphql-1.12.7 lib/graphql/types/relay/node_field.rb
graphql-1.12.6 lib/graphql/types/relay/node_field.rb
graphql-1.12.5 lib/graphql/types/relay/node_field.rb
graphql-1.12.4 lib/graphql/types/relay/node_field.rb
graphql-1.12.3 lib/graphql/types/relay/node_field.rb
graphql-1.12.2 lib/graphql/types/relay/node_field.rb
graphql-1.12.1 lib/graphql/types/relay/node_field.rb
graphql-1.12.0 lib/graphql/types/relay/node_field.rb