Class: Decidim::Api::Schema

Inherits:
GraphQL::Schema
  • Object
show all
Defined in:
lib/decidim/api/schema.rb

Overview

Main GraphQL schema for decidim’s API.

Class Method Summary collapse

Class Method Details

.unauthorized_field(error) ⇒ Object



25
26
27
28
# File 'lib/decidim/api/schema.rb', line 25

def self.unauthorized_field(error)
  # Add a top-level error to the response instead of returning nil:
  raise Decidim::Api::Errors::UnauthorizedFieldError, I18n.t("decidim.api.errors.unauthorized_field", type: error.type.graphql_name, field: error.field.graphql_name)
end

.unauthorized_object(error) ⇒ Object



20
21
22
23
# File 'lib/decidim/api/schema.rb', line 20

def self.unauthorized_object(error)
  # Add a top-level error to the response instead of returning nil:
  raise Decidim::Api::Errors::UnauthorizedObjectError, I18n.t("decidim.api.errors.unauthorized_object", type: error.type.graphql_name)
end