deps: bump axum to 0.8
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
//! # Test for validator
|
||||
//!
|
||||
|
||||
#![cfg(feature = "validator")]
|
||||
|
||||
use crate::tests::{ValidTest, ValidTestParameter};
|
||||
@@ -16,6 +19,8 @@ use std::sync::Arc;
|
||||
use tokio::net::TcpListener;
|
||||
use validator::{Validate, ValidateArgs, ValidationError};
|
||||
|
||||
/// Parameters
|
||||
///
|
||||
#[derive(Clone, Deserialize, Serialize, Validate, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "extra_protobuf", derive(prost::Message))]
|
||||
#[cfg_attr(
|
||||
@@ -31,6 +36,8 @@ pub struct Parameters {
|
||||
v1: String,
|
||||
}
|
||||
|
||||
/// ParametersEx
|
||||
///
|
||||
#[derive(Clone, Deserialize, Serialize, Validate, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "extra_protobuf", derive(prost::Message))]
|
||||
#[cfg_attr(
|
||||
@@ -69,6 +76,8 @@ struct ParametersExValidationArgumentsInner {
|
||||
v1_length_range: RangeInclusive<usize>,
|
||||
}
|
||||
|
||||
/// ParametersExValidationArguments
|
||||
///
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ParametersExValidationArguments {
|
||||
inner: Arc<ParametersExValidationArgumentsInner>,
|
||||
@@ -663,6 +672,7 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Test Executor
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TestExecutor {
|
||||
client: reqwest::Client,
|
||||
@@ -725,6 +735,7 @@ impl TestExecutor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get reqwest client reference
|
||||
pub fn client(&self) -> &reqwest::Client {
|
||||
&self.client
|
||||
}
|
||||
@@ -743,8 +754,8 @@ pub async fn check_json(type_name: &'static str, response: reqwest::Response) {
|
||||
}
|
||||
|
||||
mod route {
|
||||
pub const PATH: &str = "/path/:v0/:v1";
|
||||
pub const PATH_EX: &str = "/path_ex/:v0/:v1";
|
||||
pub const PATH: &str = "/path/{v0}/{v1}";
|
||||
pub const PATH_EX: &str = "/path_ex/{v0}/{v1}";
|
||||
pub const QUERY: &str = "/query";
|
||||
pub const QUERY_EX: &str = "/query_ex";
|
||||
pub const FORM: &str = "/form";
|
||||
@@ -1036,7 +1047,7 @@ mod extra {
|
||||
}
|
||||
|
||||
// 1.3. Implement your extractor (`FromRequestParts` or `FromRequest`)
|
||||
#[axum::async_trait]
|
||||
|
||||
impl<S> FromRequestParts<S> for Parameters
|
||||
where
|
||||
S: Send + Sync,
|
||||
@@ -1052,7 +1063,6 @@ mod extra {
|
||||
}
|
||||
}
|
||||
|
||||
#[axum::async_trait]
|
||||
impl<S> FromRequestParts<S> for ParametersEx
|
||||
where
|
||||
S: Send + Sync,
|
||||
@@ -1198,12 +1208,12 @@ mod extra_typed_path {
|
||||
use validator::{Validate, ValidationError};
|
||||
|
||||
pub mod route {
|
||||
pub const EXTRA_TYPED_PATH: &str = "/extra_typed_path/:v0/:v1";
|
||||
pub const EXTRA_TYPED_PATH_EX: &str = "/extra_typed_path_ex/:v0/:v1";
|
||||
pub const EXTRA_TYPED_PATH: &str = "/extra_typed_path/{v0}/{v1}";
|
||||
pub const EXTRA_TYPED_PATH_EX: &str = "/extra_typed_path_ex/{v0}/{v1}";
|
||||
}
|
||||
|
||||
#[derive(Validate, TypedPath, Deserialize)]
|
||||
#[typed_path("/extra_typed_path/:v0/:v1")]
|
||||
#[typed_path("/extra_typed_path/{v0}/{v1}")]
|
||||
pub struct TypedPathParam {
|
||||
#[validate(range(min = 5, max = 10))]
|
||||
v0: i32,
|
||||
@@ -1244,7 +1254,7 @@ mod extra_typed_path {
|
||||
}
|
||||
|
||||
#[derive(Validate, TypedPath, Deserialize)]
|
||||
#[typed_path("/extra_typed_path_ex/:v0/:v1")]
|
||||
#[typed_path("/extra_typed_path_ex/{v0}/{v1}")]
|
||||
#[validate(context = TypedPathParamExValidationArguments)]
|
||||
pub struct TypedPathParamEx {
|
||||
#[validate(custom(function = "validate_v0", use_context))]
|
||||
|
||||
Reference in New Issue
Block a user