PixelWeaver v0.5.0 /server.src.pixelweaver.schema_validation
On this page

Boundary validators for PixelWeaver's governed documents: in-memory checks on parsed dicts, and raw-bytes checks rejecting duplicate keys and float ints.

#server.src.pixelweaver.schema_validation

#server.src.pixelweaver.schema_validation

Boundary validation for governed documents via strictspec.

strictspec is the boundary validator. The Python server is validator-only for these documents (it stores them as opaque round-tripped dicts, never as a mutable typed model), so this module wraps the generated validators under pixelweaver._gen and exposes two entry points per governed document:

  • validate_* — IN-MEMORY (tagged-value) structural validation of an already

parsed dict. The document-level format_version gate is version-agnostic here, so the stamp is injected transiently for validation only (the caller's dict is never mutated).

  • validate_*_bytes — RAW-BYTES validation of serialized JSON text at an

at-rest/ingress boundary. The document must carry format_version (the gate is enforced); duplicate JSON keys and float-lexeme-in-int are hard errors that only raw text can expose.

SchemaValidationError subclasses ValueError so existing except ValueError / except Exception hard-error handlers keep working exactly as they did for pydantic's ValidationError (which is itself a ValueError).

#SchemaValidationError

A governed document failed strictspec validation (a hard error).

#stamp

python
def stamp(obj: dict[str, Any]) -> dict[str, Any]

Return a copy of obj with format_version stamped (write boundary).

#strip_format_version

python
def strip_format_version(obj: dict[str, Any]) -> dict[str, Any]

Return a copy of obj without format_version (load ingress).

Keeps the in-memory document model uniformly version-agnostic after a raw-bytes load has enforced the gate.

#_validate_value

python
def _validate_value(module: Any, obj: Any) -> None

IN-MEMORY structural validation: inject the stamp, tag, validate.

#_validate_bytes

python
def _validate_bytes(module: Any, raw: bytes) -> None

RAW-BYTES validation at an at-rest/ingress boundary.

#validate_constraint_manifest

python
def validate_constraint_manifest(obj: dict[str, Any]) -> None

#validate_constraint_manifest_bytes

python
def validate_constraint_manifest_bytes(raw: bytes) -> None

#validate_part_manifest

python
def validate_part_manifest(obj: dict[str, Any]) -> None

#validate_part_manifest_bytes

python
def validate_part_manifest_bytes(raw: bytes) -> None

#validate_character_preview

python
def validate_character_preview(obj: dict[str, Any]) -> None

#validate_character_preview_bytes

python
def validate_character_preview_bytes(raw: bytes) -> None
Search