Skip to content

Refactor Parsing Logic for Extensibility #27

@dhirenmathur

Description

@dhirenmathur

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions