absinthe v1.3.0-beta.0 Absinthe.Resolution

The primary struct of resolution.

In many ways like the %Conn{} from Plug, the %Absinthe.Resolution{} is the piece of information that passed along from middleware to middleware as part of resolution.

Summary

Types

t()

Information about the current resolution

Types

field_state()
field_state() :: :unresolved | :resolved | :suspended
t()
t() :: %Absinthe.Resolution{acc: %{optional(any) => any}, adapter: Absinthe.Adapter.t, arguments: term, context: map, definition: Blueprint.node_t, errors: [term], middleware: term, parent_type: Type.t, private: term, root_value: any, schema: Schema.t, source: any, state: field_state, value: term}

Information about the current resolution.

Contents

  • :adapter - The adapter used for any name conversions.
  • :definition - The Blueprint definition for this field.
  • :context - The context passed to Absinthe.run.
  • :root_value - The root value passed to Absinthe.run, if any.
  • :parent_type - The parent type for the field.
  • :schema - The current schema.
  • :source - The resolved parent object; source of this field.

To access the schema type for this field, see the definition.schema_node.

Functions

call(res, resolution_function)
call(function, args, info)
call(resolution_function, parent, args, field_info)

TODO: Deprecate

put_result(res, result)

Handy function for applying user function result tuples to a resolution struct

User facing functions generally return one of several tuples like {:ok, val} or {:error, reason}. This function handles applying those various tuples to the resolution struct.

The resolution state is updated depending on the tuple returned. :ok and :error tuples set the state to :resolved, whereas middleware tuples set it to :unresolved.

This is useful for middleware that wants to handle user facing functions, but does not want to duplicate this logic.

resolver_spec(fun)
result_error(value, field, source, guess)