Repository navigation
Go: more APIs - #16850
Go: more APIs#16850
Conversation
Signed-off-by: Jin Hai <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds unimplemented EE authentication and system handlers, renames the OAuth channel callback, and registers new unauthenticated and protected API routes. ChangesEE endpoint routing
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/handler/system_ee.go`:
- Around line 25-32: Update the Swagger annotations above GetEnableAdmin to
match the registered GET route: use /api/v1/settings/enable-admin and the
settings tag instead of the system path and tag. Revise the description to
accurately describe the read-oriented behavior implied by GetEnableAdmin and the
GET method, without changing the handler implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 212447d8-6ae9-44e2-b3cf-5cf2c059ff70
📒 Files selected for processing (4)
internal/handler/system_ee.gointernal/handler/user_auth.gointernal/handler/user_auth_ee.gointernal/router/router.go
| // GetEnableAdmin admin access endpoint | ||
| // @Description Enable admin access endpoint | ||
| // @Tags system | ||
| // @Produce plain | ||
| // @Router /v1/system/enable-admin [GET] | ||
| func (h *SystemHandler) GetEnableAdmin(c *gin.Context) { | ||
| common.ErrorWithCode(c, common.CodeNotImplemented, "EnableAdmin not implemented") | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Swagger @Router annotation doesn't match the actual route path.
The annotation declares @Router /v1/system/enable-admin [GET], but the router registers this handler at /api/v1/settings/enable-admin (router.go line 279: user := v1.Group("/settings") → user.GET("/enable-admin", ...)). The @Tags system is also inconsistent since the route lives under /settings, not /system. This will produce misleading generated API documentation.
Additionally, the @Description ("Enable admin access endpoint") sounds like a state-changing action, while the GET method and GetEnableAdmin naming suggest a read. Clarify the intent so the HTTP method and annotation align.
📝 Proposed fix for Swagger annotations
// GetEnableAdmin admin access endpoint
-// `@Description` Enable admin access endpoint
-// `@Tags` system
+// `@Description` Get the enable-admin setting
+// `@Tags` settings
// `@Produce` plain
-// `@Router` /v1/system/enable-admin [GET]
+// `@Router` /api/v1/settings/enable-admin [GET]
func (h *SystemHandler) GetEnableAdmin(c *gin.Context) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // GetEnableAdmin admin access endpoint | |
| // @Description Enable admin access endpoint | |
| // @Tags system | |
| // @Produce plain | |
| // @Router /v1/system/enable-admin [GET] | |
| func (h *SystemHandler) GetEnableAdmin(c *gin.Context) { | |
| common.ErrorWithCode(c, common.CodeNotImplemented, "EnableAdmin not implemented") | |
| } | |
| // GetEnableAdmin admin access endpoint | |
| // `@Description` Get the enable-admin setting | |
| // `@Tags` settings | |
| // `@Produce` plain | |
| // `@Router` /api/v1/settings/enable-admin [GET] | |
| func (h *SystemHandler) GetEnableAdmin(c *gin.Context) { | |
| common.ErrorWithCode(c, common.CodeNotImplemented, "EnableAdmin not implemented") | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/handler/system_ee.go` around lines 25 - 32, Update the Swagger
annotations above GetEnableAdmin to match the registered GET route: use
/api/v1/settings/enable-admin and the settings tag instead of the system path
and tag. Revise the description to accurately describe the read-oriented
behavior implied by GetEnableAdmin and the GET method, without changing the
handler implementation.
Signed-off-by: Jin Hai <[email protected]>
Summary
as title.