Module: GraphQL::Schema::Printer

Extended by:
Printer
Included in:
Printer
Defined in:
lib/graphql/schema/printer.rb

Overview

Used to convert your GraphQL::Schema to a GraphQL schema string

Examples:

print your schema to standard output

MySchema = GraphQL::Schema.define(query: QueryType)
puts GraphQL::Schema::Printer.print_schema(MySchema)

Instance Method Summary collapse

Instance Method Details

Return the GraphQL schema string for the introspection type system



19
20
21
22
23
24
25
# File 'lib/graphql/schema/printer.rb', line 19

def print_introspection_schema
  query_root = ObjectType.define do
    name "Query"
  end
  schema = GraphQL::Schema.define(query: query_root)
  print_filtered_schema(schema, method(:is_introspection_type))
end

Return a GraphQL schema string for the defined types in the schema

Parameters:



14
15
16
# File 'lib/graphql/schema/printer.rb', line 14

def print_schema(schema)
  print_filtered_schema(schema, method(:is_defined_type))
end