feat: Impl EndpointArgRegister
for Pagination
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
868ec66b68
commit
d0d048c135
1 changed files with 10 additions and 0 deletions
|
@ -26,7 +26,9 @@ use salvo::{
|
||||||
extract::Metadata as ExtractMetadata,
|
extract::Metadata as ExtractMetadata,
|
||||||
oapi::{
|
oapi::{
|
||||||
Components as OapiComponents,
|
Components as OapiComponents,
|
||||||
|
EndpointArgRegister,
|
||||||
Object,
|
Object,
|
||||||
|
Operation as OapiOperation,
|
||||||
Parameter,
|
Parameter,
|
||||||
ParameterIn,
|
ParameterIn,
|
||||||
Parameters,
|
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
|
/// Extract a query parameter from the request
|
||||||
fn extract_query<T: FromStr>(req: &Request, name: &str, default_value: T) -> ApiResult<T>
|
fn extract_query<T: FromStr>(req: &Request, name: &str, default_value: T) -> ApiResult<T>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue