-
Notifications
You must be signed in to change notification settings - Fork 105
增加 Swagger 文档支持 #189
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
增加 Swagger 文档支持 #189
Conversation
修复集群权限校验逻辑,确保管理员权限也能正确校验命名空间权限 更新用户和管理员界面的授权相关文案,使其更清晰准确 在集群管理页面添加命名空间选择功能
将简单的密钥显示改为包含完整使用示例的HTML内容,展示如何获取节点列表的示例代码和请求头设置
- 新增swagger生成脚本及文档文件 - 在中间件中排除swagger路径的认证检查 - 为集群接口添加swagger注解 - 更新API密钥使用示例链接指向swagger文档 - 集成gin-swagger库并配置路由 - 添加相关依赖到go.mod
Caution Review failedThe pull request is closed. 📝 WalkthroughSummary by CodeRabbit
Walkthrough本次变更主要引入了 Swagger API 文档集成,包括后端 Gin 服务的 Swagger UI 接入、Swagger 文档生成脚本与配置文件,并在集群管理相关 API 增加了 Swagger 注解和接口。权限校验逻辑针对集群管理员和命名空间做了细化。前端方面,集群授权、用户授权、API Key 使用说明等页面的提示文案和交互细节进行了调整,Vite 代理配置新增了对 Swagger 路径的支持。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant GinServer
participant SwaggerUI
participant SwaggerDocs
User->>Browser: 访问 /swagger/index.html
Browser->>GinServer: GET /swagger/index.html
GinServer->>SwaggerUI: 返回 Swagger UI 静态页面
Browser->>GinServer: GET /swagger/doc.json
GinServer->>SwaggerDocs: 读取并渲染 swagger/docs.go
SwaggerDocs-->>GinServer: 返回 API 文档 JSON
GinServer-->>Browser: 返回 swagger 文档内容
Browser->>User: 展示交互式 API 文档
sequenceDiagram
participant 前端页面
participant GinServer
participant ClusterController
participant ClusterService
participant DB
前端页面->>GinServer: GET /admin/cluster/file/option_list (带 Bearer Token)
GinServer->>ClusterController: 路由分发
ClusterController->>ClusterService: 查询所有集群
ClusterService->>DB: 查询集群数据
DB-->>ClusterService: 返回集群列表
ClusterService-->>ClusterController: 返回集群数据
ClusterController->>GinServer: 去重文件名并返回选项列表
GinServer-->>前端页面: 返回 JSON 选项列表
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
增加 Swagger 文档支持