Spec JSON¶
uptimely.spec.json reads and writes spec documents as JSON. Use
load_spec when loading a
document that also needs semantic validation.
codec¶
uptimely.spec.json.codec reads JSON, converts document models to
dictionaries, and writes spec documents. load_document reads document
data; it does not perform the semantic validation provided by load_spec.
JSON serialization helpers for spec models.
load_document
¶
load_document(path: str | Path) -> dict[str, typing.Any]
Read one JSON document, rejecting unsupported multi-file definitions.
to_document
¶
to_document(spec_definition: Spec) -> dict[str, typing.Any]
Encode document models using the spec document's identifier rules.
write_document
¶
write_document(spec_definition: Spec, path: str | Path) -> str
Write a spec document without mutating the source model.