lib/graphql/schema/field.rb
def resolve(object, args, ctx)
        if @resolve_proc
          raise "Can't run resolve proc for #{path} when using GraphQL::Execution::Interpreter"
        end
        begin
          # Unwrap the GraphQL object to get the application object.
          application_object = object.object
          ctx.schema.after_lazy(self.authorized?(application_object, args, ctx)) do |is_authorized|
            if is_authorized
              public_send_field(object, args, ctx)
            else
              err = GraphQL::UnauthorizedFieldError.new(object: application_object, type: object.class, context: ctx, field: self)
              ctx.schema.unauthorized_field(err)
            end
          end
        rescue GraphQL::UnauthorizedFieldError => err
          err.field ||= self
          ctx.schema.unauthorized_field(err)
        rescue GraphQL::UnauthorizedError => err
          ctx.schema.unauthorized_object(err)
        end
      rescue GraphQL::ExecutionError => err
        err
      end
# This method is called by the interpreter for each field.
# You can extend it in your base field classes.
# @param object [GraphQL::Schema::Object] An instance of some type class, wrapping an application object
# @param args [Hash] A symbol-keyed hash of Ruby keyword arguments. (Empty if no args)
# @param ctx [GraphQL::Query::Context]
This method is called by the interpreter for each field.
You can extend it in your base field classes.
This method is called by the interpreter for each field . You can extend it in your base field classes .
def resolve(object, args, ctx)
        if @resolve_proc
          raise "Can't run resolve proc for #{path} when using GraphQL::Execution::Interpreter"
        end
        begin
          application_object = object.object
          ctx.schema.after_lazy(self.authorized?(application_object, args, ctx)) do |is_authorized|
            if is_authorized
              public_send_field(object, args, ctx)
            else
              err = GraphQL::UnauthorizedFieldError.new(object: application_object, type: object.class, context: ctx, field: self)
              ctx.schema.unauthorized_field(err)
            end
          end
        rescue GraphQL::UnauthorizedFieldError => err
          err.field ||= self
          ctx.schema.unauthorized_field(err)
        rescue GraphQL::UnauthorizedError => err
          ctx.schema.unauthorized_object(err)
        end
      rescue GraphQL::ExecutionError => err
        err
      end
def resolve ( object , args , ctx ) if @resolve_proc raise "Can't run resolve proc for #{path} when using GraphQL::Execution::Interpreter" end begin application_object = object . object ctx . schema . after_lazy ( self . authorized? ( application_object , args , ctx ) ) do | is_authorized | if is_authorized public_send_field ( object , args , ctx ) else err = GraphQL :: UnauthorizedFieldError . new ( object : application_object , type : object . class , context : ctx , field : self ) ctx . schema . unauthorized_field ( err ) end end rescue GraphQL :: UnauthorizedFieldError => err err . field ||= self ctx . schema . unauthorized_field ( err ) rescue GraphQL :: UnauthorizedError => err ctx . schema . unauthorized_object ( err ) end rescue GraphQL :: ExecutionError => err err end
This method is called by the interpreter for each field.
This method is called by the interpreter for each field .
# Unwrap the GraphQL object to get the application object.
object
An instance of some type class, wrapping an application object
An instance of some type class wrapping an application object
args
A symbol-keyed hash of Ruby keyword arguments. (Empty if no args)
A symbol - keyed hash of Ruby keyword arguments . ( Empty if no args )
ctx
None