haive.core.schema.composer.field.field_manager¶

Field management for schema composition.

Classes¶

FieldManagerMixin

Mixin that handles field management in SchemaComposer.

Module Contents¶

class haive.core.schema.composer.field.field_manager.FieldManagerMixin(*args, **kwargs)[source]¶

Mixin that handles field management in SchemaComposer.

This mixin provides: - Field definition storage and management - Field metadata tracking (sources, sharing, reducers) - Field validation and processing - Engine I/O field mapping

Initialize field tracking structures.

add_field(name, field_type, default=None, default_factory=None, description=None, shared=False, reducer=None, source=None, input_for=None, output_from=None)[source]¶

Add a field definition to the schema.

Parameters:
  • name (str) – Field name

  • field_type (type) – Type of the field

  • default (Any) – Default value for the field

  • default_factory (collections.abc.Callable[[], Any] | None) – Optional factory function for creating default values

  • description (str | None) – Optional field description for documentation

  • shared (bool) – Whether field is shared with parent graph

  • reducer (collections.abc.Callable | None) – Optional reducer function for merging field values

  • source (str | None) – Optional source identifier

  • input_for (list[str] | None) – Optional list of engines this field is input for

  • output_from (list[str] | None) – Optional list of engines this field is output from

Returns:

Self for method chaining

Return type:

FieldManagerMixin

get_engine_io_mapping(engine_name)[source]¶

Get input/output mapping for a specific engine.

Parameters:

engine_name (str)

Return type:

dict[str, list[str]]

get_field_count()[source]¶

Get the number of fields defined.

Return type:

int

get_field_names()[source]¶

Get list of all field names.

Return type:

list[str]

get_shared_fields()[source]¶

Get list of shared field names.

Return type:

list[str]

has_field(name)[source]¶

Check if a field is defined.

Parameters:

name (str)

Return type:

bool