From 69cbdd998a29d9263e5311bf2481fd8035652c63 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 15 Jan 2025 13:23:15 +0700 Subject: [PATCH] fix(cat-gateway): Response Documentation consistency for document endpoints --- .../bin/src/service/api/documents/get_document.rs | 4 ++++ .../src/service/api/documents/put_document/mod.rs | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/catalyst-gateway/bin/src/service/api/documents/get_document.rs b/catalyst-gateway/bin/src/service/api/documents/get_document.rs index adf80bf32ae..00c5ba4b9ab 100644 --- a/catalyst-gateway/bin/src/service/api/documents/get_document.rs +++ b/catalyst-gateway/bin/src/service/api/documents/get_document.rs @@ -9,9 +9,13 @@ use crate::service::common::{responses::WithErrorResponses, types::payload::cbor #[derive(ApiResponse)] #[allow(dead_code)] pub(crate) enum Responses { + /// ## OK + /// /// The Document that was requested. #[oai(status = 200)] Ok(Cbor), + /// ## Not Found + /// /// The document could not be found. #[oai(status = 404)] NotFound, diff --git a/catalyst-gateway/bin/src/service/api/documents/put_document/mod.rs b/catalyst-gateway/bin/src/service/api/documents/put_document/mod.rs index 630a57b4b80..ddef4f7fa65 100644 --- a/catalyst-gateway/bin/src/service/api/documents/put_document/mod.rs +++ b/catalyst-gateway/bin/src/service/api/documents/put_document/mod.rs @@ -15,20 +15,25 @@ pub(crate) const MAXIMUM_DOCUMENT_SIZE: usize = 1_048_576; #[derive(ApiResponse)] #[allow(dead_code)] pub(crate) enum Responses { + /// ## Created + /// /// The Document was stored OK for the first time. #[oai(status = 201)] Created, + /// ## No Content + /// /// The Document was already stored, and has not changed. #[oai(status = 204)] NoContent, - /// Error Response + /// ## Bad Request /// - /// The document submitted is invalid. + /// Error Response. The document submitted is invalid. #[oai(status = 400)] BadRequest(Json), - /// Payload Too Large + /// ## Content Too Large /// - /// The document exceeds the maximum size of a legitimate single document. + /// Payload Too Large. The document exceeds the maximum size of a legitimate single + /// document. #[oai(status = 413)] PayloadTooLarge, }