feat: Expose json schema for config file #30

Merged
martin merged 4 commits from schema-rs into main 2026-09-16 20:06:31 +00:00
Owner
No description provided.
martin self-assigned this 2026-08-16 16:37:16 +00:00
feat: Expose json schema for config file
Some checks failed
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline failed
dfdd1c5f55
Package schema in Nix
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline failed
ci/woodpecker/push/verify Pipeline was successful
f6579a9028
Fix clippy warnings
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
603bc3e7d5
martin force-pushed schema-rs from 603bc3e7d5
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
to 4afbcf2e32
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
ci/woodpecker/push/verify Pipeline was canceled
2026-08-30 08:48:42 +00:00
Compare
martin force-pushed schema-rs from 4afbcf2e32
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
ci/woodpecker/push/verify Pipeline was canceled
to fe0415e500
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
ci/woodpecker/push/verify-nix Pipeline was successful
2026-08-30 08:53:15 +00:00
Compare
fix: Justfile run recipe
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline was successful
ci/woodpecker/push/verify-nix Pipeline was successful
d5308c278d
martin changed title from WIP: feat: Expose json schema for config file to feat: Expose json schema for config file 2026-09-16 19:58:41 +00:00
Member

Review Summary

This PR adds JSON Schema generation for the configuration file using the schemars crate. The schema is exposed via an HTTP endpoint (/config.schema.json) and installed as a file in the Nix package. The implementation is solid and well-structured.

Positives:

  • Comprehensive validation ensures the config schema path doesn't conflict with other built-in endpoints
  • Good test coverage including schema endpoint validation and conflict detection
  • Proper Nix packaging with postInstall to generate and install the schema file
  • Clean use of #[cfg_attr(test, derive(Default))] instead of manual Default impls
  • Nice iterator refactor in http_signature.rs
  • The config-schema binary approach is clean for generating the schema independently

Minor concerns:

  • The #[allow(dead_code)] in src/bin/config-schema.rs is technically unnecessary since the schema is generated via derive macros, not direct usage
  • The justfile run recipe change to @ (silent) is a behavior change mixed into an unrelated feature PR
  • Some style-only changes (return removal, .map(|s| s) → .collect()) are mixed in; these could be separate cleanup commits

*🤖 Review by opencode (opencode/mimo-v2.5-free) — verdict: approve

# Review Summary This PR adds JSON Schema generation for the configuration file using the `schemars` crate. The schema is exposed via an HTTP endpoint (`/config.schema.json`) and installed as a file in the Nix package. The implementation is solid and well-structured. **Positives:** - Comprehensive validation ensures the config schema path doesn't conflict with other built-in endpoints - Good test coverage including schema endpoint validation and conflict detection - Proper Nix packaging with postInstall to generate and install the schema file - Clean use of `#[cfg_attr(test, derive(Default))]` instead of manual Default impls - Nice iterator refactor in `http_signature.rs` - The `config-schema` binary approach is clean for generating the schema independently **Minor concerns:** - The `#[allow(dead_code)]` in `src/bin/config-schema.rs` is technically unnecessary since the schema is generated via derive macros, not direct usage - The `justfile` `run` recipe change to `@` (silent) is a behavior change mixed into an unrelated feature PR - Some style-only changes (`return` removal, `.map(|s| s)` → `.collect()`) are mixed in; these could be separate cleanup commits --- *🤖 Review by opencode (opencode/mimo-v2.5-free) — verdict: **approve** <!-- forgejo-opencode-review -->
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode. <!-- forgejo-opencode-review -->
@ -13,3 +13,2 @@
[group("Cargo")]
run $WOODPECKER_EXTENSION_CONFIG=DEV_CONFIG:
cargo run
@run $WOODPECKER_EXTENSION_CONFIG=DEV_CONFIG:
Member
[style] The `@` prefix on `run` silences command echo, which is a behavior change unrelated to the schema feature. This should be a separate commit or noted in the PR description.
<!-- forgejo-opencode-review --> [style] The `@` prefix on `run` silences command echo, which is a behavior change unrelated to the schema feature. This should be a separate commit or noted in the PR description.
@ -0,0 +1,16 @@
#![allow(dead_code)]
Member
[style] `#[allow(dead_code)]` is unnecessary here — the config module types are used through `schema_for!` derive macros, not direct function calls. Consider removing it for clarity.
<!-- forgejo-opencode-review --> [style] `#[allow(dead_code)]` is unnecessary here — the config module types are used through `schema_for!` derive macros, not direct function calls. Consider removing it for clarity.
martin merged commit cf7376a78c into main 2026-09-16 20:06:31 +00:00
martin deleted branch schema-rs 2026-09-16 20:06:31 +00:00
Sign in to join this conversation.
No description provided.