Class: GraphQL::Introspection::TypenameField

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/introspection/typename_field.rb

Overview

A wrapper to create ‘__typename`.

Class Method Summary collapse

Class Method Details

.create(wrapped_type) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/graphql/introspection/typename_field.rb', line 5

def self.create(wrapped_type)
  GraphQL::Field.define do
    name "__typename"
    description "The name of this type"
    type -> { !GraphQL::STRING_TYPE }
    resolve -> (obj, a, c) { wrapped_type.name }
  end
end