Class: GraphQL::Introspection::TypeByNameField
- Inherits:
-
Object
- Object
- GraphQL::Introspection::TypeByNameField
- Defined in:
- lib/graphql/introspection/type_by_name_field.rb
Overview
A wrapper to create ‘__type(name: )` dynamically.
Constant Summary collapse
- DEFINITION =
Proc.new { |f, type, field, arg, type_hash| f.name("__type") f.description("A type in the GraphQL system") f.arguments({name: arg.build(type: !type.String)}) f.type(!GraphQL::Introspection::TypeType) f.resolve -> (o, args, c) { type_hash[args["name"]] } }
Class Method Summary collapse
Class Method Details
.create(type_hash) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql/introspection/type_by_name_field.rb', line 11 def self.create(type_hash) GraphQL::Field.define do name("__type") description("A type in the GraphQL system") type(!GraphQL::Introspection::TypeType) argument :name, !types.String resolve -> (o, args, c) { type_hash[args["name"]] } end end |