-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description:
Currently, PyApptest’s autodetection logic works up to a limited folder depth or is restricted by current recursive traversal limits.
This causes a major problem for large real-world projects where API endpoints (routes/views) are deeply nested inside multiple folders or submodules.
Problem Example:
project/
app/
modules/
users/
routes/
user_routes.py --> ❌ Missed currently
Endpoints inside files like user_routes.py are currently not detected by the system!
Objective:
Fix the recursive directory traversal so that all levels of the project hierarchy are searched properly.
Ensure endpoint parsers for:
Flask (Blueprints)
FastAPI (Routers and APIRouters)
Django (urls.py with include())
are able to detect nested APIs properly.
Tasks:
Refactor the code that walks through the project directory:
Use os.walk() (Python) or equivalent method to recursively traverse all folders without depth limit.
Handle symbolic links safely (to avoid infinite loops).
Update internal parsers:
For Flask: Parse nested Blueprint registrations and route handlers.
For FastAPI: Parse nested include_router() usages.
For Django: Parse all chained include() patterns inside urls.py files.
Create unit test projects:
Small dummy Flask/FastAPI/Django projects with deeply nested APIs.
Validate that all endpoints are now detected correctly.
Update error handling:
If a Python file is not parsable or errors occur during detection, skip gracefully but log the issue.
Acceptance Criteria:
All endpoints are detected regardless of how deep they are nested.
No missing endpoints during parsing.
No crashes if irrelevant Python files are encountered.
Why This Matters:
Real-world projects are modular and deeply structured.
Missing endpoints leads to incomplete API testing and broken developer trust.
Makes PyApptest much more robust and production-ready.
Optional Bonus:
Allow setting a "max depth" parameter optionally (for super-large projects where unlimited recursion is risky).
Example:
config option
MAX_DEPTH = None # None = infinite
Allow setting it via config file (.pyapptestconfig.json) or environment variable.