Skip to main content

Module config_schema

Module config_schema 

Source
Expand description

BP-9 (D6 row “Published JSON schema for config”, cc§6): the published JSON Schema for the supercode config file — .supercode.toml, ~/.config/supercode/config.toml, and the JSON mirror (HarnessConfig::from_json_str).

Why a table and not a derive. The schema is generated from CONFIG_SCHEMA_FIELDS, a flat list of (dotted path, kind, description). That table would rot silently — except that [tests::schema_covers_exactly_the_parsed_keys] compares it against the keys serde ITSELF emits for a default HarnessConfig, in both directions, and [tests::every_schema_key_parses_with_its_declared_type] feeds each declared path back through the real parser at its declared type. Adding a field to CoreSection without touching this table fails the first test; declaring a wrong type fails the second. So the schema is bound to the serde types by the test suite rather than by a derive macro — no new dependency, same guarantee, and the descriptions are written for a human reading a tooltip in their editor.

The generated document is checked in at docs/schema/supercode-config.schema.json (regenerate with supercode config schema --write); a test asserts the committed file is byte-identical to what this module generates.

Structs§

Field
One config key: its dotted path, its JSON type, and the one-line description an editor shows.

Enums§

Kind
The JSON type a config key carries.

Constants§

CONFIG_SCHEMA_FIELDS
Every key the config parser accepts, in document order. Kept honest by the tests at the bottom of this file — see the module doc comment.
CONFIG_SCHEMA_PATH
Where the committed schema lives, workspace-relative.
CONFIG_SCHEMA_URL
Canonical URL for the published schema — what a config file’s $schema key should point at.

Functions§

config_schema
Generate the published JSON Schema.
config_schema_json
The schema as it is written to disk (pretty JSON, trailing newline).
parsed_key_paths
Every dotted key path serde emits for a default HarnessConfig — the parser’s own view of what the document contains. An empty object is a free-form table (capabilities, experimental, core.prompts) and therefore a leaf.