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

Undocumented

Class Method _blame Describe every failure behind a single rejected field value.
Async Class Method _blameAsync Describe a rejected value, awaiting valid fields of nested schemas.
Class Method _collect Convert each declared field of a mapping and accumulate its failures.
Async Class Method _collectAsync Convert fields before awaiting rules that inspect their valid siblings.
Class Method _enforce Run custom rules over the field values that converted successfully.
Class Method collect Collect every conversion and rule failure contained in a payload.
Async Class Method collectAsync Collect conversion failures together with asynchronous rule failures.
Async Static Method _enforceAsync Await custom rules only for fields that converted successfully.
Class Variable __slots__ Undocumented
def _blame(cls, error: msgspec.ValidationError, value: object, nested: type | None, root: type, path: str) -> list[ValidationFailure]: (source)

Describe every failure behind a single rejected field value.

Parameters
error:msgspec.ValidationErrorError raised while converting the field value.
value:objectRejected field value.
nested:type | NoneSchema declared by the field, when it holds a nested schema.
root:typeRoot schema class, used to resolve custom messages by path.
path:strDotted path of the field relative to the root schema.
Returns
list[ValidationFailure]Failures of the nested schema, or a single parsed failure.
async def _blameAsync(cls, error: msgspec.ValidationError, value: object, nested: type | None, root: type, path: str) -> list[ValidationFailure]: (source)

Describe a rejected value, awaiting valid fields of nested schemas.

Parameters
error:msgspec.ValidationErrorError raised by the field conversion.
value:objectRejected input value.
nested:type | NoneNested schema declared for the field.
root:typeRoot schema used to resolve error messages.
path:strFully qualified field path.
Returns
list[ValidationFailure]Nested failures or the parsed field conversion error.
def _collect(cls, payload: Mapping, schema: type, root: type, base: str, failures: list[ValidationFailure]) -> bool: (source)

Convert each declared field of a mapping and accumulate its failures.

Parameters
payload:MappingMapping holding the values for 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[ValidationFailure]Accumulator receiving every failure found.
Returns
boolReturn True when at least one declared field was blamed for a conversion error, so the original error needs no separate report.
async def _collectAsync(cls, payload: Mapping, schema: type, root: type, base: str, failures: list[ValidationFailure]) -> bool: (source)

Convert fields before awaiting rules that inspect their valid siblings.

Parameters
payload:MappingValues supplied for the current schema.
schema:typeSchema whose fields are being converted.
root:typeRoot schema used to resolve custom error messages.
base:strDot-terminated path prefix.
failures:list[ValidationFailure]Accumulator for conversion and rule failures.
Returns
boolWhether a declared field explains the original conversion failure.
def _enforce(cls, pending: list[tuple[str, object, tuple, type | None]], converted_values: dict[str, object], failures: list[ValidationFailure]): (source)

Run custom rules over the field values that converted successfully.

Type errors abort the whole-payload conversion, so no schema instance exists on this path. Rules receive a namespace holding only the fields that converted cleanly, which keeps cross-field rules usable while still reporting type and rule failures together.

Parameters
pending:list[tuple[str, object, tuple, type | None]]Entries of (path, value, rules, nested_schema) to check.
converted_values:dict[str, object]Successfully converted values, keyed by encoded field name.
failures:list[ValidationFailure]Accumulator receiving every failure found.
Returns
NoneReturn None after running every pending rule.
def collect(cls, payload: object, schema: type, error: msgspec.ValidationError) -> tuple[ValidationFailure, ...]: (source)

Collect every conversion and rule failure contained in a payload.

msgspec stops at the first offending value, so the payload is re-converted field by field to report all of them at once. Fields that convert cleanly still run their custom rules, so type and rule errors are reported together. This runs only after a whole-payload conversion has already failed, keeping the successful path at full msgspec speed.

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[ValidationFailure, ...]Every failure found, including the original parsed error when no field could be blamed for it.
async def collectAsync(cls, payload: object, schema: type, error: msgspec.ValidationError) -> tuple[ValidationFailure, ...]: (source)

Collect conversion failures together with asynchronous rule failures.

Parameters
payload:objectRaw input rejected by whole-object conversion.
schema:typeTarget schema class.
error:msgspec.ValidationErrorOriginal conversion failure.
Returns
tuple[ValidationFailure, ...]Conversion and rule failures in the same order as synchronous checks.
async def _enforceAsync(pending: list[tuple[str, object, tuple, type | None]], converted_values: dict[str, object], failures: list[ValidationFailure]): (source)

Await custom rules only for fields that converted successfully.

Parameters
pending:list[tuple[str, object, tuple, type | None]]Qualified paths, values, rules and nested schema declarations.
converted_values:dict[str, object]Valid field values available to cross-field rules.
failures:list[ValidationFailure]Accumulator for rule failures.
Returns
NoneEvery applicable rule has completed in declaration order.
__slots__: tuple = (source)

Undocumented