apimodel.parser#

Parser functions for various types.

Module Contents#

apimodel.parser.get_validator(tp: object, *, model: Optional[type] = None) AnnotationValidator[source]#

Get a validator for the given type.

async apimodel.parser.acast(tp: Type[T], value: object) T[source]#

Cast the value to the given type asynchronously.

apimodel.parser.cast(tp: Type[T], value: object) T[source]#

Cast the value to the given type synchronously.

apimodel.parser.validate_arguments(callback: Callable[Ellipsis, T]) Callable[Ellipsis, T][source]#

Validate arguments of a function.

Inspired by pydantic. Positional-only arguments are not supported because just no.