Module: Decidim::Api

Defined in:
lib/decidim/api.rb,
lib/decidim/api/engine.rb,
lib/decidim/api/schema.rb,
lib/decidim/api/query_type.rb,
lib/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 module holds all business logic related to exposing a Public API for decidim.

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

  resolve_type lambda { |_type, obj, _ctx|
    return Decidim::UserType if obj.is_a? Decidim::User
    return Decidim::UserGroupType if obj.is_a? Decidim::UserGroup
  }
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