Validates the structure of an image-generation brief before it is passed to a rendering workflow.
The validator is provider-independent and performs no network requests.
Summary
Functions
Returns the reduced aspect ratio for valid positive integer dimensions.
Validates a brief and returns either the original brief or all detected errors.
Returns all structural errors as a keyword list.
Functions
Returns the reduced aspect ratio for valid positive integer dimensions.
iex> ImageBriefValidator.aspect_ratio(1920, 1080)
{:ok, "16:9"}
Validates a brief and returns either the original brief or all detected errors.
Examples
iex> ImageBriefValidator.validate(%{prompt: "A studio product photo", width: 1200, height: 800})
{:ok, %{prompt: "A studio product photo", width: 1200, height: 800}}
iex> ImageBriefValidator.validate(%{prompt: "", width: 0, height: 800})
{:error, [prompt: :must_be_present, width: :must_be_a_positive_integer]}
Returns all structural errors as a keyword list.
String and atom keys are both accepted. Optional style values are limited
to the documented presets, and references must be a list of non-empty
strings.