Schema definition, dataclasses, and parsing utilities for the SBL GUI JSON specification.
This module formalizes the JSON interface used to describe auto-generated GUI layouts.
It provides:
• A JSON Schema that fully specifies the expected structure and allowed fields.
• Python dataclasses that serve as a typed in-memory representation of the specification.
• Validation utilities (JSON Schema–based) to ensure correctness and reproducibility.
• Parsing helpers to construct typed Python objects from validated JSON dictionaries.
This machinery ensures that GUI definitions produced by the UI-to-Spec generator
remain portable, machine-verifiable, and version-stable across GUI backends
(PyQt6, Tkinter, Panel).
Typical usage:
from gui_json_schema import ParseGUI
# Validate on disk
ParseGUI.validate_gui_spec("gui_spec.json")
# Load and parse in memory
import json
with open("gui_spec.json") as f:
data = json.load(f)
gui = ParseGUI.parse_gui(data)
print(gui.window.title)
The JSON schema enforced here is part of the end-to-end, reproducible GUI
generation pipeline supporting the SBL Plugin Manager ecosystem.