lib/graphql/schema/printer.rb in graphql-2.0.31 vs lib/graphql/schema/printer.rb in graphql-2.1.0

- old
+ new

@@ -34,19 +34,15 @@ class Printer < GraphQL::Language::Printer attr_reader :schema, :warden # @param schema [GraphQL::Schema] # @param context [Hash] - # @param only [<#call(member, ctx)>] - # @param except [<#call(member, ctx)>] # @param introspection [Boolean] Should include the introspection types in the string? - def initialize(schema, context: nil, only: nil, except: nil, introspection: false) + def initialize(schema, context: nil, introspection: false) @document_from_schema = GraphQL::Language::DocumentFromSchemaDefinition.new( schema, context: context, - only: only, - except: except, include_introspection_types: introspection, ) @document = @document_from_schema.document @schema = schema @@ -59,11 +55,16 @@ field :throwaway_field, String def self.visible?(ctx) false end end - schema = Class.new(GraphQL::Schema) { query(query_root) } + schema = Class.new(GraphQL::Schema) { + query(query_root) + def self.visible?(member, _ctx) + member.graphql_name != "Root" + end + } introspection_schema_ast = GraphQL::Language::DocumentFromSchemaDefinition.new( schema, include_introspection_types: true, include_built_in_directives: true, @@ -92,10 +93,10 @@ print(node) end class IntrospectionPrinter < GraphQL::Language::Printer def print_schema_definition(schema) - "schema {\n query: Root\n}" + print_string("schema {\n query: Root\n}") end end end end end