haive.core.schema.composer.schema_composer

Simplified SchemaComposer using modular mixins.

Classes

SchemaComposer

Streamlined schema composer using modular mixins.

Module Contents

class haive.core.schema.composer.schema_composer.SchemaComposer(name='ComposedState')[source]

Bases: haive.core.schema.composer.engine.engine_manager.EngineComposerMixin, haive.core.schema.composer.engine.engine_detector.EngineDetectorMixin, haive.core.schema.composer.field.field_manager.FieldManagerMixin

Streamlined schema composer using modular mixins.

This is a much smaller, focused version of SchemaComposer that delegates most functionality to specialized mixins:

  • EngineComposerMixin: Engine management and tracking

  • EngineDetectorMixin: Base class detection from components

  • FieldManagerMixin: Field definition and metadata management

The core class focuses only on: - Initialization and coordination - High-level composition workflows - Schema building and finalization

Initialize the schema composer.

Parameters:

name (str) – Name for the generated schema class

add_fields_from_components(components)[source]

Add fields from a list of components.

Parameters:

components (list[Any]) – List of components to extract fields from

Returns:

Self for chaining

Return type:

SchemaComposer

add_fields_from_dict(fields_dict)[source]

Add fields from a dictionary definition.

Parameters:

fields_dict (dict)

Return type:

SchemaComposer

add_fields_from_engine(engine)[source]

Extract fields from an engine component.

Parameters:

engine (Any)

Return type:

SchemaComposer

add_fields_from_model(model)[source]

Extract fields from a Pydantic model.

Parameters:

model (type)

Return type:

SchemaComposer

build()[source]

Build and return the final schema class.

Returns:

A StateSchema subclass with all defined fields and metadata

Return type:

type[haive.core.schema.state_schema.StateSchema]

classmethod from_components(components, name='ComposedState')[source]

Create a schema from components using the class method interface.

This maintains backward compatibility with the original API.

Parameters:
  • components (list[Any]) – List of components to compose

  • name (str) – Name for the generated schema

Returns:

Generated schema class

Return type:

type[haive.core.schema.state_schema.StateSchema]