A program-owned description of one optimizable component.
Components pair a persisted, JSON-safe Imp.Optimizer.Parameter with the
trusted runtime contract that gives the value meaning. Descriptions,
constraints, and dependencies come from the fresh program, not from an
optimizer artifact, so loading an artifact cannot weaken validation or gain
executable authority.
The supported constraint vocabulary is deliberately small and executable:
type, enum, minimum, maximum, minLength, maxLength, minItems,
maxItems, and pattern. Unknown constraints are rejected rather than
displayed as if Imp enforced them.
Summary
Functions
Returns a JSON-safe public description without executable callbacks.
Returns the component's stable parameter ID.
Builds and validates a described component around a parameter.
Validates a proposed JSON value against the component's enforced constraints.
Types
@type t() :: %Imp.Optimizer.Component{ constraints: %{optional(String.t()) => Imp.Optimizer.Parameter.json_value()}, dependencies: [String.t()], description: String.t(), parameter: Imp.Optimizer.Parameter.t() }
Functions
Returns a JSON-safe public description without executable callbacks.
Returns the component's stable parameter ID.
@spec new(Imp.Optimizer.Parameter.t(), keyword()) :: t()
Builds and validates a described component around a parameter.
@spec validate_value!(t(), Imp.Optimizer.Parameter.json_value()) :: :ok
@spec validate_value!(Imp.Optimizer.Parameter.json_value(), map()) :: :ok
Validates a proposed JSON value against the component's enforced constraints.