update README.md

This commit is contained in:
gengteng
2023-08-04 22:52:48 +08:00
parent 82dc642c16
commit 11991a06c8

View File

@@ -6,9 +6,9 @@
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/gengteng/axum-valid/.github/workflows/main.yml?branch=main)](https://github.com/gengteng/axum-valid/actions/workflows/ci.yml) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/gengteng/axum-valid/.github/workflows/main.yml?branch=main)](https://github.com/gengteng/axum-valid/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/gengteng/axum-valid/badge.svg?branch=main)](https://coveralls.io/github/gengteng/axum-valid?branch=main) [![Coverage Status](https://coveralls.io/repos/github/gengteng/axum-valid/badge.svg?branch=main)](https://coveralls.io/github/gengteng/axum-valid?branch=main)
This crate provides a `Valid` type that can be used in combination with `Json`, `Path`, `Query`, and `Form` types to validate the entities that implement the `Validate` trait from the `validator` crate. This crate provides a `Valid` type that can be used in combination with `Json`, `Path`, `Query`, and `Form` extractors to validate the entities that implement the `Validate` trait from the `validator` crate.
Additional extractors like `TypedHeader`, `MsgPack`, `Yaml` etc. are supported through optional features. Additional extractors like `TypedHeader`, `MsgPack`, `Yaml` etc. are supported through optional features. The full list of supported extractors is in the Features section below.
## Usage ## Usage
@@ -57,17 +57,18 @@ When validation errors occur, the extractor will automatically return 400 with v
| query | Enables support for `Query` | ✅ | ✅ | | query | Enables support for `Query` | ✅ | ✅ |
| form | Enables support for `Form` | ✅ | ✅ | | form | Enables support for `Form` | ✅ | ✅ |
| typed_header | Enables support for `TypedHeader` | ❌ | ✅ | | typed_header | Enables support for `TypedHeader` | ❌ | ✅ |
| msgpack | Enables support for `MsgPack` and `MsgPackRaw` from `axum-msgpack` | ❌ | | | msgpack | Enables support for `MsgPack` and `MsgPackRaw` from `axum-msgpack` | ❌ | |
| yaml | Enables support for `Yaml` from `axum-yaml` | ❌ | | | yaml | Enables support for `Yaml` from `axum-yaml` | ❌ | |
| extra | Enables support for `Cached`, `WithRejection` from `axum-extra` | ❌ | ✅ | | extra | Enables support for `Cached`, `WithRejection` from `axum-extra` | ❌ | ✅ |
| extra_query | Enables support for `Query` from `axum-extra` | ❌ | ✅ | | extra_query | Enables support for `Query` from `axum-extra` | ❌ | ✅ |
| extra_form | Enables support for `Form` from `axum-extra` | ❌ | ✅ | | extra_form | Enables support for `Form` from `axum-extra` | ❌ | ✅ |
| extra_protobuf | Enables support for `Protobuf` from `axum-extra` | ❌ | ✅ | | extra_protobuf | Enables support for `Protobuf` from `axum-extra` | ❌ | ✅ |
| all_extra_types | Enables support for all extractors above from `axum-extra` | ❌ | ✅ | | all_extra_types | Enables support for all extractors above from `axum-extra` | ❌ | ✅ |
| all_types | Enables support for all extractors above | ❌ | 🚧 | | all_types | Enables support for all extractors above | ❌ | |
| 422 | Use `422 Unprocessable Entity` instead of `400 Bad Request` as the status code when validation fails | ❌ | ✅ | | 422 | Use `422 Unprocessable Entity` instead of `400 Bad Request` as the status code when validation fails | ❌ | ✅ |
| into_json | Validation errors will be serialized into JSON format and returned as the HTTP body | ❌ | ✅ | | into_json | Validation errors will be serialized into JSON format and returned as the HTTP body | ❌ | ✅ |
| full | Enables all features | ❌ | 🚧 | | full | Enables all features | ❌ | |
## License ## License
This project is licensed under the MIT License. This project is licensed under the MIT License.