Belay.InputSchema (Belay v1.0.0)

Copy Markdown View Source

Insert-time input validation, declared on the worker:

use Belay.Worker,
  queue: :ai,
  input_schema: [
    url: [type: :string, required: true],
    style: [type: {:enum, ["tight", "loose"]}, default: "tight"],
    limit: [type: :integer]
  ]

Validation runs when the job is built, so bad inputs raise Belay.InputError at the call site instead of failing on attempt one. Defaults are written into the stored input. Keys are strings in the stored input (they round-trip through JSON); unknown keys pass through untouched.

Types: :string, :integer, :float (integers accepted), :boolean, :map, :list, {:enum, values}.