Module: Decidim::Api
- Defined in:
- lib/decidim/api.rb,
lib/decidim/api/engine.rb,
lib/decidim/api/version.rb,
app/types/decidim/api/schema.rb,
app/types/decidim/api/query_type.rb,
app/types/decidim/api/mutation_type.rb,
app/controllers/decidim/api/queries_controller.rb,
app/controllers/decidim/api/application_controller.rb,
app/controllers/decidim/api/documentation_controller.rb
Overview
This holds the decidim-api version.
Defined Under Namespace
Classes: ApplicationController, DocumentationController, Engine, QueriesController
Constant Summary collapse
- Schema =
Main GraphQL schema for decidim’s API.
GraphQL::Schema.define do query QueryType mutation MutationType default_max_page_size 50 max_depth 10 max_complexity 300 orphan_types(Api.orphan_types) resolve_type ->(_type, _obj, _ctx) {} end
- QueryType =
This type represents the root query type of the whole API.
GraphQL::ObjectType.define do name "Query" description "The root query of this schema" end
- MutationType =
This type represents the root mutation type of the whole API
GraphQL::ObjectType.define do name "Mutation" description "The root mutation of this schema" end
Class Method Summary collapse
- .add_orphan_type(type) ⇒ Object
-
.orphan_types ⇒ Object
This declares all the types an interface or union can resolve to.
- .version ⇒ Object
Class Method Details
.add_orphan_type(type) ⇒ Object
19 20 21 22 |
# File 'lib/decidim/api.rb', line 19 def self.add_orphan_type(type) @orphan_types ||= [] @orphan_types += [type] end |
.orphan_types ⇒ Object
This declares all the types an interface or union can resolve to. This needs to be done in order to be able to have them found. This is a shortcoming of graphql-ruby and the way it deals with loading types, in combination with rail’s infamous autoloading.
13 14 15 16 17 |
# File 'lib/decidim/api.rb', line 13 def self.orphan_types Decidim.component_manifests.map(&:query_type).map(&:constantize).uniq + Decidim.participatory_space_manifests.map(&:query_type).map(&:constantize).uniq + (@orphan_types || []) end |
.version ⇒ Object
6 7 8 |
# File 'lib/decidim/api/version.rb', line 6 def self.version "0.14.3" end |