ska_sdp_piper.piper.piper_base_model module

class ska_sdp_piper.piper.piper_base_model.PiperBaseModel(**data)[source]

Bases: BaseModel

A base model class that enforces strict validation rules on all subclasses. This model extends Pydantic's BaseModel with custom initialization logic to ensure that all subclass fields have default values and properly handle undefined field markers.

Validation Checks:

  • Ensures all fields in subclasses have default values assigned

  • Fields without defaults must be explicitly annotated with PIPER_UNDEFINED marker

  • Prevents fields from having both a default value AND PIPER_UNDEFINED annotation

  • Raises TypeError if any required fields (without defaults) are defined without PIPER_UNDEFINED annotation

  • Automatically wraps field annotations with serialize/validate methods when PIPER_UNDEFINED marker is detected in metadata

All subclasses must conform to these constraints to be properly instantiated.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'forbid', 'strict': False, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].