Vvinhnx

axum-0-7-to-0-8

Migrate Rust axum routing path syntax from 0.7 to 0.8 for route, route_service, nest, and nest_service definitions

rustaxumroutingwebmigration0.7-to-0.8path-parameters
Public
2 executions

Run locally

npx codemod axum-0-7-to-0-8

axum-0-7-to-0-8

Automate the highest-value deterministic part of the Rust axum migration from v0.7 to v0.8.

What it does

Route path syntax updates

  • /:id -> /{id}
  • /*rest -> /{*rest}
  • Rewrites path strings passed to:
    • .route(...)
    • .route_service(...)
    • .nest(...)
    • .nest_service(...)
  • Supports normal Rust string literals and raw string literals used in those route definitions

Cargo.toml follow-up

  • Update axum = "0.7.x" -> axum = "0.8"
  • Update axum = { version = "0.7.x", ... } -> axum = { version = "0.8", ... }

Usage

bash

Manual follow-up

After running, you should:

  1. Review Cargo.toml updates for uncommon axum dependency formatting not covered by deterministic rewrites
  2. Review custom route strings outside .route, .route_service, .nest, and .nest_service
  3. Check code using Option<Path<T>> or other optional extractors for behavior changes in axum 0.8
  4. Review custom FromRequest and FromRequestParts implementations if they rely on #[async_trait]
  5. Run cargo check and cargo test

Development

bash

References

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.