Skip to content

Comments

feat(web): initial support for route and HTTP method introspection#3594

Merged
JohnTitor merged 44 commits intoactix:mainfrom
dertin:introspection
Feb 11, 2026
Merged

feat(web): initial support for route and HTTP method introspection#3594
JohnTitor merged 44 commits intoactix:mainfrom
dertin:introspection

Conversation

@dertin
Copy link
Contributor

@dertin dertin commented Mar 3, 2025

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

Hello, this is my first contribution to the project. This PR introduces a new resource introspection feature for actix-web that allows retrieving all configured route paths along with their associated HTTP methods after the server has started. Currently, it supports only basic Guards that determine HTTP methods. The feature is activated using the experimental-introspection feature flag.

I developed this feature because it's extremely useful for auditing services with many route paths that change constantly. I hope it proves valuable for others as well, and I welcome any feedback or suggestions for improvement.

Closes #1462
Closes #2677

@dertin
Copy link
Contributor Author

dertin commented Mar 4, 2025

Hi, @robjtede

Here's a limited-scope approach for listing routes and methods from the Guards it’s a starting point.
Extending support to extract additional metadata might require more breaking changes
(potentially involving proc-macro / actix-web-codegen).

Please review and let me know your thoughts!

dertin added 3 commits March 5, 2025 02:34
… usage

- Added `GuardDetail` enum to encapsulate various introspection details of a guard.
- Refactored `HttpMethodsExtractor` implementation to use `GuardDetail` instead of `downcast_ref`.
… usage

- Added `GuardDetail` enum to encapsulate various introspection details of a guard.
- Refactored `HttpMethodsExtractor` implementation to use `GuardDetail` instead of `downcast_ref`.
@dertin dertin changed the title feat(resources-introspection): add support for resource metadata retrieval feat(resources-introspection): initial support for route and HTTP method introspection Mar 5, 2025
@dertin dertin marked this pull request as draft May 1, 2025 06:51
@robjtede robjtede changed the title feat(resources-introspection): initial support for route and HTTP method introspection feat: initial support for route and HTTP method introspection May 9, 2025
@robjtede robjtede added B-semver-minor A-web project: actix-web labels May 9, 2025
@dertin dertin marked this pull request as ready for review May 19, 2025 05:58
dertin added 9 commits May 27, 2025 01:50
- Introduced a new `experimental-introspection` feature that provides comprehensive reports on configured routes, including paths, methods, guards, and resource metadata.
- Added support for reachability hints to identify shadowed or conflicting routes.
- Implemented new endpoints for external resources reporting.
- Updated existing route registration to include detailed introspection data.
- Enhanced guard implementations to provide introspection details.
@dertin
Copy link
Contributor Author

dertin commented Jan 1, 2026

Hi @robjtede

I’ve finished the work on this PR. It adds the experimental introspection feature, JSON and plain-text reports, includes examples, unit and integration tests, and the corresponding CHANGELOG entry. If you notice anything missing, please let me know.

Could you take a look when you have a moment? If you’d like to make further changes or prefer a different approach for any part of the implementation, I’ll be happy to revise it.

Thanks!
Guillermo

@JohnTitor JohnTitor changed the title feat: initial support for route and HTTP method introspection feat(web): initial support for route and HTTP method introspection Feb 10, 2026
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great implementation!
I've tweaked a bit but let's test this feature as experimental.
I'm going to declare the policy for experimental features in #3916.
If you need tweaks after releasing, a follow-up is appriciated!

@JohnTitor JohnTitor added this pull request to the merge queue Feb 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 11, 2026
@JohnTitor JohnTitor added this pull request to the merge queue Feb 11, 2026
Merged via the queue into actix:main with commit 84ddfe7 Feb 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-web project: actix-web B-semver-minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

way to get a list of registered services Route introspection

4 participants