Add graphql root types

This commit is contained in:
Paul Chavard 2018-11-19 21:06:13 +01:00
parent 52e84f2ffe
commit e06051bc96
3 changed files with 34 additions and 0 deletions

View file

@ -3,6 +3,9 @@ class Api::V2::Schema < GraphQL::Schema
max_complexity 300
max_depth 15
query Types::QueryType
mutation Types::MutationType
def self.unauthorized_object(error)
# Add a top-level error to the response instead of returning nil:
raise GraphQL::ExecutionError.new("An object of type #{error.type.graphql_name} was hidden due to permissions", extensions: { code: :unauthorized })