class GraphQL::Schema::Printer
def print_schema_definition
def print_schema_definition if (schema.query.nil? || schema.query.name == 'Query') && (schema.mutation.nil? || schema.mutation.name == 'Mutation') && (schema.subscription.nil? || schema.subscription.name == 'Subscription') return end operations = [:query, :mutation, :subscription].map do |operation_type| object_type = schema.public_send(operation_type) # Special treatment for the introspection schema, which prints `{ query: "Root" }` if object_type && (warden.get_type(object_type.name) || (object_type.name == "Root" && schema.query == object_type)) " #{operation_type}: #{object_type.name}\n" else nil end end.compact.join "schema {\n#{operations}}" end