Skip to content

Add Route nodes and HANDLES edges for DRF ViewSet actions#647

Open
muskiteer wants to merge 2 commits into
DeusData:mainfrom
muskiteer:fix/drf-route-handlers
Open

Add Route nodes and HANDLES edges for DRF ViewSet actions#647
muskiteer wants to merge 2 commits into
DeusData:mainfrom
muskiteer:fix/drf-route-handlers

Conversation

@muskiteer

@muskiteer muskiteer commented Jun 27, 2026

Copy link
Copy Markdown

What does this PR do?

This PR adds support for indexing Django REST Framework ViewSet actions decorated with @action by emitting Route nodes and Route-[:HANDLES]->Method relationships.

Previously, DRF action methods were indexed only as Method nodes, which meant endpoint inventory and endpoint-to-handler mapping were incomplete for projects using DRF routers.

Changes

  • Emit Route nodes for DRF @action methods.
  • Populate route metadata (HTTP method, path, source, and file path where available).
  • Create Route-[:HANDLES]->Method relationships linking routes to their corresponding handler methods.
  • Preserve existing Method extraction.

Verification

Reproduced using a minimal Django REST Framework project:

class CustomerTaskAdminViewSet(ViewSet):
    @action(detail=True, methods=["post"])
    def approve_draft_with_charge(self, request, pk=None):
        ...

Before:

  • Method node was present.
  • No Route nodes were emitted.
  • No Route-[:HANDLES]->Method relationships existed.

After:

  • Route node is emitted.
  • Route-[:HANDLES]->Method relationship is created.
  • Route metadata is available for the action.

Checklist

  • Every commit is signed off (git commit -s) — required, CI rejects unsigned commits (DCO, see CONTRIBUTING.md)
  • Tests pass locally (make -f Makefile.cbm test)
  • Lint passes (make -f Makefile.cbm lint-ci)
  • New behavior is covered by a test (reproduce-first for bug fixes)

Fixes #603

Signed-off-by: muskiteer <agarwal.vansh3110@gmail.com>
@muskiteer

Copy link
Copy Markdown
Author

Hi @DeusData,
I've opened a PR for the DRF ViewSet route extraction changes.

While testing locally, I ran into some issues with the test and lint targets. From what I could tell, these didn't appear to be directly related to the changes in this PR, but please let me know if I missed something.

I'd really appreciate any feedback or suggested changes. Happy to update the PR if needed.

Thanks

Signed-off-by: muskiteer <agarwal.vansh3110@gmail.com>
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

Successfully merging this pull request may close these issues.

Django REST Framework ViewSet routes miss HANDLES mappings

1 participant