ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class FailureCollector: (source)

View In Hierarchy

Collect and organize validation failures by field path.

Async Class Method _blame Collect local and nested failures for a rejected field value.
Async Class Method _blameCollection Collect conversion and rule failures independently for each child.
Async Class Method _collect Convert declared fields and accumulate their validation failures.
Async Class Method _enforce Run nested and field rules over type-compatible values.
Class Method _matchingType Select a nested annotation matching the value's shape and schema tag.
Async Class Method _recover Recover a type-compatible value and collect its validation failures.
Async Class Method collect Collect conversion, constraint and rule failures from a rejected payload.
Static Method _constraints Collect independent constraint failures with their declared codes.
Static Method _matchingSchema Match a schema's object or array representation and optional tag.
Class Variable __slots__ Prevent per-instance dictionaries; the class is used statically.
async def _blame(cls, error: msgspec.ValidationError, value: object, nested: object | None, root: type, path: str) -> list[ValidationFailure]: (source)

Collect local and nested failures for a rejected field value.

Parameters
error:msgspec.ValidationErrorError raised while converting the field value.
value:objectRejected field value.
nested:object | NoneAnnotation declared by the field being converted.
root:typeRoot schema class, used to resolve custom messages by path.
path:strDotted path of the field relative to the root schema.
Returns
list[orionis.schemas.entities.failure.ValidationFailure]Constraint and child failures, or the parsed original error.
async def _blameCollection(cls, error: msgspec.ValidationError, value: object, annotation: object, root: type, path: str) -> list[ValidationFailure]: (source)

Collect conversion and rule failures independently for each child.

Parameters
error:msgspec.ValidationErrorError raised by converting the entire collection.
value:objectCollection selected by _matchingType.
annotation:objectConcrete collection annotation.
root:typeRoot schema used to resolve custom messages.
path:strFully qualified collection path.
Returns
list[orionis.schemas.entities.failure.ValidationFailure]Collection-level failures and failures from every child.
async def _collect(cls, payload: Mapping | list | tuple, schema: type, root: type, base: str, failures: list[ValidationFailure]) -> bool: (source)

Convert declared fields and accumulate their validation failures.

Parameters
payload:collections.abc.Mapping | list | tupleField mapping or positional data for an array-like schema.
schema:typeSchema class owning the fields being converted.
root:typeRoot schema class, used to resolve custom messages by path.
base:strDotted path of payload relative to the root schema.
failures:list[orionis.schemas.entities.failure.ValidationFailure]Accumulator receiving every failure found.
Returns
boolWhether a declared field explains the original conversion error.
async def _enforce(cls, pending: list[tuple[str, object, tuple, object | None]], converted_values: dict[str, object], failures: list[ValidationFailure]): (source)

Run nested and field rules over type-compatible values.

Supply converted sibling values through a namespace because the failed whole-payload conversion produced no schema instance.

Parameters
pending:list[tuple[str, object, tuple, object | None]]Entries of (path, value, rules, nested_annotation) to check.
converted_values:dict[str, object]Type-compatible values, including defaults, keyed by attribute name.
failures:list[orionis.schemas.entities.failure.ValidationFailure]Accumulator receiving every failure found.
Returns
NoneNo return value.
def _matchingType(cls, annotation: object, value: object) -> object | None: (source)

Select a nested annotation matching the value's shape and schema tag.

Parameters
annotation:objectField or element annotation, possibly annotated or a union.
value:objectRejected input used to match object or array-like representations.
Returns
object | NoneMatching schema or collection annotation, if one applies.
async def _recover(cls, error: msgspec.ValidationError, value: object, annotation: object, root: type, path: str) -> tuple[object, list[ValidationFailure]]: (source)

Recover a type-compatible value and collect its validation failures.

Parameters
error:msgspec.ValidationErrorError raised by the original field conversion.
value:objectRejected field value.
annotation:objectDeclared field type and metadata.
root:typeSchema used to resolve custom messages.
path:strField path relative to root.
Returns
tuple[object, list[orionis.schemas.entities.failure.ValidationFailure]]Converted value and failures, or _INVALID and failures when the value remains structurally incompatible.
async def collect(cls, payload: object, schema: type, error: msgspec.ValidationError) -> tuple[ValidationFailure, ...]: (source)

Collect conversion, constraint and rule failures from a rejected payload.

Inspect fields only after whole-payload conversion fails. Run custom rules on type-compatible values, even when their constraints fail.

Parameters
payload:objectRaw input data that failed conversion.
schema:typeSchema class the payload was converted against.
error:msgspec.ValidationErrorOriginal error raised by the whole-payload conversion.
Returns
tuple[orionis.schemas.entities.failure.ValidationFailure, ...]Every failure found, including the original parsed error when no field could be blamed for it.
def _constraints(value: object, probes: tuple, root: type, path: str) -> list[ValidationFailure]: (source)

Collect independent constraint failures with their declared codes.

Parameters
value:objectField value checked by each constraint probe.
probes:tupleEntries of (rule_code, annotation, custom_message).
root:typeSchema supplying fallback field messages.
path:strField path used to locate messages and report failures.
Returns
list[orionis.schemas.entities.failure.ValidationFailure]Local constraint failures, excluding type and child errors.
def _matchingSchema(schema: type[msgspec.Struct], value: object) -> type[msgspec.Struct] | None: (source)

Match a schema's object or array representation and optional tag.

Parameters
schema:type[msgspec.Struct]Schema class whose representation is checked.
value:objectRejected input to compare with the schema configuration.
Returns
type[msgspec.Struct] | NoneSchema when its shape and tag match, otherwise None.
__slots__: tuple = (source)

Prevent per-instance dictionaries; the class is used statically.