[PR #1582] [MERGED] Server reference generated from horizon-server's source #3609

Closed
opened 2026-11-03 04:10:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1582
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: docs/server-api-reference


📝 Commits (3)

  • f80d008 Server reference generated from horizon-server's source
  • aee0b8b Format the endpoint table
  • 37c36b5 Merge main into docs/server-api-reference

📊 Changes

5 files changed (+435 additions, -25 deletions)

View changed files

📝 crates/horizon-server/src/api.rs (+98 -17)
📝 crates/horizon-server/src/config.rs (+8 -8)
📝 crates/horizon-server/src/main.rs (+2 -0)
➕ crates/horizon-server/src/reference.rs (+190 -0)
➕ docs/api/server-reference.md (+137 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part of the platform plan (Horizon's APIs, documented): the server's API, in one generated reference that can't drift.

What

  • docs/api/server-reference.md, generated by crates/horizon-server/src/reference.rs (test-only module): horizon-server help verbatim, every server.toml key per section (default, the server.properties key it writes from config::TYPED, what it does), and every control API endpoint (method, path, what it takes and answers).
  • api::ROUTES: the endpoints as a table. It replaces the endpoint list in api.rs's module comment and the hand-kept path list in route()'s 405 arm ((_, path) if ROUTES.iter().any(..)), so a new endpoint is listed in one place.
  • Tests (cargo test -p horizon-server reference):
    • the page is up to date (HORIZON_WRITE_DOCS=1 rewrites it);
    • the template lists exactly the keys Config reads (serialised Config::default() against the template's keys), and every key has a comment;
    • ROUTES holds exactly the ("METHOD", "/api/v1/…") pairs api.rs answers.
  • config::TEMPLATE: comments for the 7 keys that had none (motd, port, max_players, view_distance, simulation_distance, hardcore, restart_on_crash). Only what init writes as comments changes; no setting, default or parse changes (template_is_the_default still passes).

How tested

cargo test -p horizon-server                                   # 50 passed
cargo clippy -p horizon-server --all-targets -- -D warnings     # clean
cargo fmt --check                                               # clean

Parity: tools/parity.py --changed-files maps these files to all 334 harnesses (unmapped crate); no harness runs the horizon-server crate (the server harnesses run horizon-client --dedicated), so none were run locally.

Needs Ludovic

Nothing. Merge before the portal PR, which links this page.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1582 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `docs/server-api-reference` --- ### 📝 Commits (3) - [`f80d008`](https://github.com/horizon-rust/horizon/commit/f80d00802e54bfafccfbdb314ecf80d817fbd99c) Server reference generated from horizon-server's source - [`aee0b8b`](https://github.com/horizon-rust/horizon/commit/aee0b8b5892c5c22083f4c2539ff1a05cc2bf0f5) Format the endpoint table - [`37c36b5`](https://github.com/horizon-rust/horizon/commit/37c36b548ab84a0cb8667fa4c003a7dfa9f28fdb) Merge main into docs/server-api-reference ### 📊 Changes **5 files changed** (+435 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-server/src/api.rs` (+98 -17) 📝 `crates/horizon-server/src/config.rs` (+8 -8) 📝 `crates/horizon-server/src/main.rs` (+2 -0) ➕ `crates/horizon-server/src/reference.rs` (+190 -0) ➕ `docs/api/server-reference.md` (+137 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of the platform plan (Horizon's APIs, documented): the server's API, in one generated reference that can't drift. ## What - **`docs/api/server-reference.md`**, generated by `crates/horizon-server/src/reference.rs` (test-only module): `horizon-server help` verbatim, every `server.toml` key per section (default, the `server.properties` key it writes from `config::TYPED`, what it does), and every control API endpoint (method, path, what it takes and answers). - **`api::ROUTES`**: the endpoints as a table. It replaces the endpoint list in `api.rs`'s module comment and the hand-kept path list in `route()`'s 405 arm (`(_, path) if ROUTES.iter().any(..)`), so a new endpoint is listed in one place. - **Tests** (`cargo test -p horizon-server reference`): - the page is up to date (`HORIZON_WRITE_DOCS=1` rewrites it); - the template lists exactly the keys `Config` reads (serialised `Config::default()` against the template's keys), and every key has a comment; - `ROUTES` holds exactly the `("METHOD", "/api/v1/…")` pairs `api.rs` answers. - **`config::TEMPLATE`**: comments for the 7 keys that had none (`motd`, `port`, `max_players`, `view_distance`, `simulation_distance`, `hardcore`, `restart_on_crash`). Only what `init` writes as comments changes; no setting, default or parse changes (`template_is_the_default` still passes). ## How tested ``` cargo test -p horizon-server # 50 passed cargo clippy -p horizon-server --all-targets -- -D warnings # clean cargo fmt --check # clean ``` Parity: `tools/parity.py --changed-files` maps these files to all 334 harnesses (unmapped crate); no harness runs the `horizon-server` crate (the server harnesses run `horizon-client --dedicated`), so none were run locally. ## Needs Ludovic Nothing. Merge before the portal PR, which links this page. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:10:46 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3609
No description provided.