Skip to content

Instantly share code, notes, and snippets.

@jenny-codes
Last active March 19, 2019 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenny-codes/0e340f08454ec233bb9a2411d7c44e35 to your computer and use it in GitHub Desktop.
Save jenny-codes/0e340f08454ec233bb9a2411d7c44e35 to your computer and use it in GitHub Desktop.
class HiSchema < GraphQL::Schema
# default limits
max_depth 10
max_complexity 300
# root types
query Types::Query # required
mutation Types::Mutation # optional
subscription Types::Subscription # optional
# plugins
use GraphQL::Batch
use GraphQL::Tracing::NewRelicTracing
# Define hooks as class methods:
def self.resolve_type(type, obj, ctx)
# ...
end
def self.object_from_id(node_id, ctx)
# ...
end
def self.id_from_object(object, type, ctx)
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment