Class: GraphqlRails::Router::SchemaBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_rails/router/schema_builder.rb

Overview

builds GraphQL::Schema based on previously defined grahiti data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queries:, mutations:, events:, raw_actions:, group: nil) ⇒ SchemaBuilder

Returns a new instance of SchemaBuilder.



12
13
14
15
16
17
18
# File 'lib/graphql_rails/router/schema_builder.rb', line 12

def initialize(queries:, mutations:, events:, raw_actions:, group: nil)
  @queries = queries
  @mutations = mutations
  @events = events
  @raw_actions = raw_actions
  @group = group
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



10
11
12
# File 'lib/graphql_rails/router/schema_builder.rb', line 10

def events
  @events
end

#mutationsObject (readonly)

Returns the value of attribute mutations.



10
11
12
# File 'lib/graphql_rails/router/schema_builder.rb', line 10

def mutations
  @mutations
end

#queriesObject (readonly)

Returns the value of attribute queries.



10
11
12
# File 'lib/graphql_rails/router/schema_builder.rb', line 10

def queries
  @queries
end

#raw_actionsObject (readonly)

Returns the value of attribute raw_actions.



10
11
12
# File 'lib/graphql_rails/router/schema_builder.rb', line 10

def raw_actions
  @raw_actions
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
# File 'lib/graphql_rails/router/schema_builder.rb', line 20

def call
  query_type = build_group_type('Query', queries)
  mutation_type = build_group_type('Mutation', mutations)
  subscription_type = build_group_type('Subscription', events)

  define_schema_class(query_type, mutation_type, subscription_type, raw_actions)
end