From d0d048c135907dad221023f89c6081e28401a8fb Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 18 Jul 2024 10:57:52 +0300 Subject: [PATCH] feat: Impl `EndpointArgRegister` for `Pagination` Signed-off-by: Awiteb --- crates/oxidetalis/src/parameters/pagination.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/oxidetalis/src/parameters/pagination.rs b/crates/oxidetalis/src/parameters/pagination.rs index c31a912..5dab644 100644 --- a/crates/oxidetalis/src/parameters/pagination.rs +++ b/crates/oxidetalis/src/parameters/pagination.rs @@ -26,7 +26,9 @@ use salvo::{ extract::Metadata as ExtractMetadata, oapi::{ Components as OapiComponents, + EndpointArgRegister, Object, + Operation as OapiOperation, Parameter, ParameterIn, Parameters, @@ -86,6 +88,14 @@ impl ToParameters<'_> for Pagination { } } +impl EndpointArgRegister for Pagination { + fn register(components: &mut OapiComponents, operation: &mut OapiOperation, _arg: &str) { + for parameter in Self::to_parameters(components) { + operation.parameters.insert(parameter); + } + } +} + /// Extract a query parameter from the request fn extract_query(req: &Request, name: &str, default_value: T) -> ApiResult where