Skip to content

Graph validation

validation

Validation helpers for graph-based simulator configs.

Classes

NodeSummary dataclass

NodeSummary(name: str, function: str, parameters: tuple[str, ...], output_keys: tuple[str, ...])

Human-readable summary of a validated config node.

ValidationIssue dataclass

ValidationIssue(message: str, node_name: str | None = None, field_name: str | None = None)

Single validation issue.

Functions
render
render() -> str

Render a human-readable validation message.

ConfigValidationError

ConfigValidationError(issues: tuple[ValidationIssue, ...] | list[ValidationIssue])

Bases: ValueError

Raised when a graph config file fails schema or static validation.

Initialize the exception with all collected validation issues.

ValidationReport dataclass

ValidationReport(summaries: tuple[NodeSummary, ...], issues: tuple[ValidationIssue, ...])

Structured result of validating a graph config.

Attributes
is_valid property
is_valid: bool

Return whether the config passed validation.

Functions

load_parameters_config

load_parameters_config(config_path: str | Path, encoding: str = 'utf-8') -> dict[str, Any]

Load and normalize a graph config file.

load_validated_parameters_config

load_validated_parameters_config(config_path: str | Path, encoding: str = 'utf-8') -> tuple[dict[str, Any], ValidationReport]

Load, schema-validate, and statically validate a graph config file.

validate_graph_config_file

validate_graph_config_file(config_path: str | Path, encoding: str = 'utf-8') -> ValidationReport

Validate a graph config file without executing any sampling.

validate_graph_config

validate_graph_config(config: dict[str, Any]) -> ValidationReport

Validate a graph config mapping without executing any nodes.

render_validation_summary

render_validation_summary(summaries: tuple[NodeSummary, ...] | list[NodeSummary]) -> str

Render a plain-text table summarizing validated nodes.