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.

module documentation

Undocumented

Function _async_validators Bind native asynchronous rule overrides once for a validation plan.
Function _build_plan Build and cache a validation plan for a schema type.
Async Function _collect_async_nested Validate a nested schema while preserving non-schema union members.
Async Function _collect_async_rules Run preclassified rule callables in declaration order.
Function _collect_nested Validate a nested schema value using its own cached plan.
Async Function _collect_with_async_plan Execute a plan containing native asynchronous rules or nested schemas.
Function _collect_with_plan Inner validation loop: execute a pre-resolved plan against an instance.
Function _field_rules Select executable rules from a field's validated metadata.
Function _type_contains_nested Check whether a type annotation contains a nested Orionis schema.
Function _type_uses_async Inspect warmed nested schemas for native asynchronous rules.
Function _warm_child_plan Eagerly populate _PLAN_CACHE for any nested Orionis schema type.
Constant _ASYNC_PLAN_CACHE Undocumented
Constant _EMPTY_META Undocumented
Constant _PLAN_CACHE Undocumented
def _async_validators(validators: tuple) -> tuple: (source)

Bind native asynchronous rule overrides once for a validation plan.

Parameters
validators:tupleSynchronous bound Rule.validate methods.
Returns
tuplePairs of bound validators and whether their result must be awaited.
def _build_plan(klass: type) -> tuple: (source)

Build and cache a validation plan for a schema type.

Parameters
klass:typeSchema class whose msgspec fields and __orionis_meta__ metadata are inspected.
Returns
tupleCached plan entries as (field_name, field_name_dot, getter, validators, is_nested) tuples. Each entry stores the field name, the precomputed dotted field prefix, an operator.attrgetter for field access, the field's bound validator callables, and whether the field contains a nested Orionis schema.
Raises
TypeErrorRaised when field metadata contains an object that is neither a Rule instance nor supported validation metadata.
async def _collect_async_nested(value: object, prefix: str, failures: list): (source)

Validate a nested schema while preserving non-schema union members.

Parameters
value:objectConverted nested value.
prefix:strDot-terminated field path.
failures:listAccumulator for validation failures.
Returns
NoneNested rules have completed, or the value required no schema traversal.
async def _collect_async_rules(validators: tuple, field: str, value: object, instance: object, failures: list): (source)

Run preclassified rule callables in declaration order.

Parameters
validators:tuplePairs of bound validators and their asynchronous flags.
field:strFully qualified field path.
value:objectConverted field value.
instance:objectSchema instance or namespace of successfully converted fields.
failures:listAccumulator for validation failures.
Returns
NoneEvery rule result has been collected without parallel database access.
def _collect_nested(value: object, prefix: str, failures: list): (source)

Validate a nested schema value using its own cached plan.

Parameters
value:objectNested schema instance held by the parent field.
prefix:strDot-terminated path prefix already qualified with the parent field.
failures:listAccumulator receiving every ValidationFailure found.
Returns
NoneReturn None after running the nested plan, if any.
async def _collect_with_async_plan(plan: tuple, instance: object, prefix: str, failures: list): (source)

Execute a plan containing native asynchronous rules or nested schemas.

Parameters
plan:tuplePrecompiled asynchronous field plan.
instance:objectConverted schema instance.
prefix:strDot-terminated prefix for nested paths.
failures:listAccumulator for all failures in declaration order.
Returns
NoneSynchronous and asynchronous rule results have been collected.
def _collect_with_plan(plan: tuple, instance: object, prefix: str, failures: list): (source)

Inner validation loop: execute a pre-resolved plan against an instance.

This function is the true hot path. It takes the plan as a parameter so that callers who already hold it (e.g. Schema.validate) skip the cache lookup and the type() call. Every failure is accumulated so the caller can report all of them at once.

Parameters
plan:tupleNon-empty plan produced by _build_plan for this instance's type.
instance:objectSchema instance to validate.
prefix:strDot-terminated path prefix for nested field names, e.g. "address." so that child fields report "address.zip". Pass "" at the top level.
failures:listAccumulator receiving every ValidationFailure found.
Returns
NoneReturn None after running every rule in the plan.
def _field_rules(klass: type, field_name: str, items: Iterable[object]) -> tuple[Rule, ...]: (source)

Select executable rules from a field's validated metadata.

Parameters
klass:typeSchema owning the field.
field_name:strName used in metadata error messages.
items:Iterable[object]Declared rule and documentation metadata.
Returns
tuple[Rule, ...]Rules in their declaration order.
Raises
TypeErrorIf an item is neither a rule nor supported metadata.
def _type_contains_nested(tp: object) -> bool: (source)

Check whether a type annotation contains a nested Orionis schema.

Parameters
tp:objectType annotation to inspect. May be a plain type or wrapped in Union/| or Annotated.
Returns
boolReturn True if tp itself, or any nested/union member, is a schema type defining __orionis_meta__; otherwise return False.
def _type_uses_async(field_type: object) -> bool: (source)

Inspect warmed nested schemas for native asynchronous rules.

Parameters
field_type:objectField annotation, possibly an Annotated type or union.
Returns
boolWhether a nested schema requires asynchronous validation.
def _warm_child_plan(tp: object): (source)

Eagerly populate _PLAN_CACHE for any nested Orionis schema type.

Called from _build_plan so that the first real validation call for a nested field always hits the cache instead of triggering a cold build.

Parameters
tp:objectField type annotation, potentially an Annotated type, Union or bare class.
Returns
NoneComplete the documented operation without returning a value.
_ASYNC_PLAN_CACHE: dict[type, tuple | None] = (source)

Undocumented

Value
{}
_EMPTY_META: dict[str, list[object]] = (source)

Undocumented

Value
{}
_PLAN_CACHE: dict[type, tuple] = (source)

Undocumented

Value
{}