Add API documentation for graph retrieval, query, and commit history endpoints#585
Add API documentation for graph retrieval, query, and commit history endpoints#585
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughREADME.md was updated to add a "Usage examples" section containing curl commands and payload examples for the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 228-230: The README example includes a literal auth token
("Authorization: OpenSesame") which can encourage reuse and trigger secret
scanners; update the example curl for the graph_entities endpoint to use a
placeholder or environment variable instead (e.g., replace the literal
Authorization header in the curl example for
"http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" with a safe token
reference like ${SECRET_TOKEN} or a named placeholder) so the README no longer
contains a real-looking secret.
- Around line 224-250: Update the curl examples to use the documented
environment variable name SECRET_TOKEN consistently (e.g., replace instances of
<.ENV_SECRET_TOKEN> with ${SECRET_TOKEN}) across the /graph_entities, /chat,
/list_commits, and /switch_commit examples in README.md so the snippets are
copy-pasteable and match the earlier .env example.
…endpoints Migrated from FalkorDB/code-graph-backend PR #96. Original issue: FalkorDB/code-graph-backend#83 Resolves #534 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f234233 to
cf62eb5
Compare
gkorland
left a comment
There was a problem hiding this comment.
Rebased on staging and addressed review comments:
-
Env var consistency: Replaced all
<.ENV_SECRET_TOKEN>with${SECRET_TOKEN}to match the.envexample and be copy-pasteable. -
Literal auth token: Replaced
Authorization: OpenSesameexample with${SECRET_TOKEN}placeholder to avoid triggering secret scanners.
There was a problem hiding this comment.
Pull request overview
Adds an API Reference section to README.md to document graph retrieval, chat querying, and commit history endpoints.
Changes:
- Added a new “API Reference” section with curl examples for graph retrieval, chat queries, and commit operations.
- Added an additional keywords-like line near the end of the README.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## API Reference | ||
|
|
||
| ### Retrieve a graph | ||
|
|
||
| Fetch graph entities from a repository: | ||
|
|
||
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=<REPO_NAME>" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| Example: | ||
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| ### Send Query | ||
|
|
||
| Query your code graph using natural language: | ||
|
|
||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| ### History change | ||
|
|
||
| List all commits: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| Switch to a specific commit: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
There was a problem hiding this comment.
The new API Reference duplicates the existing "## API Endpoints" section above and introduces conflicting/incorrect paths. Consider removing this section or merging it into the existing endpoints table to keep a single source of truth.
| ## API Reference | |
| ### Retrieve a graph | |
| Fetch graph entities from a repository: | |
| ```bash | |
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=<REPO_NAME>" -H "Authorization: ${SECRET_TOKEN}" | |
| ``` | |
| Example: | |
| ```bash | |
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" -H "Authorization: ${SECRET_TOKEN}" | |
| ``` | |
| ### Send Query | |
| Query your code graph using natural language: | |
| ```bash | |
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| ``` | |
| ### History change | |
| List all commits: | |
| ```bash | |
| curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| ``` | |
| Switch to a specific commit: | |
| ```bash | |
| curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| ``` |
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=<REPO_NAME>" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| Example: | ||
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` |
There was a problem hiding this comment.
The documented URL is missing the /api prefix. The FastAPI route is /api/graph_entities, so these curl examples will 404 unless updated to use /api/graph_entities.
| Query your code graph using natural language: | ||
|
|
||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" |
There was a problem hiding this comment.
The documented URL is missing the /api prefix. The FastAPI route is /api/chat, so this curl example should call /api/chat.
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| curl -X POST http://127.0.0.1:5000/api/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" |
|
|
||
| List all commits: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" |
There was a problem hiding this comment.
The documented URL is missing the /api prefix. The FastAPI route is /api/list_commits, so this curl example should call /api/list_commits.
| curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| curl -X POST http://127.0.0.1:5000/api/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" |
|
|
||
| Switch to a specific commit: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" |
There was a problem hiding this comment.
The documented URL is missing the /api prefix. The FastAPI route is /api/switch_commit, so this curl example should call /api/switch_commit.
| curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" | |
| curl -X POST http://127.0.0.1:5000/api/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" |
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=<REPO_NAME>" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| Example: | ||
| ```bash | ||
| curl -X GET "http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| ### Send Query | ||
|
|
||
| Query your code graph using natural language: | ||
|
|
||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| ### History change | ||
|
|
||
| List all commits: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| Switch to a specific commit: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "commit": "<COMMIT_HASH>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` |
There was a problem hiding this comment.
Auth examples elsewhere in the README use Authorization: Bearer <YOUR_SECRET_TOKEN>. Here the header is shown as Authorization: ${SECRET_TOKEN}; since the backend accepts either raw token or Bearer, consider standardizing these examples to the Bearer form for consistency and clarity.
| Knowledge Graph, Code Analysis, Code Visualization, Dead Code Analysis, Graph Database | ||
|
|
There was a problem hiding this comment.
This line reads like a list of SEO keywords and isn’t referenced elsewhere in the README. If it’s not intentionally part of the documentation, consider removing it to avoid distracting from the actual content.
| curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "<REPO_NAME>", "msg": "<YOUR_QUESTION>"}' -H "Authorization: ${SECRET_TOKEN}" | ||
| ``` | ||
|
|
||
| ### History change |
There was a problem hiding this comment.
Section title "History change" is grammatically unclear. Consider renaming to something like "Commit history" or "History changes" to match the endpoints being documented.
| ### History change | |
| ### Commit history |
…p README - Add /api prefix to all curl URLs (graph_entities, chat, list_commits, switch_commit) - Standardize auth header to Bearer format - Rename 'History change' section to 'Commit history' - Remove SEO keywords line Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gkorland
left a comment
There was a problem hiding this comment.
Addressing remaining unresolved threads:
README.md:262 (missing /api prefix): Fixed in latest commit — all curl URLs now include the /api prefix.
README.md:282 (auth format): Fixed — standardized all examples to Authorization: Bearer <YOUR_SECRET_TOKEN> format.
README.md:283 (duplicate section): Fixed — removed the duplicate API Reference section, keeping only the existing API Endpoints table as single source of truth.
- Remove duplicate 'API Reference' section, merge curl examples into 'API Endpoints' as 'Usage examples' subsection - Standardize auth header to Bearer <YOUR_SECRET_TOKEN> placeholder - Move License section to end of file Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Migrated from falkordb/code-graph-backend#96
Summary
Adds an API Reference section to the README documenting:
GET /graph_entities)POST /chat)POST /list_commits,POST /switch_commit)Resolves #534
Originally authored by @Copilot in falkordb/code-graph-backend#96
Summary by CodeRabbit