roas-http-validator 0.2.1

Validates HTTP requests against an OpenAPI description, with adapters for axum, actix-web, poem, salvo and rocket
Documentation
[package]
name = "roas-http-validator"
version = "0.2.1"
edition.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
keywords = ["openapi", "validation", "http", "request", "middleware"]
description = "Validates HTTP requests against an OpenAPI description, with adapters for axum, actix-web, poem, salvo and rocket"
readme = "README.md"
categories = ["web-programming", "development-tools::testing"]
include = ["src", "examples", "Cargo.toml", "README.md"]
publish = true

[package.metadata.docs.rs]
all-features = true

[features]
default = []

# Accept an OpenAPI description written to an older version, upconverting
# it to v3.2 first. Without these only a v3.2 description is accepted.
v3_1 = ["roas/v3_1"]
v3_0 = ["roas/v3_0", "v3_1"]
v2 = ["roas/v2", "v3_0"]

# Adapters from a framework's own request type to `RequestView`.
# `http` covers axum, warp, tonic, hyper and anything else built on
# `http::Request`; the rest carry their own type.
http = ["dep:http"]
# The client side: `reqwest::Request` and its blocking twin, for
# checking an outgoing call against the description.
reqwest = ["dep:reqwest"]
actix-web = ["dep:actix-web"]
poem = ["dep:poem"]
salvo = ["dep:salvo_core"]
rocket = ["dep:rocket"]

[dependencies]
# `exact-numbers` is what makes a schema's bounds the numbers they
# were written as; the `serde_json` feature below is the same toggle
# for the request bodies this crate parses itself. Both are named
# because they are two different reasons to want it.
roas = { version = "0.20", path = "../roas", features = ["v3_2", "exact-numbers"] }
percent-encoding.workspace = true
regex.workspace = true
# The whole point of `decimal.rs`: this keeps a parsed number's
# literal, which is the evidence `f64` destroys. Cargo unifies
# features, so `roas` gets it whenever it is built alongside this
# crate — and a consumer of `roas` alone is left alone.
serde_json = { workspace = true, features = ["arbitrary_precision"] }
thiserror.workspace = true

actix-web = { workspace = true, optional = true }
http = { workspace = true, optional = true }
poem = { workspace = true, optional = true }
reqwest = { workspace = true, optional = true }
rocket = { workspace = true, optional = true }
salvo_core = { workspace = true, optional = true }

[dev-dependencies]
axum.workspace = true
http-body-util.workspace = true
serde_yaml_ng.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tower = { workspace = true, features = ["util"] }

# `validate` needs no framework at all; the other two show one each.
[[example]]
name = "validate"

[[example]]
name = "axum_layer"
required-features = ["http"]

[[example]]
name = "client_check"
required-features = ["reqwest"]