-
Notifications
You must be signed in to change notification settings - Fork 231
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
fix: return 201 for resource creation apis #255
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request updates multiple API endpoints across different modules to explicitly include a Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
app/api/router.py (1)
76-76
: 🛠️ Refactor suggestionAdd status_code=201 to the parse endpoint.
For consistency with the same endpoint in parsing_router.py and to follow REST conventions for resource creation, this endpoint should also return 201.
-@router.post("/parse") +@router.post("/parse", status_code=201)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
app/api/router.py
(1 hunks)app/modules/conversations/conversations_router.py
(1 hunks)app/modules/intelligence/prompts/prompt_router.py
(1 hunks)app/modules/key_management/secret_manager.py
(2 hunks)app/modules/parsing/graph_construction/parsing_router.py
(1 hunks)
🔇 Additional comments (5)
app/modules/intelligence/prompts/prompt_router.py (1)
22-22
: LGTM! Status code 201 is appropriate for prompt creation.The change aligns with REST conventions by returning 201 Created for the create_prompt endpoint.
app/api/router.py (1)
54-56
: LGTM! Status code 201 is appropriate for conversation creation.The change aligns with REST conventions by returning 201 Created for the create_conversation endpoint.
app/modules/conversations/conversations_router.py (1)
35-37
: LGTM! Status code 201 is appropriate for conversation creation.The change aligns with REST conventions by returning 201 Created for the create_conversation endpoint. This is consistent with other resource creation endpoints in the file, like share_chat.
app/modules/key_management/secret_manager.py (2)
62-62
: LGTM! Appropriate use of 201 status code for resource creation.The addition of
status_code=201
aligns with RESTful practices for endpoints that create new resources.
256-256
: LGTM! Appropriate use of 201 status code for API key creation.The addition of
status_code=201
correctly indicates resource creation while maintaining the existing response model.
@@ -10,7 +10,7 @@ | |||
router = APIRouter() | |||
|
|||
|
|||
@router.post("/parse") | |||
@router.post("/parse", status_code=201) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
LGTM! Status code 201 is appropriate for resource creation.
The change aligns with REST conventions by returning 201 Created for the parse_directory endpoint.
However, there's an inconsistency with the same endpoint in app/api/router.py which doesn't specify status_code=201.
🏁 Script executed:
#!/bin/bash
# Find all occurrences of the parse endpoint
rg -l "router\.post\(\"/parse"
Length of output: 106
Inconsistency on the parse endpoint definition detected
- The endpoint in
app/modules/parsing/graph_construction/parsing_router.py
correctly usesstatus_code=201
for resource creation. - In contrast,
app/api/router.py
defines the same/parse
endpoint without specifyingstatus_code=201
.
This inconsistency should be addressed for uniformity across the codebase.
Summary by CodeRabbit