diff options
| author | tv <tv@krebsco.de> | 2026-10-26 21:43:42 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 21:43:42 +0100 |
| commit | 3374b029bea44fed6ad5a46a7a05c269ce61af58 (patch) | |
| tree | ca9eba49e886c9dcd4416c4fe7790ca34f07f376 /src/api/store.rs | |
| parent | 137b1547f847ff2402ea9e634b64ee2196a75075 (diff) | |
replace utoipa by static openapi.yaml
Diffstat (limited to 'src/api/store.rs')
| -rw-r--r-- | src/api/store.rs | 74 |
1 files changed, 4 insertions, 70 deletions
diff --git a/src/api/store.rs b/src/api/store.rs index c8a072f..a05bc23 100644 --- a/src/api/store.rs +++ b/src/api/store.rs @@ -48,20 +48,7 @@ fn conflicts_response( response_for_value(&body, None) // always JSON } -#[utoipa::path( - get, - path = "/store", - tag = "Store", - params( - ("conflicts" = Option<bool>, Query, description = "Wrap the value and list every conflict resolved on the way"), - ("heads" = Option<bool>, Query, description = "Return the document heads at the time of the read in x-continuum-heads"), - ), - responses( - (status = 200, description = "Returns the complete store as JSON or text, depending on Accept"), - (status = 503, description = "Node is not ready"), - (status = 500, description = "Failed to read or serialize the document") - ) -)] +/// `GET /store`: the whole store (`docs/openapi.yaml`). pub(crate) async fn get_store_root( State(state): State<AppState>, headers: HeaderMap, @@ -96,23 +83,7 @@ pub(crate) async fn get_store_root( mark_source(response, source, heads) } -#[utoipa::path( - get, - path = "/store/{key}", - tag = "Store", - params( - ("key" = String, Path, description = "Slash-separated store path, for example settings/theme"), - ("conflicts" = Option<bool>, Query, description = "Wrap the value and list every conflict resolved on the way"), - ("heads" = Option<bool>, Query, description = "Return the document heads at the time of the read in x-continuum-heads"), - ), - responses( - (status = 200, description = "Returns the value as JSON or text, depending on Accept"), - (status = 400, description = "Invalid store path"), - (status = 404, description = "Value does not exist"), - (status = 500, description = "Failed to read or serialize the value"), - (status = 503, description = "Node is not ready (and not rejoining with a stale view)") - ) -)] +/// `GET /store/{key}`. pub(crate) async fn get_store_entry( State(state): State<AppState>, Path(key): Path<String>, @@ -181,28 +152,7 @@ fn mark_source( Ok(response) } -#[utoipa::path( - put, - path = "/store/{key}", - tag = "Store", - params( - ("key" = String, Path, description = "Slash-separated store path") - ), - request_body( - content = String, - description = "Value to write. Use application/json for JSON values or text/plain for strings.", - content_type = "application/json" - ), - responses( - (status = 200, description = "Value written successfully"), - (status = 400, description = "Invalid path, malformed JSON, invalid UTF-8, or unsupported JSON value"), - (status = 403, description = "Protocol data (_continuum) and the user isn't a protocol writer, or epoch metadata"), - (status = 409, description = "Path conflicts with an existing non-map value"), - (status = 415, description = "Unsupported Content-Type"), - (status = 500, description = "Internal error or synchronization notification failure"), - (status = 503, description = "Node is not ready") - ) -)] +/// `PUT /store/{key}`. pub(crate) async fn put_store_entry( State(state): State<AppState>, Extension(user): Extension<AuthenticatedUser>, @@ -244,23 +194,7 @@ pub(crate) async fn put_store_entry( response_for_value(&value, headers.get(ACCEPT)) } -#[utoipa::path( - delete, - path = "/store/{key}", - tag = "Store", - params( - ("key" = String, Path, description = "Slash-separated store path"), - ("prune" = Option<bool>, Query, description = "Remove empty ancestor maps after deletion") - ), - responses( - (status = 204, description = "Value deleted successfully"), - (status = 400, description = "Invalid store path"), - (status = 403, description = "Protocol data (_continuum) and the user isn't a protocol writer, or epoch metadata"), - (status = 404, description = "Value does not exist"), - (status = 500, description = "Deletion or synchronization notification failed"), - (status = 503, description = "Node is not ready") - ) -)] +/// `DELETE /store/{key}`. #[instrument(skip(state), fields(path, prune = query.prune))] pub(crate) async fn delete_store_entry( State(state): State<AppState>, |
