1#![cfg(feature = "schema")]
2
3use anyhow::{Context, Result};
4use schemars::{schema::RootSchema, schema_for};
5
6use crate::loader::VTCodeConfig;
7
8pub fn vtcode_config_schema() -> RootSchema {
10 schema_for!(VTCodeConfig)
11}
12
13pub fn vtcode_config_schema_json() -> Result<serde_json::Value> {
15 let schema = vtcode_config_schema();
16 serde_json::to_value(schema).context("failed to serialize vtcode-config schema to JSON value")
17}
18
19pub fn vtcode_config_schema_pretty() -> Result<String> {
21 let value = vtcode_config_schema_json()?;
22 serde_json::to_string_pretty(&value)
23 .context("failed to serialize vtcode-config schema to pretty JSON string")
24}