Diagnostics⚓︎
diagnostics
⚓︎
Immutable diagnostics and non-raising validation results.
Diagnostic Model v1 is shared by runtime parsing, static checking, the CLI,
and integrations. Exception classes in :mod:talika.errors are compatibility
adapters around these values rather than a second diagnostic representation.
TalikaWarning
⚓︎
TalikaWarning(diagnostic: Diagnostic)
Bases: UserWarning
Expose one structured Talika diagnostic through Python warnings.
Raising parse APIs return their normal records or output models when
validation reports warning-severity diagnostics. Each diagnostic is also
emitted as TalikaWarning so callers may display, filter, or assert it
with the standard :mod:warnings tools.
Attributes:
-
diagnostic–Immutable warning-severity diagnostic produced by Talika.
Parameters:
-
diagnostic(Diagnostic) –Structured diagnostic to expose as a Python warning.
Raises:
-
ValueError–If the diagnostic does not have warning severity.
Example
Diagnostic
dataclass
⚓︎
Diagnostic(
*,
code: str,
message: str,
severity: DiagnosticSeverity | str = ERROR,
hint: str | None = None,
schema_name: str | None = None,
field_name: str | None = None,
field_label: str | None = None,
source_uri: str | None = None,
row: int | None = None,
column: int | None = None,
item_id: Any = _UNSET,
source_value: Any = _UNSET,
logical_value: Any = _UNSET,
cause: BaseException | None = None,
)
One immutable, source-aware Diagnostic Model v1 value.
has_item_id
property
⚓︎
has_item_id: bool
Return whether the diagnostic explicitly carries an item ID.
source_value
property
⚓︎
source_value: Any | None
Return the original source value, or None when omitted.
has_source_value
property
⚓︎
has_source_value: bool
Return whether an original source value is present.
logical_value
property
⚓︎
logical_value: Any | None
Return the logical/transformed value, or None when omitted.
ValidationResult
dataclass
⚓︎
ValidationResult(
records: tuple[T, ...] = (), diagnostics: tuple[Diagnostic, ...] = ()
)
Bases: Generic[T]
Non-raising result returned by Schema.validate().
errors
property
⚓︎
errors: tuple[Diagnostic, ...]
Return error-severity diagnostics in discovery order.
warnings
property
⚓︎
warnings: tuple[Diagnostic, ...]
Return warning-severity diagnostics in discovery order.
stable_json_value
⚓︎
Convert an arbitrary project value into deterministic JSON data.
The conversion intentionally never falls back to an object's repr or
str implementation. Those methods may include memory addresses or
other process-specific data that would make checker output unstable.
stable_text_value
⚓︎
Return a compact deterministic value representation for text errors.