add test for Garde

This commit is contained in:
gengteng
2023-10-07 21:11:26 +08:00
parent 21ee4e7913
commit 2f1aa1060f
16 changed files with 112 additions and 78 deletions

View File

@@ -40,9 +40,9 @@
use crate::{HasValidate, HasValidateArgs};
use axum_extra::extract::Form;
use validator::{Validate, ValidateArgs};
use validator::ValidateArgs;
impl<T: Validate> HasValidate for Form<T> {
impl<T> HasValidate for Form<T> {
type Validate = T;
fn get_validate(&self) -> &T {
&self.0

View File

@@ -42,9 +42,9 @@
use crate::{HasValidate, HasValidateArgs};
use axum_extra::protobuf::Protobuf;
use validator::{Validate, ValidateArgs};
use validator::ValidateArgs;
impl<T: Validate> HasValidate for Protobuf<T> {
impl<T> HasValidate for Protobuf<T> {
type Validate = T;
fn get_validate(&self) -> &T {
&self.0

View File

@@ -43,9 +43,9 @@
use crate::{HasValidate, HasValidateArgs};
use axum_extra::extract::Query;
use validator::{Validate, ValidateArgs};
use validator::ValidateArgs;
impl<T: Validate> HasValidate for Query<T> {
impl<T> HasValidate for Query<T> {
type Validate = T;
fn get_validate(&self) -> &T {
&self.0

View File

@@ -49,6 +49,7 @@
//! }
//! ```
use crate::garde::Garde;
use crate::{Valid, ValidEx};
use axum_extra::routing::TypedPath;
use std::fmt::Display;
@@ -60,3 +61,7 @@ impl<T: TypedPath + Display> TypedPath for Valid<T> {
impl<T: TypedPath + Display, A> TypedPath for ValidEx<T, A> {
const PATH: &'static str = T::PATH;
}
impl<T: TypedPath + Display> TypedPath for Garde<T> {
const PATH: &'static str = T::PATH;
}