How alufers/mitmproxy2swagger works
Key Components to Include:
Input Sources Layer
• Mitmproxy Flow Files (.flow)
• HAR Files (Browser DevTools export)
Core Processing Layer
• HarCaptureReader (from har_capture_reader.py)
• MitmproxyCaptureReader (from mitmproxy_capture_reader.py)
• SwaggerUtil (from swagger_util.py)
Processing Pipeline
Two-pass system:
• First Pass: Path Template Generation
• A component for x-path-templates generation
• User interaction point for template editing
• Second Pass: OpenAPI Specification Generation
• Components for:
• Request/Response parsing
• Schema generation
• Example data incorporation (optional)
• Headers processing (optional)
Output Layer
Two main outputs:
• OpenAPI 3.0 Specification (YAML/JSON)
• Optional HTML Documentation (via redoc-cli)
Design Guidelines:
Technical Details
• Python version requirement
• Integration with external tools (mitmproxy, redoc-cli)
• Configuration components (.flake8, .mypy.ini, etc.)
Testing Layer
A separate section showing:
• Test components (test_mitmproxy2swagger.py, test_openapi_compliance.py)
• Test data flows (from testdata directory)
• Testing utilities (testing_util.py)
Specific Implementation Details:
Configuration Management
• How pyproject.toml influences the system
• CI/CD components from .github/workflows