gui_schema#

JSON Schema and validation utilities for the GUIModel format.

baf.core.gui.gui_schema.get_json_schema()[source]#

Return the JSON Schema for a serialized GUIModel.

The schema is designed to be passed to an LLM as a generation constraint. All element types are discriminated by the "type" field.

Returns:

A dict containing a JSON Schema (draft-07) for the GUIModel format.

baf.core.gui.gui_schema.validate_json(json_str)[source]#

Validate a JSON string against the GUIModel JSON Schema.

Requires the jsonschema package (pip install jsonschema).

Parameters:

json_str – JSON string to validate.

Returns:

True if valid, False otherwise.