Sha256: 9cf73ee302630bb5c4e4ec03f3811611e404f990c6ab7fa2e3b17e1e5ddf3530

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true
module GraphQL
  module Introspection
    class EntryPoints < GraphQL::Schema::Object
      field :__schema, GraphQL::Schema::LateBoundType.new("__Schema"), "This GraphQL schema", null: false
      field :__type, GraphQL::Schema::LateBoundType.new("__Type"), "A type in the GraphQL system", null: true do
        argument :name, String, required: true
      end

      def __schema
        # Apply wrapping manually since this field isn't wrapped by instrumentation
        schema = @context.query.schema
        schema_type = schema.introspection_system.schema_type
        schema_type.metadata[:object_class].new(schema, @context)
      end

      def __type(name:)
        type = @context.warden.get_type(name)
        if type
          # Apply wrapping manually since this field isn't wrapped by instrumentation
          type_type = @context.schema.introspection_system.type_type
          type_type.metadata[:object_class].new(type, @context)
        else
          nil
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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