Lux.SignalSchema behaviour (Lux v0.5.0)
View SourceDefines the behavior and macros for creating Signal schemas.
Signal schemas define the structure and validation rules for Signal content. They are used to ensure that Signals conform to expected formats and can be properly processed by agents and workflows.
Summary
Functions
Defines a new Signal schema.
Creates a new schema struct from the given attributes.
Recursively converts all map keys to strings in a schema definition.
Types
@type compatibility() :: :full | :backward | :forward | :none
@type format() :: :json | :yaml | :binary | :text
@type status() :: :draft | :active | :deprecated | :retired
@type t() :: %Lux.SignalSchema{ compatibility: compatibility(), created_at: DateTime.t(), created_by: String.t(), description: String.t() | nil, format: format(), id: String.t(), name: String.t(), reference: String.t() | nil, schema: map(), status: status(), tags: [String.t()], version: String.t() }
Callbacks
@callback validate(map(), any()) :: {:ok, Lux.Signal.t()} | {:error, any()}
Functions
Defines a new Signal schema.
Options
:name
- The name of the schema. Defaults to the module name if not provided.:version
- The schema version. Defaults to "1.0.0".:schema
- Required. The JSON Schema definition for the Signal content.:description
- Optional description of the schema.:tags
- Optional list of tags for categorization.:compatibility
- Schema compatibility level (:full, :backward, :forward, :none).:status
- Schema status (:draft, :active, :deprecated, :retired).:format
- Data format (:json, :yaml, :binary, :text).:reference
- Optional reference to external schema documentation.
Creates a new schema struct from the given attributes.
Recursively converts all map keys to strings in a schema definition.