feat: Add support for aide
This commit is contained in:
23
CHANGELOG.md
23
CHANGELOG.md
@@ -8,6 +8,29 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
## axum-valid 0.13.0 (2023-12-14)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* Update axum-serde from 0.1.0 to 0.2.0
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
## axum-valid 0.12.0 (2023-12-04)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Add Support for Xml, Toml from axum-serde.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* Update axum from 0.6 to 0.7.
|
||||||
|
* Use axum-serde instead of axum-yaml and axum-msgpack.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
## axum-valid 0.11.0 (2023-10-21)
|
## axum-valid 0.11.0 (2023-10-21)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "axum-valid"
|
name = "axum-valid"
|
||||||
version = "0.13.0"
|
version = "0.14.0"
|
||||||
description = "Provides validation extractors for your Axum application, allowing you to validate data using validator, garde, validify or all of them."
|
description = "Provides validation extractors for your Axum application, allowing you to validate data using validator, garde, validify or all of them."
|
||||||
authors = ["GengTeng <me@gteng.org>"]
|
authors = ["GengTeng <me@gteng.org>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -47,6 +47,10 @@ optional = true
|
|||||||
version = "1.0.193"
|
version = "1.0.193"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
[dependencies.aide]
|
||||||
|
version = "0.13.0"
|
||||||
|
optional = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1.0.72"
|
anyhow = "1.0.72"
|
||||||
axum = { version = "0.7.1", features = ["macros"] }
|
axum = { version = "0.7.1", features = ["macros"] }
|
||||||
@@ -92,3 +96,4 @@ full_validator = ["validator", "all_types", "422", "into_json"]
|
|||||||
full_garde = ["garde", "all_types", "422", "into_json"]
|
full_garde = ["garde", "all_types", "422", "into_json"]
|
||||||
full_validify = ["validify", "all_types", "422", "into_json"]
|
full_validify = ["validify", "all_types", "422", "into_json"]
|
||||||
full = ["full_validator", "full_garde", "full_validify"]
|
full = ["full_validator", "full_garde", "full_validify"]
|
||||||
|
aide = ["dep:aide", "aide/macros"]
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ use std::ops::{Deref, DerefMut};
|
|||||||
/// If using arguments, you must pass the arguments to Garde extractor via state, meaning implementing `FromRef<StateType>` for your validation arguments type.
|
/// If using arguments, you must pass the arguments to Garde extractor via state, meaning implementing `FromRef<StateType>` for your validation arguments type.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct Garde<E>(pub E);
|
pub struct Garde<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for Garde<E> {
|
impl<E> Deref for Garde<E> {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ use validator::{Validate, ValidateArgs, ValidationErrors};
|
|||||||
/// For examples with custom extractors, check out the `tests/custom.rs` file.
|
/// For examples with custom extractors, check out the `tests/custom.rs` file.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct Valid<E>(pub E);
|
pub struct Valid<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for Valid<E> {
|
impl<E> Deref for Valid<E> {
|
||||||
@@ -71,6 +72,7 @@ impl<E> Valid<E> {
|
|||||||
/// Although current module documentation predominantly showcases `Valid` examples, the usage of `ValidEx` is analogous.
|
/// Although current module documentation predominantly showcases `Valid` examples, the usage of `ValidEx` is analogous.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct ValidEx<E, A>(pub E, pub A);
|
pub struct ValidEx<E, A>(pub E, pub A);
|
||||||
|
|
||||||
impl<E, A> Deref for ValidEx<E, A> {
|
impl<E, A> Deref for ValidEx<E, A> {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ use validify::{Modify, Validate, ValidationErrors, Validify};
|
|||||||
/// It only does validation, usage is similar to `Valid`.
|
/// It only does validation, usage is similar to `Valid`.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct Validated<E>(pub E);
|
pub struct Validated<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for Validated<E> {
|
impl<E> Deref for Validated<E> {
|
||||||
@@ -73,6 +74,7 @@ impl<E> Validated<E> {
|
|||||||
///
|
///
|
||||||
/// This allows applying modifications during response conversion by leveraging validify.
|
/// This allows applying modifications during response conversion by leveraging validify.
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct Modified<E>(pub E);
|
pub struct Modified<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for Modified<E> {
|
impl<E> Deref for Modified<E> {
|
||||||
@@ -121,6 +123,7 @@ impl<E: IntoResponse + HasModify> IntoResponse for Modified<E> {
|
|||||||
/// And can treat missing fields as validation errors.
|
/// And can treat missing fields as validation errors.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct Validified<E>(pub E);
|
pub struct Validified<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for Validified<E> {
|
impl<E> Deref for Validified<E> {
|
||||||
@@ -160,6 +163,7 @@ impl<E> Validified<E> {
|
|||||||
/// Suitable for inner extractors not based on `serde`.
|
/// Suitable for inner extractors not based on `serde`.
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[cfg_attr(feature = "aide", derive(aide::OperationIo))]
|
||||||
pub struct ValidifiedByRef<E>(pub E);
|
pub struct ValidifiedByRef<E>(pub E);
|
||||||
|
|
||||||
impl<E> Deref for ValidifiedByRef<E> {
|
impl<E> Deref for ValidifiedByRef<E> {
|
||||||
|
|||||||
Reference in New Issue
Block a user