Skip to content

πŸ› Recognize custom FastAPI/APIRouter naming patterns (aliases, subclasses, module imports)#107

Merged
savannahostrowski merged 7 commits intomainfrom
more-discovery-bugs
Mar 4, 2026
Merged

πŸ› Recognize custom FastAPI/APIRouter naming patterns (aliases, subclasses, module imports)#107
savannahostrowski merged 7 commits intomainfrom
more-discovery-bugs

Conversation

@savannahostrowski
Copy link
Member

Closes #102, #105, #106

This PR refactors a solid chunk of the router extractor to handle custom naming. For example:

from fastapi import FastAPI as FA 
app = FA()

from fastapi import APIRouter as AR 
router = AR()

import fastapi as f 
app = f.FastAPI()

# Custom subclass
class MyRouter(APIRouter)
router = MyRouter()

# Aliased base class
class MyRouter(AR)

# FastAPI subclass 
class MyApp(FastAPI)Β 
app = MyApp()

Also fixes CodeLens links in test files when the URL is passed as a keyword argument (client.get(url="/path")).

@savannahostrowski savannahostrowski added the bug Something isn't working label Mar 4, 2026
@savannahostrowski savannahostrowski merged commit 9aaa972 into main Mar 4, 2026
3 checks passed
@savannahostrowski savannahostrowski deleted the more-discovery-bugs branch March 4, 2026 18:24
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.

Aliased FastAPI/APIRouter imports is not getting detected

1 participant