Sha256: f505c136fc6f655262cb04ce9e8ff08b5229fb4b6976d35934655d724f69f728

Contents?: true

Size: 676 Bytes

Versions: 7

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Introspection
    TypeByNameField = GraphQL::Field.define do
      name("__type")
      description("A type in the GraphQL system")
      introspection true
      type(GraphQL::Schema::LateBoundType.new("__Type"))
      argument :name, !types.String
      resolve ->(o, args, ctx) {
        type = ctx.warden.get_type(args["name"])
        if type
          # Apply wrapping manually since this field isn't wrapped by instrumentation
          type_type = ctx.schema.introspection_system.type_type
          type_type.metadata[:object_class].new(type, ctx)
        else
          nil
        end
      }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.8.0.pre9 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre8 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre7 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre6 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre5 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre4 lib/graphql/introspection/type_by_name_field.rb
graphql-1.8.0.pre3 lib/graphql/introspection/type_by_name_field.rb