Absinthe.Phoenix.Controller.cast_param

You're seeing just the callback cast_param, go back to Absinthe.Phoenix.Controller module for more information.
Link to this callback

cast_param(value, target_type, schema)

View Source

Specs

cast_param(
  value :: any(),
  target_type :: Absinthe.Type.t(),
  schema :: Absinthe.Schema.t()
) :: any()

Cast string param values to values Absinthe expects for variable input.

Some scalar types, like :integer (GraphQL Int) require that raw, incoming value be a non-string type. This isn't a problem in GraphQL-over-HTTP because the variable values are provided as a JSON payload (which supports, i.e., integer values).

To support converting incoming param values to the format that certain scalars expect, we support a cast_param/3 callback function that takes a raw value, target type (e.g., the scalar type), and the schema, and returns the transformed value. cast_param/3 is overridable and the implementation already supports :integer and :float types.

If you override cast_param/3, make sure you super or handle lists, non-nulls, and input object values yourself; they're also processed using the function.

Important: In the event that a value is invalid, just return it unchanged so that Absinthe's usual validation logic can report it as invalid.