Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade garde to 0.15 #4

Merged
1 commit merged into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <oss@netwo.com>"]
edition = "2021"
Expand All @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<T>` | [`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).
Expand Down
8 changes: 4 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")]
Expand All @@ -24,8 +24,8 @@ pub enum Error {
QsError(serde_qs::Error),
}

impl From<Errors> for Error {
fn from(error: Errors) -> Self {
impl From<Report> for Error {
fn from(error: Report) -> Self {
Self::ValidationError(error)
}
}
Expand Down