Class: Capsium::Reactor::GraphqlSchema
- Inherits:
-
Object
- Object
- Capsium::Reactor::GraphqlSchema
- Defined in:
- lib/capsium/reactor/graphql_schema.rb,
sig/capsium/reactor/graphql_schema.rbs
Overview
Builds the GraphQL schema for a mounted package: per dataset a
query field "
Defined Under Namespace
Classes: JsonScalar
Instance Method Summary collapse
- #build ⇒ singleton(GraphQL::Schema)
-
#initialize(mount, api) ⇒ GraphqlSchema
constructor
A new instance of GraphqlSchema.
Constructor Details
#initialize(mount, api) ⇒ GraphqlSchema
Returns a new instance of GraphqlSchema.
26 27 28 29 |
# File 'lib/capsium/reactor/graphql_schema.rb', line 26 def initialize(mount, api) @mount = mount @api = api end |
Instance Method Details
#build ⇒ singleton(GraphQL::Schema)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/capsium/reactor/graphql_schema.rb', line 31 def build api = @api query_type = Class.new(GraphQL::Schema::Object) { graphql_name("Query") } mutation_type = Class.new(GraphQL::Schema::Object) { graphql_name("Mutation") } @mount.package.storage.datasets.each do |dataset| next if dataset.config.sqlite? add_dataset_fields(query_type, mutation_type, dataset, api) end Class.new(GraphQL::Schema) do query(query_type) mutation(mutation_type) end end |