AbsintheConstraints (absinthe_constraints v0.3.0)

Adds the @constraints directive to your Absinthe schema.

Usage

defmodule MyAppWeb.Schema do
  use Absinthe.Schema
  use AbsintheConstraints

  # ...
end

This imports the @constraints directive declaration into your schema. The declaration is then included in mix absinthe.schema.sdl output, so the generated SDL is valid GraphQL that downstream tooling can parse.

Constraint validation still runs as a document phase that has to be added to your Absinthe pipeline; see AbsintheConstraints.Phase.add_to_pipeline/2.