GitHub

MiddlewareDecoding

API reference for MiddlewareDecoding.

middleware_decoding(f): apply with .pipe. The schema decodes with the services f needs (R): f gets the parse needing the schema's own (RI) and may provide them.

Functions

__init__

__init__(f) -> None
ParameterTypeDescription
fCallable[[Parse[A, RI_contra], ParseOptions], Parse[A, R_co]]
def __init__(self, f: Callable[[Parse[A, RI_contra], ParseOptions], Parse[A, R_co]]) -> None:
    self._f = f

__call__

__call__[E, RE = Never](schema) -> Bottom[A, E, R_co, RE]
ParameterTypeDescription
schemaCodec[A, E, RI_contra, RE]

Returns Bottom[A, E, R_co, RE]

def __call__[E, RE = Never](
    self, schema: Codec[A, E, RI_contra, RE], /
) -> Bottom[A, E, R_co, RE]:
    node = schema.__codec__().ast
    return Bottom(ast.decode_to(node, node.to_type(), Middleware(self._f, unchanged)))