bayesline.api.migrate_raw_json

bayesline.api.migrate_raw_json#

bayesline.api.migrate_raw_json(settings_type: type[Settings], raw_json: Mapping[str, Any]) dict[str, Any]#

Apply sequential migrations to raw_json and strip the version key.

Parameters#

settings_typetype[Settings]

The Settings subclass that defines _schema_version and _migrations.

raw_jsonMapping[str, Any]

The raw JSON dict, possibly from an older schema version.

Returns#

dict[str, Any]

The migrated dict with VERSION_KEY stripped, ready for model_validate().

Raises#

ValueError

If the stored version is newer than the code version (cannot downgrade), or if a required migration step is missing.