AbsintheHelpers.Directives.Constraints (absinthe_helpers v0.2.8)

Defines a GraphQL directive for adding constraints to fields and arguments.

Supports:

  • :min, :max: For numbers and string lengths
  • :min_items, :max_items: For lists
  • :regex: For strings

Applicable to scalars (:string, :integer, :float, :decimal) and lists.

Example:

field :username, :string, directives: [constraints: [min: 3, max: 20, regex: "^[a-zA-Z]+$"]]
arg :tags, list_of(:string), directives: [constraints: [max_items: 5, max: 10]]

Constraints are automatically enforced during query execution.

Summary

Functions

Add a deprecation (with an optional reason) to a node.

Functions

Link to this function

expand_constraints(args, node)

Link to this function

expand_deprecate(arguments, node)

@spec expand_deprecate(
  arguments :: %{optional(:reason) => String.t()},
  node :: Absinthe.Blueprint.node_t()
) :: Absinthe.Blueprint.node_t()

Add a deprecation (with an optional reason) to a node.

Link to this function

pipeline(pipeline)