Skip to content

🐛 Fix implicit path params with converters#14883

Open
Dawaman43 wants to merge 4 commits intofastapi:masterfrom
Dawaman43:fix-path-converter-path-params
Open

🐛 Fix implicit path params with converters#14883
Dawaman43 wants to merge 4 commits intofastapi:masterfrom
Dawaman43:fix-path-converter-path-params

Conversation

@Dawaman43
Copy link

Summary

Routes that use path converters (e.g. {param:path}) are not detected as path parameters when the parameter is declared implicitly
(without Path()), because get_path_param_names() returns the raw token including the converter suffix.

This causes the parameter to be treated as a query parameter and the request to fail.

Changes Made

  • Strip converter suffixes in get_path_param_names() so {param:path} is recognized as param.
  • Add a regression test that verifies an implicit param: str path parameter works with the path converter.

Why it matters

This aligns implicit parameters with explicit Path() behavior and restores correct routing for path-converter syntax.

Testing

  • Added a focused test in tests/test_starlette_urlconvertors.py.

@YuriiMotov YuriiMotov changed the title Fix implicit path params with Fix implicit path params with convertersconverters 🐛 Fix implicit path params with converters Feb 10, 2026
@YuriiMotov YuriiMotov added the bug Something isn't working label Feb 10, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 10, 2026

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing Dawaman43:fix-path-converter-path-params (cbc1039) with master (a2e5136)

Open in CodSpeed

Copy link
Member

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

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

LGTM!

@Dawaman43, thanks!

@YuriiMotov
Copy link
Member

YuriiMotov commented Feb 10, 2026

@Dawaman43, please don't merge master branch so often - it creates noise in the notifications.
We will update branch before final review

@Dawaman43
Copy link
Author

Dawaman43 commented Feb 10, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants