Skip to content

🐛 Resolve string variables in route paths#66

Merged
savannahostrowski merged 2 commits intomainfrom
variable-routes
Feb 17, 2026
Merged

🐛 Resolve string variables in route paths#66
savannahostrowski merged 2 commits intomainfrom
variable-routes

Conversation

@savannahostrowski
Copy link
Copy Markdown
Member

Closes #49

This was a good catch. The fix here is to extract string variables to build up a map and then replace matching variable names with extracted paths. This will work for most cases. There is an edge case that I would like to defer, since I think it's pretty uncommon and requires a bunch more complexity:

user_id = "/some/string"

@app.get("/users/{user_id}")
def get_user(user_id:int): ...

This obviously won't work but our resolution logic will incorrectly replace it.

I've also fixed the tooltip to strip unresolvable dynamic prefixes (like settings.API_PREFIX) instead of showing them as if they were path parameters

@savannahostrowski savannahostrowski added the bug Something isn't working label Feb 17, 2026
@savannahostrowski savannahostrowski merged commit 5195718 into main Feb 17, 2026
5 checks passed
@savannahostrowski savannahostrowski deleted the variable-routes branch February 17, 2026 22:11
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.

Variables aren't handled correctly in route paths

1 participant