You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.5 KiB
2.5 KiB
| title | status | type | priority | created_at | updated_at | blocked_by | ||
|---|---|---|---|---|---|---|---|---|
| Implement GET /api/ — serve OpenAPI spec as JSON | completed | task | normal | 2026-03-10T23:32:06Z | 2026-03-10T23:32:13Z |
|
Shared types and utilities are in src/lib.rs — code placed there must compile for both the host target and wasm32-unknown-unknown.
The GET /api/ endpoint serves the OpenAPI 3.1.0 specification as JSON. This endpoint requires no authentication and is the entry point for API documentation and client generation.
Strategy resolved in TRIAGE 2ec8b1: compile-time embed via build.rs (ticket 8892d5).
The build.rs converts api/openapi.yaml to JSON at build time and writes it to
$OUT_DIR/openapi.json. The handler serves this as a static &str:
// Embedded at compile time by build.rs — no runtime parsing, no serde_yaml in binary.
const OPENAPI_JSON: &str = include_str!(concat!(env!("OUT_DIR"), "/openapi.json"));
pub async fn get_openapi_spec() -> impl IntoResponse {
(
[(axum::http::header::CONTENT_TYPE, "application/json")],
OPENAPI_JSON,
)
}
Register the route in the Axum router as GET /api/.
cargo fmt
cargo check
cargo clippy
cargo test
`feat(quotesdb): implement GET /api/ to serve OpenAPI spec as JSON`