vibe.validation_types

Static Analysis Validation Types (Flask-Independent).

Defines the ValidatedValue class hierarchy used exclusively during static template analysis (static_check_template). These objects wrap placeholder values and enforce type constraints and operator validity within Jinja expressions during the check. Includes ValidationError.

TrackingDict

A dictionary subclass that tracks which keys have been accessed.

via getitem.

get

get(key: str, default: object | None = None) -> object

Get with access tracking: returns default if key not present without recording access.

accessed_keys

accessed_keys() -> set[str]

Return a copy of the set of keys accessed since the last reset.

reset

reset() -> None

Clear the set of accessed keys.

ValidationError

Custom exception for validation failures.

__init__

__init__(message: str, issues: list[ValidationIssue] | None = None) -> None

Initialize the ValidationError.

Parameters:
  • message (str) –

    The primary error message string for standard display.

  • issues (list[ValidationIssue] | None, default: None ) –

    A list of detailed ValidationIssue objects.

ValidatedValue

Base class for values used in template validation.

ValidatedAmount

Validation wrapper for amount/currency types.

ValidatedString

Validation wrapper for string values.

ValidatedNumber

Validation wrapper for numeric values.

ValidatedBool

Validation wrapper for boolean values.

ValidatedTristate

Validated value for tristate (yes/no/don't know) fields.

Tristate fields have three valid states: True, False, and None. Templates should use explicit comparisons like '{% if field is true %}' instead of truthiness checks like '{% if field %}' to distinguish between False and None.

ValidatedEnum

Validation wrapper for enum values.

ValidatedMultiChoice

Validation wrapper for multichoice values.

ValidatedItem

Represents a single item within a ValidatedList during static checking.

Uses TrackingDict to capture access to sub-fields. The values it holds should be other ValidatedValue instances.

ValidatedList

Validation wrapper for list types. Used during static template checking.

Handles iteration and ensures items conform to the itemdef structure.

ValidatedMessage

Validation wrapper for message types (note, warning, error).

ValidatedDate

Validation wrapper for date types.

SafeNumeric

A wrapper for numeric values that handles invalid comparisons gracefully.

ValidatedPeriod

Validation wrapper for period types.

display

display: str

Returns a developer-friendly, non-localized string representation.

for use in static analysis and debugging.

ValidatedStruct

Validation wrapper for structured types using definition references.