noether.core.schemas.mixins

Classes

Shared

Marker class to indicate a field should inherit shared values from the parent config.

InjectSharedFieldFromParentMixin

Mixin to propagate shared fields from parent configuration to sub-configurations.

Module Contents

class noether.core.schemas.mixins.Shared

Marker class to indicate a field should inherit shared values from the parent config.

class noether.core.schemas.mixins.InjectSharedFieldFromParentMixin(/, **data)

Bases: pydantic.BaseModel

Mixin to propagate shared fields from parent configuration to sub-configurations.

Supports recursive/nested injection across multiple levels of configuration hierarchy.

Usage:
class MyConfig(BaseModel, InjectSharedFieldFromParentMixin):

sub_config: Annotated[SubConfigType, Shared]

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

classmethod propagate_shared_fields(data)

Propagates shared fields from parent config to sub-configurations recursively.

Parameters:

data (Any)

Return type:

Any