diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-10-03 13:14:47 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-03 13:14:47 +0000 |
| commit | 1f56f7fcbb0934ac8e2208401dc62102e9caa630 (patch) | |
| tree | bf51f2180a15cb0f9917f3bb4502a6db5f6ce760 /src | |
| parent | 0a21f4876c61894c788143db8c65c3d00525243b (diff) | |
| download | genenetwork4-1f56f7fcbb0934ac8e2208401dc62102e9caa630.tar.gz | |
Document ApiError 500 on / and /version, add README example.
* src/lib.rs (hello_world)[utoipa::path]<responses>: Add 500, body
ApiError.
(version)[utoipa::path]<responses>: Likewise. Neither handler has a
failure path today (no database access, no I/O); this documents the
same error contract as /species and /species/{species} in
/openapi.json for consistency.
* README.md: Add a second ApiError example with next omitted (null),
for an endpoint with no related endpoint to suggest. Note that
spec_url is always /openapi.json on every error from every endpoint,
and that / and /version document the 500 response without currently
having a way to produce one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs index aecdf36..37dd70c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,8 @@ fn request_id_string(request_id: &RequestId) -> Option<String> { } #[utoipa::path(get, path = "/", responses( - (status = 200, description = "Greeting", body = String) + (status = 200, description = "Greeting", body = String), + (status = 500, description = "Internal error", body = ApiError) ))] async fn hello_world() -> &'static str { "Hello, world!" @@ -61,7 +62,8 @@ struct VersionInfo { } #[utoipa::path(get, path = "/version", responses( - (status = 200, description = "Build information", body = VersionInfo) + (status = 200, description = "Build information", body = VersionInfo), + (status = 500, description = "Internal error", body = ApiError) ))] async fn version() -> Json<VersionInfo> { Json(VersionInfo { |
