lib/rails/graphql/to_gql.rb
# Describe the given +schema+ as GraphQL, with all types and directives
Describe the given +schema+ as GraphQL, with all types and directives
Describe the given + schema + as GraphQL with all types and directives
def describe(schema, collector = nil, with_descriptions: true, with_spec: nil)
        collector ||= Collectors::IdentedCollector.new
        @with_descriptions = with_descriptions
        @with_spec = with_spec.nil? ? schema.introspection? : with_spec
        accept(schema, collector).eol
        GraphQL.type_map.each_from(schema.namespace, base_class: :Type)
          .group_by(&:kind).values_at(*DESCRIBE_TYPES)
          .each do |items|
            items&.sort_by(&:gql_name)&.each do |item|
              next if !@with_spec && item.internal?
              next visit_Rails_GraphQL_Type_Object(item, collector).eol \
                if item.is_a?(::OpenStruct) && item.object?
              accept(item, collector).eol
            end
          end
        GraphQL.type_map.each_from(schema.namespace, base_class: :Directive)
          .sort_by(&:gql_name).each do |item|
            next if !@with_spec && item.spec_object
            accept(item, collector).eol
          end
        collector.value.chomp
      end
def describe ( schema , collector = nil , with_descriptions : true , with_spec : nil ) collector ||= Collectors :: IdentedCollector . new @with_descriptions = with_descriptions @with_spec = with_spec . nil? ? schema . introspection? : with_spec accept ( schema , collector ) . eol GraphQL . type_map . each_from ( schema . namespace , base_class : :Type ) . group_by ( & :kind ) . values_at ( * DESCRIBE_TYPES ) . each do | items | items &. sort_by ( & :gql_name ) &. each do | item | next if ! @with_spec && item . internal? next visit_Rails_GraphQL_Type_Object ( item , collector ) . eol if item . is_a? ( :: OpenStruct ) && item . object? accept ( item , collector ) . eol end end GraphQL . type_map . each_from ( schema . namespace , base_class : :Directive ) . sort_by ( & :gql_name ) . each do | item | next if ! @with_spec && item . spec_object accept ( item , collector ) . eol end collector . value . chomp end
Describe the given +schema+ as GraphQL, with all types and directives
Describe the given + schema + as GraphQL with all types and directives
schema
collector
with_descriptions
with_spec