Sha256: 716be9a3f655bc3e16156fbf387ee247e10e13cc0d82605a3001eb2d6821d741

Contents?: true

Size: 516 Bytes

Versions: 8

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Introspection
    # A wrapper to create `__type(name: )` dynamically.
    class TypeByNameField
      def self.create(schema)
        GraphQL::Field.define do
          name("__type")
          description("A type in the GraphQL system")
          type(GraphQL::Introspection::TypeType)
          argument :name, !types.String
          resolve ->(o, args, ctx) {
            ctx.warden.get_type(args["name"])
          }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
graphql-1.5.3 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.5 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.4 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.3 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.2 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.1 lib/graphql/introspection/type_by_name_field.rb
graphql-1.4.0 lib/graphql/introspection/type_by_name_field.rb
graphql-1.3.0 lib/graphql/introspection/type_by_name_field.rb