Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Parsing Logic for Extensibility #27

Open
dhirenmathur opened this issue Jul 4, 2024 · 0 comments
Open

Refactor Parsing Logic for Extensibility #27

dhirenmathur opened this issue Jul 4, 2024 · 0 comments

Comments

@dhirenmathur
Copy link
Collaborator

Current Situation

Parsing logic is currently located in parse.py and endpoint_detection.py.
The code supports Python with special functions for FastAPI, Django, and Flask endpoint detection or prefix detection.

Problem
The current implementation is not extensible for other languages and frameworks. This limits our ability to expand support for new languages and frameworks in the future.

Proposed Solution
Implement a new architecture to make the code more extensible, following a hierarchy of:
CopyInterface > Language > Framework
This architecture will allow us to easily add support for new languages and frameworks in the future.

Objectives

Design and implement a new extensible architecture.
Refactor existing code to fit the new architecture.
Ensure the new architecture allows for rapid incorporation of new languages.

Implementation Details

Create an abstract base class or interface for parsing logic.
Implement language-specific classes that inherit from the base class.
Create framework-specific classes that inherit from the language classes.
Refactor existing Python and framework-specific code to fit into this new structure.

Example Structure
IParser (Interface)

  • PythonParser
    • FastAPIParser
    • DjangoParser
    • FlaskParser
  • JavaScriptParser
    • ExpressParser
    • NestJSParser

Next Steps

  • Review and discuss the proposed architecture.
  • Create a detailed implementation plan.
  • Prepare a low-level design of the architecture.
  • Discuss the low-level design with maintainers before implementing.
  • Begin implementation with a focus on maintaining current functionality while enabling future extensibility.

Impact
This refactoring will set the foundation for rapidly incorporating new languages and frameworks in the near future, allowing us to expand our tool's capabilities more efficiently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant