Skip to content

Commit

Permalink
axum 0.6 and friends 馃帀 (#1570)
Browse files Browse the repository at this point in the history
* changelog

* bump versions

* reorder changelogs a bit

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Expand fallback inheritance

* Reword tsr

* Mention `parse-body-based-on-content-type` example

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
  • Loading branch information
davidpdrsn and jplatte committed Nov 25, 2022
1 parent 0b26411 commit 1b6780c
Show file tree
Hide file tree
Showing 10 changed files with 541 additions and 21 deletions.
17 changes: 17 additions & 0 deletions axum-core/CHANGELOG.md
Expand Up @@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- None.

# 0.3.0 (25. November, 2022)

- **added:** Added new `FromRequestParts` trait. See axum's changelog for more
details ([#1272])
- **breaking:** `FromRequest` has been reworked and `RequestParts` has been
removed. See axum's changelog for more details ([#1272])
- **breaking:** `BodyAlreadyExtracted` has been removed ([#1272])
- **breaking:** `AppendHeaders` now works on any `impl IntoIterator` ([#1495])

[#1272]: https://github.com/tokio-rs/axum/pull/1272
[#1495]: https://github.com/tokio-rs/axum/pull/1495

<details>
<summary>0.3.0 Pre-Releases</summary>

# 0.3.0-rc.3 (8. November, 2022)

- **added:** Add `DefaultBodyLimit::max` for changing the default body limit ([#1397])
Expand Down Expand Up @@ -47,6 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1155]: https://github.com/tokio-rs/axum/pull/1155
[#1272]: https://github.com/tokio-rs/axum/pull/1272

</details>

# 0.2.8 (10. September, 2022)

- **breaking:** Added default limit to how much data `Bytes::from_request` will
Expand Down
4 changes: 2 additions & 2 deletions axum-core/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "axum-core"
readme = "README.md"
repository = "https://github.com/tokio-rs/axum"
version = "0.3.0-rc.3" # remember to also bump the version that axum depends on
version = "0.3.0" # remember to also bump the version that axum depends on

[dependencies]
async-trait = "0.1"
Expand All @@ -25,7 +25,7 @@ tower-service = "0.3"
rustversion = "1.0.9"

[dev-dependencies]
axum = { path = "../axum", version = "0.6.0-rc.2" }
axum = { path = "../axum", version = "0.6.0" }
futures-util = "0.3"
hyper = "0.14"
tokio = { version = "1.0", features = ["macros"] }
Expand Down
12 changes: 6 additions & 6 deletions axum-core/src/extract/default_body_limit.rs
Expand Up @@ -66,8 +66,8 @@ use tower_layer::Layer;
///
/// [`Body::data`]: http_body::Body::data
/// [`Bytes`]: bytes::Bytes
/// [`Json`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Form.html
/// [`Json`]: https://docs.rs/axum/0.6.0/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0/axum/struct.Form.html
/// [`FromRequest`]: crate::extract::FromRequest
/// [`RequestBodyLimit`]: https://docs.rs/tower-http/latest/tower_http/limit/struct.RequestBodyLimit.html
/// [`RequestExt::with_limited_body`]: crate::RequestExt::with_limited_body
Expand Down Expand Up @@ -114,8 +114,8 @@ impl DefaultBodyLimit {
///
/// [`tower_http::limit`]: https://docs.rs/tower-http/0.3.4/tower_http/limit/index.html
/// [`Bytes`]: bytes::Bytes
/// [`Json`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Form.html
/// [`Json`]: https://docs.rs/axum/0.6.0/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0/axum/struct.Form.html
pub fn disable() -> Self {
Self {
kind: DefaultBodyLimitKind::Disable,
Expand Down Expand Up @@ -147,8 +147,8 @@ impl DefaultBodyLimit {
/// ```
///
/// [`Bytes::from_request`]: bytes::Bytes
/// [`Json`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0-rc.2/axum/struct.Form.html
/// [`Json`]: https://docs.rs/axum/0.6.0/axum/struct.Json.html
/// [`Form`]: https://docs.rs/axum/0.6.0/axum/struct.Form.html
pub fn max(limit: usize) -> Self {
Self {
kind: DefaultBodyLimitKind::Limit(limit),
Expand Down
4 changes: 2 additions & 2 deletions axum-core/src/extract/mod.rs
Expand Up @@ -37,7 +37,7 @@ mod private {
///
/// See [`axum::extract`] for more general docs about extraxtors.
///
/// [`axum::extract`]: https://docs.rs/axum/0.6.0-rc.2/axum/extract/index.html
/// [`axum::extract`]: https://docs.rs/axum/0.6.0/axum/extract/index.html
#[async_trait]
#[cfg_attr(
nightly_error_messages,
Expand Down Expand Up @@ -106,7 +106,7 @@ pub trait FromRequestParts<S>: Sized {
/// This ensures your extractor is as flexible as possible.
///
/// [`http::Request<B>`]: http::Request
/// [`axum::extract`]: https://docs.rs/axum/0.6.0-rc.2/axum/extract/index.html
/// [`axum::extract`]: https://docs.rs/axum/0.6.0/axum/extract/index.html
#[async_trait]
#[cfg_attr(
nightly_error_messages,
Expand Down
41 changes: 41 additions & 0 deletions axum-extra/CHANGELOG.md
Expand Up @@ -9,6 +9,45 @@ and this project adheres to [Semantic Versioning].

- None.

# 0.4.0 (25. November, 2022)

- **added:** Add `RouterExt::route_with_tsr` for adding routes with an
additional "trailing slash redirect" route ([#1119])
- **added:** Support chaining handlers with `HandlerCallWithExtractors::or` ([#1170])
- **added:** Add Protocol Buffer extractor and response ([#1239])
- **added:** Add `Either*` types for combining extractors and responses into a
single type ([#1263])
- **added:** `WithRejection` extractor for customizing other extractors' rejections ([#1262])
- **added:** Add sync constructors to `CookieJar`, `PrivateCookieJar`, and
`SignedCookieJar` so they're easier to use in custom middleware
- **changed:** For methods that accept some `S: Service`, the bounds have been
relaxed so the return type can be any type that implements `IntoResponse` rather than being a
literal `Response`
- **change:** axum-extra's MSRV is now 1.60 ([#1239])
- **breaking:** `Form` has a new rejection type ([#1496])
- **breaking:** `Query` has a new rejection type ([#1496])
- **breaking:** `Resource::nest` and `Resource::nest_collection` have been
removed. You can instead convert the `Resource` into a `Router` and
add additional routes as necessary ([#1086])
- **breaking:** `SignedCookieJar` and `PrivateCookieJar` now extracts the keys
from the router's state, rather than extensions
- **breaking:** `Resource` has a new `S` type param which represents the state ([#1155])
- **breaking:** `RouterExt::route_with_tsr` now only accepts `MethodRouter`s ([#1155])
- **added:** `RouterExt::route_service_with_tsr` for routing to any `Service` ([#1155])

[#1086]: https://github.com/tokio-rs/axum/pull/1086
[#1119]: https://github.com/tokio-rs/axum/pull/1119
[#1155]: https://github.com/tokio-rs/axum/pull/1155
[#1170]: https://github.com/tokio-rs/axum/pull/1170
[#1214]: https://github.com/tokio-rs/axum/pull/1214
[#1239]: https://github.com/tokio-rs/axum/pull/1239
[#1262]: https://github.com/tokio-rs/axum/pull/1262
[#1263]: https://github.com/tokio-rs/axum/pull/1263
[#1496]: https://github.com/tokio-rs/axum/pull/1496

<details>
<summary>0.4.0 Pre-Releases</summary>

# 0.4.0-rc.3 (19. November, 2022)

- **breaking:** Depend axum 0.6.0-rc.5 and axum-macros 0.3.0-rc.3
Expand Down Expand Up @@ -53,6 +92,8 @@ and this project adheres to [Semantic Versioning].
[#1262]: https://github.com/tokio-rs/axum/pull/1262
[#1263]: https://github.com/tokio-rs/axum/pull/1263

</details>

# 0.3.7 (09. August, 2022)

- **fixed:** Depend on axum 0.5.15 which contains a fix for an accidental breaking change.
Expand Down
8 changes: 4 additions & 4 deletions axum-extra/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "axum-extra"
readme = "README.md"
repository = "https://github.com/tokio-rs/axum"
version = "0.4.0-rc.3"
version = "0.4.0"

[features]
default = []
Expand All @@ -35,7 +35,7 @@ spa = ["tower-http/fs"]
typed-routing = ["dep:axum-macros", "dep:serde", "dep:percent-encoding"]

[dependencies]
axum = { path = "../axum", version = "=0.6.0-rc.5", default-features = false }
axum = { path = "../axum", version = "0.6.0", default-features = false }
bytes = "1.1.0"
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
http = "0.2"
Expand All @@ -48,7 +48,7 @@ tower-layer = "0.3"
tower-service = "0.3"

# optional dependencies
axum-macros = { path = "../axum-macros", version = "=0.3.0-rc.3", optional = true }
axum-macros = { path = "../axum-macros", version = "0.3.0", optional = true }
cookie = { package = "cookie", version = "0.16", features = ["percent-encode"], optional = true }
percent-encoding = { version = "2.1", optional = true }
prost = { version = "0.11", optional = true }
Expand All @@ -59,7 +59,7 @@ tokio-stream = { version = "0.1.9", optional = true }
tokio-util = { version = "0.7", optional = true }

[dev-dependencies]
axum = { path = "../axum", version = "=0.6.0-rc.5", features = ["headers"] }
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
futures = "0.3"
hyper = "0.14"
reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] }
Expand Down
26 changes: 26 additions & 0 deletions axum-macros/CHANGELOG.md
Expand Up @@ -9,6 +9,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- None.

# 0.3.0 (25. November, 2022)

- **added:** Add `#[derive(FromRequestParts)]` for deriving an implementation of
`FromRequestParts`, similarly to `#[derive(FromRequest)]` ([#1305])
- **added:** Add `#[derive(FromRef)]` ([#1430])
- **added:** Add `#[from_ref(skip)]` to skip implementing `FromRef` for individual fields ([#1537])
- **added:** Support using a different rejection for `#[derive(FromRequest)]`
with `#[from_request(rejection(MyRejection))]` ([#1256])
- **change:** axum-macro's MSRV is now 1.60 ([#1239])
- **breaking:** `#[derive(FromRequest)]` will no longer generate a rejection
enum but instead generate `type Rejection = axum::response::Response`. Use the
new `#[from_request(rejection(MyRejection))]` attribute to change this.
The `rejection_derive` attribute has also been removed ([#1272])

[#1239]: https://github.com/tokio-rs/axum/pull/1239
[#1256]: https://github.com/tokio-rs/axum/pull/1256
[#1272]: https://github.com/tokio-rs/axum/pull/1272
[#1305]: https://github.com/tokio-rs/axum/pull/1305
[#1430]: https://github.com/tokio-rs/axum/pull/1430
[#1537]: https://github.com/tokio-rs/axum/pull/1537

<details>
<summary>0.3.0 Pre-Releases</summary>

# 0.3.0-rc.3 (18. November, 2022)

- **added:** Add `#[from_ref(skip)]` to skip implementing `FromRef` for individual fields ([#1537])
Expand Down Expand Up @@ -38,6 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1272]: https://github.com/tokio-rs/axum/pull/1272
[#1305]: https://github.com/tokio-rs/axum/pull/1305

</details>

# 0.2.3 (27. June, 2022)

- **change:** axum-macros's MSRV is now 1.56 ([#1098])
Expand Down
6 changes: 3 additions & 3 deletions axum-macros/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "axum-macros"
readme = "README.md"
repository = "https://github.com/tokio-rs/axum"
version = "0.3.0-rc.3" # remember to also bump the version that axum and axum-extra depends on
version = "0.3.0" # remember to also bump the version that axum and axum-extra depends on

[lib]
proc-macro = true
Expand All @@ -25,8 +25,8 @@ syn = { version = "1.0", features = [
] }

[dev-dependencies]
axum = { path = "../axum", version = "=0.6.0-rc.5", features = ["headers", "macros"] }
axum-extra = { path = "../axum-extra", version = "=0.4.0-rc.3", features = ["typed-routing", "cookie-private"] }
axum = { path = "../axum", version = "0.6.0", features = ["headers", "macros"] }
axum-extra = { path = "../axum-extra", version = "0.4.0", features = ["typed-routing", "cookie-private"] }
rustversion = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down

0 comments on commit 1b6780c

Please sign in to comment.