Grephql.Types.Enum (Grephql v0.10.1)

Copy Markdown View Source

Parameterized Ecto Type for GraphQL enum types.

Converts between GraphQL enum strings (e.g., "ACTIVE", "active") and downcased Elixir atoms (e.g., :active). Supports case-insensitive matching on cast/load — "FOO", "Foo", and "foo" all resolve to the same atom.

Usage in schema

field :role, Grephql.Types.Enum, values: ["ADMIN", "USER", "GUEST"]

Ecto calls init/1 automatically with the field options.

Summary

Types

t()

@type t() :: atom()