From 0b188e3850beef727eb0956a6f713d64938b3ddb Mon Sep 17 00:00:00 2001 From: Romain Lebran Date: Tue, 3 Oct 2023 17:53:23 +0200 Subject: [PATCH] Upgrade garde to 0.15 --- Cargo.toml | 4 ++-- README.md | 9 +++++++++ src/error.rs | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8028eb0..e1ce19c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ description = "Actix-web garde wrapper" readme = "README.md" keywords = ["garde", "actix", "actix-web", "validation"] categories = ["web-programming"] -version = "0.1.1" +version = "0.2.0" authors = ["Netwo "] edition = "2021" @@ -19,7 +19,7 @@ actix-router = "0.5" actix-web = "4" derive_more = "0.99" futures = "0.3" -garde = "0.14" +garde = "0.15" log = "0.4" mime = "0.3" pin-project-lite = "0.2" diff --git a/README.md b/README.md index 8b143bd..8542423 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Actix-web wrapper for [garde](https://github.com/jprochazk/garde), a Rust valida - [Installation](#installation) - [Usage example](#usage-example) - [Feature flags](#feature-flags) +- [Compatibility matrix](#compatibility-matrix) - [About us](#about-us) ### Installation @@ -62,6 +63,14 @@ Context needs to be provided through actix's `data` or `app_data`, if not found | `serde_qs` | Enables the usage of `garde` for `serde_qs::actix::QsQuery` | [`serde_qs`](https://crates.io/crates/serde_qs) | +### Compatibility matrix + +| garde version | garde-actix-web-version | +|---------------|-------------------------| +| `0.14` | `0.1.x` | +| `0.15` | `0.2.x` | + + ### About us Garde-actix-web is provided by [Netwo](https://www.netwo.io). diff --git a/src/error.rs b/src/error.rs index 59548f0..deee3fe 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,13 +4,13 @@ use actix_web::error::{JsonPayloadError, PathError, QueryPayloadError, UrlencodedError}; use actix_web::http::StatusCode; use actix_web::{HttpResponse, ResponseError}; -use garde::Errors; +use garde::Report; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("Validation error: {0}")] - ValidationError(Errors), + ValidationError(Report), #[error("Payload error: {0}")] JsonPayloadError(JsonPayloadError), #[error("Payload error: {0}")] @@ -24,8 +24,8 @@ pub enum Error { QsError(serde_qs::Error), } -impl From for Error { - fn from(error: Errors) -> Self { +impl From for Error { + fn from(error: Report) -> Self { Self::ValidationError(error) } }