Skip to content

Project Store

app.infrastructure.project.project_store

View source code

Serializes project documents to JSON and validates them when reading.

See Also

Layer: Infrastructure. Context: Implements concrete processing and i/o behind application-facing contracts at this architectural boundary.

ProjectStore

Read and write versioned project documents as JSON.

Layer: Infrastructure. Context: Encodes domain project data at the filesystem boundary and validates the persisted structure before constructing domain objects.

load(file_path: str) -> ProjectDocument

Read JSON from disk and validate it as a supported project.

PARAMETER DESCRIPTION
file_path

Source project JSON file.

TYPE: str

RETURNS DESCRIPTION
ProjectDocument

The decoded domain project document.

RAISES DESCRIPTION
OSError

If the file cannot be opened or read.

UnicodeDecodeError

If the file is not valid UTF-8.

JSONDecodeError

If the file does not contain valid JSON.

ProjectFormatException

If the payload has an unsupported version or an invalid required structure.

TypeError

If a numeric field has an incompatible type.

ValueError

If a numeric field cannot be converted to an integer.

save(file_path: str, project: ProjectDocument) -> None

Serialize a project document to the specified path.

PARAMETER DESCRIPTION
file_path

Destination JSON file; its parent directory is created when necessary.

TYPE: str

project

Domain document to serialize.

TYPE: ProjectDocument

RAISES DESCRIPTION
OSError

If the destination directory cannot be created or the file cannot be written.

TypeError

If the destination path or a project value has an unsupported type.

ValueError

If serialization encounters a circular reference.