Skip to content

Conversation

@CHRISTOPHERKADOGO
Copy link
Contributor

Fix Database Graph Endpoint Routing Issue

Problem

FastAPI was incorrectly routing /databases/graph requests to the /databases/{database_id} endpoint, causing a UUID casting error since "graph" is not a valid UUID. This occurred because the parameterized route was matching before the specific graph endpoint route.

Solution

Reordered the route definitions to ensure specific routes are matched before parameterized routes:

  1. Moved /databases/graph route before /databases/{database_id}
  2. Maintained existing order of other parameterized routes

Changes

  • Reordered route definitions in the following sequence:
    @router.get("/databases/graph")
    @router.get("/databases/{database_id}")
    @router.get("/databases/{database_id}/password")

Copy link
Contributor

@rhodinemma rhodinemma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much for this @CHRISTOPHERKADOGO

@rhodinemma rhodinemma merged commit 8556c2a into develop Jan 27, 2025
2 checks passed
@rhodinemma rhodinemma deleted the DatabaseGraphData branch January 27, 2025 18:46
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.

3 participants