mirror of
https://github.com/openai/codex.git
synced 2026-04-26 23:55:25 +00:00
### What Add JSON Schema generation for `config.toml`, with checked‑in `docs/config.schema.json`. We can move the schema elsewhere if preferred (and host it if there's demand). Add fixture test to prevent drift and `just write-config-schema` to regenerate on schema changes. Generate MCP config schema from `RawMcpServerConfig` instead of `McpServerConfig` because that is the runtime type used for deserialization. Populate feature flag values into generated schema so they can be autocompleted. ### Tests Added tests + regenerate script to prevent drift. Tested autocompletions using generated jsonschema locally with Even Better TOML. https://github.com/user-attachments/assets/5aa7cd39-520c-4a63-96fb-63798183d0bc
21 lines
570 B
Rust
21 lines
570 B
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
|
|
/// Generate the JSON Schema for `config.toml` and write it to `config.schema.json`.
|
|
#[derive(Parser)]
|
|
#[command(name = "codex-write-config-schema")]
|
|
struct Args {
|
|
#[arg(short, long, value_name = "PATH")]
|
|
out: Option<PathBuf>,
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let args = Args::parse();
|
|
let out_path = args
|
|
.out
|
|
.unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("config.schema.json"));
|
|
codex_core::config::schema::write_config_schema(&out_path)?;
|
|
Ok(())
|
|
}
|