Pipeline.Validation.SchemaValidator (pipeline v0.0.1)
View SourceJSON Schema-based validation for pipeline step outputs.
Provides comprehensive validation of step outputs against JSON schemas, ensuring structured data exchange between pipeline steps.
Summary
Functions
Get supported JSON Schema types.
Check if a schema is valid JSON Schema format.
Validate data against a JSON schema.
Validate step output with detailed error reporting.
Types
@type schema() :: map()
@type validation_errors() :: [validation_error()]
@type validation_result() :: {:ok, any()} | {:error, validation_errors()}
Functions
@spec supported_types() :: [String.t()]
Get supported JSON Schema types.
Check if a schema is valid JSON Schema format.
@spec validate(any(), schema()) :: validation_result()
Validate data against a JSON schema.
Examples
iex> schema = %{"type" => "object", "required" => ["name"], "properties" => %{"name" => %{"type" => "string"}}}
iex> data = %{"name" => "test"}
iex> Pipeline.Validation.SchemaValidator.validate(data, schema)
{:ok, %{"name" => "test"}}
iex> data = %{"age" => 25}
iex> Pipeline.Validation.SchemaValidator.validate(data, schema)
{:error, [%{path: "", message: "Required property 'name' is missing", value: %{"age" => 25}, schema: schema}]}
@spec validate_step_output(String.t(), any(), schema()) :: {:ok, any()} | {:error, String.t(), validation_errors()}
Validate step output with detailed error reporting.
Returns a structured result with validation status and detailed error information.