Skip to main content

write_config_schema

Function write_config_schema 

Source
pub fn write_config_schema<S>(output_path: impl AsRef<Path>) -> ConfigResult<()>
where S: JsonSchema,
Expand description

Writes a Draft 7 JSON Schema for the root config type.

The same generated schema can be referenced from TOML, YAML, and JSON configuration files. TOML and YAML templates can bind it with editor directives. JSON files should usually be bound through editor settings rather than a runtime $schema field. Generated schemas omit JSON Schema required constraints so editors provide completion without requiring every config field to exist in each partial config file.

§Type Parameters

§Arguments

  • output_path: Destination path for the generated JSON Schema.

§Returns

Returns Ok(()) after the schema file has been written.