GitHub

API reference for schema.

Schemas of RPC results (Effect's RpcSchema).

Stream(success, error) is the success schema of a streaming RPC: its values are streams of success items failing with error. ClientAbort annotates the interruption of a request the client cancelled.

Classes

Functions

Stream

Stream[A, E](success, error) -> StreamSchema[A, E]

The success schema of an RPC streaming success items and failing with error (Effect's RpcSchema.Stream).

ParameterTypeDescription
successCodec[A, Any, Any, Any]
errorCodec[E, Any, Any, Any]

Returns StreamSchema[A, E]

def Stream[A, E](
    success: Codec[A, Any, Any, Any], error: Codec[E, Any, Any, Any], /
) -> StreamSchema[A, E]:
    """The success schema of an RPC streaming ``success`` items and failing
    with ``error`` (Effect's ``RpcSchema.Stream``)."""
    return StreamSchema(_STREAM.ast, success, error)

is_stream_schema

is_stream_schema(schema) -> TypeIs[StreamSchema[Any, Any]]
ParameterTypeDescription
schemaobject

Returns TypeIs[StreamSchema[Any, Any]]

def is_stream_schema(schema: object) -> TypeIs[StreamSchema[Any, Any]]:
    return isinstance(schema, StreamSchema)

get_stream_schemas

get_stream_schemas(schema) -> StreamSchemas | None

The parts of a Stream schema; None for any other schema.

ParameterTypeDescription
schemaobject

Returns StreamSchemas | None

def get_stream_schemas(schema: object) -> StreamSchemas | None:
    """The parts of a ``Stream`` schema; ``None`` for any other schema."""
    if not isinstance(schema, StreamSchema):
        return None
    stream = cast("StreamSchema[Any, Any]", schema)
    return StreamSchemas(stream.success.__codec__(), stream.error.__codec__())