Commit graph

69 commits

Author SHA1 Message Date
David Pedersen
05529c8efc
Check Request and Path in debug_handler (#1035)
* Check `Request` and `Path` in `debug_handler`

* changelog links

* Include errors with the input
2022-05-16 10:05:17 +00:00
David Pedersen
46e6d3493b
axum-macros: Version 0.2.1 (#1015) 2022-05-10 11:46:17 +00:00
David Pedersen
852e548e19
Support #[derive(FromRequest)] on enums (#1009)
* Support `#[from_request(via(...))]` on enums

* Check `#[from_request]` on variants

* check for non enum/struct and clean up

* changelog

* changelog

* remove needless feature

* changelog ref
2022-05-08 20:04:56 +02:00
David Pedersen
6bd726f4a9
Refactor #[derive(FromRequest)] to make illegal state unrepresentable (#1004) 2022-05-06 16:53:12 +02:00
David Pedersen
b5183afbec
Support wildcards in typed paths (#1003)
* Support wildcards in typed paths

* changelog
2022-05-06 13:05:30 +02:00
David Pedersen
4ff78e552d
Support Option and Result in typed paths (#1001)
* Support `Option` and `Result` in typed paths

* changelog

* Update axum-extra/CHANGELOG.md

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

* fix one more

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-05-06 09:42:10 +02:00
David Pedersen
a3b6cbc99c
axum-extra: Version 0.3.0 (#974)
* axum-extra: Version 0.3.0

* add tower-http update to changelog
2022-04-27 10:27:41 +02:00
David Pedersen
5d0a7b440c axum-extra: Version 0.2.0 2022-03-31 20:48:17 +02:00
David Pedersen
f69d2dbf40 axum-macros: Version 0.2.0 2022-03-31 20:45:01 +02:00
David Pedersen
d7860ea9e2
Copy over changelogs from v0.4.x branch (#893)
* Copy over changelogs from v0.4.x branch

Preparing to release 0.5

* bump crate versions
2022-03-31 20:21:55 +02:00
David Pedersen
90e74f12c4
Requires paths start with a / (#823)
* Requires routes to start with `/`

* Also check routes in `TypedPath`

* changelog

* changelog links
2022-03-03 23:24:27 +00:00
David Pedersen
da74084146
Easily convert typed paths into URIs (#790)
* Easily convert typed paths into URIs

`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for
easily converting paths into URIs for use with `Redirect` and friends.

Fixes https://github.com/tokio-rs/axum/issues/789

* Use a method on the `TypedPath` trait to convert to `Uri`

* fix doc ref

* Update changelogs
2022-02-28 09:58:22 +01:00
Matthias Vogelgesang
67c385cd2d
axum-macros: use fully qualified Result type (#796) 2022-02-26 14:27:18 +01:00
David Pedersen
07e8a6d8fe Update trybuild test to rust 1.59 output 2022-02-25 11:30:10 +01:00
David Pedersen
7a228a584b
Type safe routing (#756)
* wip

* wip

* make macro implement trait

* checkpoint

* checkpoint

* Simplify things quite a bit

* re-export `axum_macros::TypedPath` from `axum_extra`

* docs

* add missing feature

* fix docs link

* fix features

* fix missing imports

* make serde an optional dep again

* ui tests

* Break things up a bit

* Update span for `FromRequest` impls to point to callsite

* make docs feature labels show up automatically

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* add note about Display/Serialize being compatible

* Update axum-extra/src/routing/typed.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* fix missing docs link

* what about typed methods?

* Revert "what about typed methods?"

This reverts commit cc1f989467.

* don't allow wildcards for now

* percent encode params

* Update axum-extra/src/routing/typed.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* rephrase args

* changelog

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-02-18 14:13:56 +01:00
David Pedersen
c1cc4b515a Update axum-macros changelog with initial release date 2022-01-31 20:06:59 +01:00
David Pedersen
911c4a788e
Support opt-out of extra derived traits for rejections for #[derive(FromRequest)] (#729)
* Handle structs without fields

* Support opt-out of derived rejection traits

* Handle duplicate opt outs

* Improve error if opting out of `Display` or `Debug` but not `Error`

* document `rejection_derive`

* Handle using both `via` and `rejection_derive`

* don't derive debug for `RejectionDeriveOptOuts`

* Update axum-macros/src/from_request.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-28 09:54:38 +00:00
David Pedersen
f6fc5ed80c
Move axum-debug into axum-macros (#724)
* Move axum-debug into axum-macros

* fix ref to axum-macros in changelog

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-26 23:27:22 +01:00
David Pedersen
e4c389c94d
Add axum-macros crate with #[derive(FromRequest)] (#718)
* initial working impl

* support `#[from_request(via(...))]`

* support extracting the whole thing at once

* rely on type inference

* fix footgun

* fix typo

* generate rejection enums

* move tests to trybuild

* minor clean up

* docs

* Support multiple generic extractors with same "via" type

* support `Result` as well

* Update axum-macros/src/from_request.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Add `#[automatically_derived]`

* remove needless `#[derive(Debug)]` on macro types

* Fix error messages that different for some reason

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* add more `#[automatically_derived]`

* support same types in tuple structs

* update docs

* prep axum-macros for release

* address review feedback

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Update known limitation

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-25 15:05:50 +01:00