Skip to content

docs: add auto-generated config TOML reference#621

Draft
m4tx wants to merge 1 commit into
masterfrom
toml-reference
Draft

docs: add auto-generated config TOML reference#621
m4tx wants to merge 1 commit into
masterfrom
toml-reference

Conversation

@m4tx

@m4tx m4tx commented Jul 23, 2026

Copy link
Copy Markdown
Member

Fixes #479

Related issue or discussion

Description

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

Copilot AI review requested due to automatic review settings July 23, 2026 20:16
@m4tx m4tx changed the title feat: add auto-generated config TOML reference docs: add auto-generated config TOML reference Jul 23, 2026
@github-actions github-actions Bot added A-docs Area: Documentation A-deps Area: Dependencies C-lib Crate: cot (main library crate) labels Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectcot
Branchtoml-reference
Testbedgithub-ubuntu-latest

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
empty_router/empty_routerLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
13.03 ms
(+79.68%)Baseline: 7.25 ms
12.55 ms
(103.84%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
🚨 view alert (🔔)
13.03 ms
(+79.68%)Baseline: 7.25 ms
12.55 ms
(103.84%)

json_api/json_api📈 view plot
🚷 view threshold
1.14 ms
(+5.68%)Baseline: 1.08 ms
1.37 ms
(83.54%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
1.06 ms
(+5.60%)Baseline: 1.01 ms
1.24 ms
(85.46%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
1.02 ms
(+5.48%)Baseline: 0.97 ms
1.21 ms
(84.77%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
17.02 ms
(-2.04%)Baseline: 17.37 ms
21.69 ms
(78.47%)
🐰 View full continuous benchmarking report in Bencher

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an auto-generated TOML configuration reference to the documentation, sourced from cot::config::ProjectConfig via JSON Schema so the docs stay in sync with the actual config surface.

Changes:

  • Introduces a schemars-based generator plus a cot-test test to enforce docs/configuration.md freshness.
  • Adds a config-docs internal feature to enable JSON Schema derivation for config types.
  • Wires the new configuration page into the docs site navigation and adds a just task to regenerate the docs.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
justfile Adds a just generate-config-docs helper to regenerate the config reference.
docs/site/src/main.rs Adds the new “Configuration” page to the docs site nav.
docs/configuration.md New generated configuration reference page.
cot/src/email/transport/smtp.rs Enables JSON Schema derivation for SMTP auth mechanism enum (for docs generation).
cot/src/config.rs Adds JsonSchema derives / schema overrides to config types to support docs generation.
cot/Cargo.toml Adds internal config-docs feature to drive schema generation.
cot-test/tests/config_reference.rs Adds a test that fails if docs/configuration.md is out of date.
cot-test/src/lib.rs Exposes the config reference generator behind config-docs.
cot-test/src/config_reference.rs Implements the Markdown generator from the ProjectConfig schema.
cot-test/src/bin/generate_config_docs.rs Adds a binary to write the generated docs file.
cot-test/Cargo.toml Adds deps and feature wiring for the docs generator/test/bin.
Cargo.lock Records new dependency additions for schema generation.
Comments suppressed due to low confidence (1)

cot/src/config.rs:1799

  • Using schemars(with = "Option<String>") for expiry: Expiry implies the config schema accepts null, even though the TOML representation is a string and the field is defaulted (optional-by-omission, not nullable). Prefer schemars(with = "String") here to keep the schema accurate.
    #[cfg_attr(feature = "config-docs", schemars(with = "Option<String>"))]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cot-test/Cargo.toml
Comment on lines +21 to +27
schemars = { workspace = true, features = ["std"] }
serde_json.workspace = true
thiserror.workspace = true

[features]
# Enables generating the configuration file reference (docs/configuration.md).
config-docs = ["cot/config-docs"]
Comment thread cot/src/config.rs
/// timeout = "2h"
/// ```
#[serde(with = "crate::serializers::cache_timeout")]
#[cfg_attr(feature = "config-docs", schemars(with = "Option<String>"))]
Comment on lines +447 to +463
fn first_paragraph(desc: &str) -> String {
let mut lines = Vec::new();
for line in desc.lines() {
let trimmed = line.trim();
if trimmed.starts_with('#') || trimmed.starts_with("```") {
break;
}
if trimmed.is_empty() {
if lines.is_empty() {
continue;
}
break;
}
lines.push(trimmed);
}
lines.join(" ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-deps Area: Dependencies A-docs Area: Documentation C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a full reference for config.toml files

2 participants