Skip to main content

generate_config_schema

Function generate_config_schema 

Source
pub fn generate_config_schema() -> Schema
Expand description

Build the editor-facing JSON Schema for the generate command’s kind: model / kind: overrides YAML configs.

The structural shape (tables, columns, rows, relationships, …) comes straight from schemars deriving over [GenerateConfigRoot]. The one part schemars cannot see is what a generator:/modifiers:/planners: entry’s { kind, ...args } shape actually accepts: args is a registry-resolved BTreeMap<String, serde_yaml_ng::Value> (see crate::synthetic::model::GeneratorConfig), so on its own schemars can only describe it as “any object”. This function replaces that permissive placeholder with a oneOf composed from ExtensionRegistry::standard’s descriptors — one branch per registered generator/modifier/planner, keying on kind (primary name and aliases) and listing that operator’s declared ArgumentSpecs, with required arguments enforced.

This documents the standard registry only: a statically-linked custom registry (extra generators/modifiers/planners compiled in by a downstream embedder) is validated at runtime by the compiler, not by this shipped schema.

Argument-strictness depth: each branch enumerates its kind, requires any argument ArgumentSpec marks required, and rejects unrecognized top-level argument names (additionalProperties: false). Per-argument value types and nested object shapes are still checked by each factory’s compiler because ArgumentSpec deliberately carries no value schema.