Sha256: 583bbd078f4ba32645a8352e85941b8d5dbdef11a4b12e178295012a1848e50d

Contents?: true

Size: 486 Bytes

Versions: 8

Compression:

Stored size: 486 Bytes

Contents

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.2.6 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.5 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.4 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.3 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.2 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.1 lib/graphql/introspection/type_by_name_field.rb
graphql-1.2.0 lib/graphql/introspection/type_by_name_field.rb
graphql-1.1.0 lib/graphql/introspection/type_by_name_field.rb