rambler-digital-solutions/actix-web-validator

actix-web-validator

This crate is a Rust library for providing validation mechanism to actix-web with Validator crate

actix-web-validator

This crate is a Rust library for providing validation mechanism to actix-web with Validator crate

Installation

This crate works with Cargo and can be found on crates.io with a Cargo.toml like:

Supported extractors:

  • actix_web::web::Json
  • actix_web::web::Query
  • actix_web::web::Path
  • actix_web::web::Form
  • serde_qs::actix::QsQuery

Supported actix_web versions:

  • For actix-web-validator 0.* supported version of actix-web is 1.*
  • For actix-web-validator 1.* supported version of actix-web is 2.*
  • For actix-web-validator 2.* supported version of actix-web is 3.*
  • For actix-web-validator 3.* supported version of actix-web is 4.*

Example:

License

actix-web-validator is licensed under MIT license (LICENSE or #404)

Issues

Collection of the latest Issues

JohnSchneider

JohnSchneider

Comment Icon0

I have Actix-Web web services properly responding with HTTP 400 codes and descriptive error message when validation fails for simple use cases. However, when using nested validation (struct with derived Validate containing another struct with derived Validate), the error message returned by Actix-Web-Validator is not very descriptive.

Please consider the following stucts:

If I have a web service with input param Json<PageParams> and validation fails, I get a descriptive error message such as this:

Validation errors in fields: pageSize: range

However, if I have a web service with input param Json<SearchParams> and validation fails on the same page_size field of the PageParams struct (nested validation), then the error message does not indicate which nested field failed validation or why:

Validation errors in fields:

vimmerru

vimmerru

Comment Icon5

Current suggested way is to import json extractor as and is deprecated.

The problem with this approach actix::web::Json used not only as Extractor, but also as Responder and usual signature is

As a result it can't be in-place replacement and i have in near all my endpoints.

Versions

Find the latest versions by id

2.2.0 - Oct 05, 2021

[2.2.0] 2021-10-04

Added

  • #27: Add validation support for Form extractor.

2.1.1 - Jun 07, 2021

[2.1.1] 2021-06-07

Fixed

  • Fix QsQuery and QsQueryConfig documentation.

2.1.0 - Jun 07, 2021

[2.1.0] 2021-06-07

Added

  • #23: Add serde_qs support query deserialization.
  • #20: Adds some additional information about validation errors into default HTTP response.

Deprecated

  • Deprecate of reexporting validator::Validate trait.

Information - Updated Mar 15, 2022

Stars: 42
Forks: 17
Issues: 4
Actix

7.2K

Actix Rust Framework for web and wasm based applications

Rust's premier framework for handling large scale web applications across a wide varaitey of operating systems

Actix Rust Framework for web and wasm based applications

Rust/Actix Example

REST server using the Rust language to give you an idea of how it all works

Rust/Actix Example

Example using Rust Actix-web (web framework) with juniper (Graphql) with diesel (ORM)

Diesel's Getting Started guide using SQLite for Actix web

Example using Rust Actix-web (web framework) with juniper (Graphql) with diesel (ORM)

Example microservice in Rust and Actix

Beginners guide to using rust with a simple example

Example microservice in Rust and Actix

rust_actixweb_boilerplate

The Rust Actix_Web Boilerplate is a boilerplate for developers who want to get started with Actix_web's web applications faster

rust_actixweb_boilerplate

REST API with Rust using Actix-Web 2

GET /users ➡ returns all users

REST API with Rust using Actix-Web 2

REST API with Rust using Actix-Web 2

GET /users ➡ returns all users

REST API with Rust using Actix-Web 2

rust-actix-rest-api-boilerplate

A Rust RESTful API server with actix web and docker

rust-actix-rest-api-boilerplate

Rust actix json request example

Send a json request to actix, and parse it

Rust actix json request example

rust-actix-graphql-sqlx-postgresql

Using GraphQL with Rust and Apollo Federation

rust-actix-graphql-sqlx-postgresql

rust-actix-react-web-starter

A bare Rust web app that uses Diesel and License

rust-actix-react-web-starter

REST-API-with-Rust-and-Actix

This is a simple REST API developed using RUST Actix

REST-API-with-Rust-and-Actix
Facebook Instagram Twitter GitHub Dribbble
Privacy