class documentation

class Serializer(Protocol):

View In Hierarchy

Serializer is used by the framework to serialize/deserialize input and output.

Method deserialize Deserialize decodes a Content into a value.
Method serialize Serialize encodes a value into a Content.
def deserialize(self, content: Content, as_type: type[Any] | None = None) -> Any | Awaitable[Any]:

Deserialize decodes a Content into a value.

Parameters
content:ContentThe content to deserialize.
as_type:type[Any] | NoneThe type to convert the result of deserialization into. Do not attempt type conversion if this is None.
Returns
Any | Awaitable[Any]Undocumented
def serialize(self, value: Any) -> Content | Awaitable[Content]:

Serialize encodes a value into a Content.