class GraphQL::Context

Defined in:

graphql/context.cr

Instance Method Summary

Instance Method Detail

def complexity : Int32 #

Number of fields the executed operation selected, filled in by Schema#execute before resolution starts.


def complexity=(complexity : Int32) #

Number of fields the executed operation selected, filled in by Schema#execute before resolution starts.


def document : Language::Document | Nil #

def document=(document : Language::Document | Nil) #

def fragments : Array(Language::FragmentDefinition) #

def fragments=(fragments : Array(Language::FragmentDefinition)) #

def handle_exception(ex : ::Exception) : String | Nil #

Return string message to be added to errors object or throw to bubble up


def in_flight : Int32 #

Number of resolver fibers spawned by this execution that have not yet finished.


def max_complexity : Int32 | Nil #

Maximum number of fields a single operation may select, counted statically across the whole selection tree with fragments expanded. nil (the default) disables the check. An operation that exceeds the limit is rejected before any resolver runs.


def max_complexity=(max_complexity : Int32 | Nil) #

Maximum number of fields a single operation may select, counted statically across the whole selection tree with fragments expanded. nil (the default) disables the check. An operation that exceeds the limit is rejected before any resolver runs.


def max_concurrency : Int32 #

Maximum number of fibers this execution may spawn at once to resolve fields and array elements concurrently.

0 (the default) resolves everything sequentially in the calling fiber. Any higher value lets up to that many resolvers run concurrently; once the budget is used up, further work runs inline in the fiber that requested it, so nesting can never deadlock and a single query can never fan out into an unbounded number of fibers.

Pick a value that your downstream resources can sustain. For example, resolvers that check out database connections should stay below the connection pool size.


def max_concurrency=(max_concurrency : Int32) #

Maximum number of fibers this execution may spawn at once to resolve fields and array elements concurrently.

0 (the default) resolves everything sequentially in the calling fiber. Any higher value lets up to that many resolvers run concurrently; once the budget is used up, further work runs inline in the fiber that requested it, so nesting can never deadlock and a single query can never fan out into an unbounded number of fibers.

Pick a value that your downstream resources can sustain. For example, resolvers that check out database connections should stay below the connection pool size.


def max_depth : Int32 #

Maximum nesting of selection sets, lists and input objects a query may have. Parsing stops with an error beyond it. The default of 100 is far above what real queries use, and protects the process: nesting a few thousand levels deep would otherwise overflow the stack.


def max_depth=(max_depth : Int32) #

Maximum nesting of selection sets, lists and input objects a query may have. Parsing stops with an error beyond it. The default of 100 is far above what real queries use, and protects the process: nesting a few thousand levels deep would otherwise overflow the stack.


def mutation_type : String | Nil #

def mutation_type=(mutation_type : String | Nil) #

def query_type : String #

def query_type=(query_type : String) #

def subscription_type : String | Nil #

def subscription_type=(subscription_type : String | Nil) #