Skip to main content

CallableSchema

This class defines a schema for representing callable objects within a type system. It specifies the structure for identifying callables through a reference string, along with associated metadata and serialization instructions.

Attributes

AttributeTypeDescription
typeLiteral['callable']Discriminator field that must be set to the literal string 'callable' to identify this schema type.
refstrA string reference representing the import path or identifier of the callable to be executed.
metadatadict[str, Any]A dictionary of arbitrary key-value pairs used to store additional context or configuration for the callable.
serializationSerSchemaDefines the serialization schema used to convert the callable or its return values into a serializable format.

Methods


type()

def type() - > Literal['callable']

Identifies the schema type as a callable, ensuring the validator treats the input as a function or class constructor.

Returns

TypeDescription
Literal['callable']The literal string 'callable' used for schema identification

ref()

def ref() - > str

Specifies a unique reference string for the callable schema, typically used for recursive definitions or shared schema lookups.

Returns

TypeDescription
strThe unique identifier string for this schema definition

metadata()

def metadata() - > dict[str, Any]

Stores a dictionary of arbitrary metadata used to provide additional context or custom configuration for the callable.

Returns

TypeDescription
dict[str, Any]A mapping of metadata keys to their associated values

serialization()

def serialization() - > SerSchema

Defines the serialization logic for the callable, determining how the function or class is converted to a serializable format.

Returns

TypeDescription
SerSchemaThe serialization schema configuration for the callable