Skip to content
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

feat: Update swagger docs #7710

Merged
merged 1 commit into from
Jan 13, 2025
Merged

feat: Update swagger docs #7710

merged 1 commit into from
Jan 13, 2025

Conversation

lan-yonghui
Copy link
Member

No description provided.

Copy link

f2c-ci-robot bot commented Jan 13, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -25965,7 +26064,7 @@ const docTemplate = `{
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/resource\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.",
"description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/dashboard/current\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.",
"type": "apiKey",
"name": "1Panel-Token",
"in": "header"
Copy link
Member

Choose a reason for hiding this comment

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

Code Differences

  1. New Endpoint:

    • Added two new endpoints under the /settings/backup/record path:
      "/settings/backup/record/size"
      and
      "/settings/backup/record/size/bycronjob"
  2. Data Models and Responses:

    • Defined three data models (dto.BackupFile, response.AppInstalledCheck) that include fields like id, name, and size.
    • Updated existing responses to use these new models.
  3. Security Definitions:

    • Added a comment to clarify the custom token format used for authentication in various headers (including the one added).
  4. Schema References Update:

    • Fixed typo for the AppDto schema reference.
    • Ensured consistency with naming conventions (AppInstalledCheck vs. AppItem).
  5. Comments in Security Definition:

    • Corrected an error in the comments describing how to authenticate requests, including correct HTTP methods (GET instead of POST).

Overall, the changes enhance the clarity and maintainability of the API documentation by introducing new functionality related to backup record sizes and improving schema definitions. The updated security definition ensures proper handling of API keys across different routes.

@@ -215,7 +215,7 @@ func (b *BaseApi) SearchBackupRecordsByCronjob(c *gin.Context) {
// @Summary Load backup records size for cronjob
// @Accept json
// @Param request body dto.RecordSearchByCronjob true "request"
// @Success 200 {array} dto.dto.BackupFile
// @Success 200 {array} dto.BackupFile
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /settings/backup/record/size/bycronjob [post]
Copy link
Member

Choose a reason for hiding this comment

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

The given code differs slightly in terms of comments regarding the success responses for both /settings/backup/record/size and /settings/backup/record/size/bycronjob. Both methods indicate a successful response with an array of dto.BackupFile, but there is no significant change beyond this detail.

To streamline the documentation, you could consider merging these two entries into one to ensure consistency:

@@ -166,7 +166,7 @@
 // @Summary Load backup records size
 // @Accept json
 // @Param request body dto.RecordSearch true "request"
-// @Success 200 {array} dto.dto.BackupFile
+// @Success 200 {array} dto.BackupFile
 // @Security ApiKeyAuth
 // @Security Timestamp
 // @Router /settings/backup/record/size [post]

@@ -215,7 +215,7 @@
 // @Summary Load backup records size for cronjob
 // @Accept json
 // @Param request body dto.RecordSearchByCronjob true "request"
-// @Success 200 {array} dto.dto.BackupFile
+// @Success 200 {array} dto.BackupFile
 // @Security ApiKeyAuth
 // @Security Timestamp
 // @Router /settings/bac‌​​kup/record/size/bycronjob [post]

If the intent was to highlight that both endpoints return the same type of data (an array of dto.BackupFile), you might also want to mention that in the first comment under each route. However, if they indeed differ, it's worth noting that this is consistent with the current implementation.

@@ -23,7 +23,7 @@ import (
// @description Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).
// @description ```
// @description eg:
// @description curl -X GET "http://localhost:4004/api/v1/resource" \
// @description curl -X GET "http://localhost:4004/api/v1/dashboard/current" \
// @description -H "1Panel-Token: <1panel_token>" \
// @description -H "1Panel-Timestamp: <current_unix_timestamp>"
// @description ```
Copy link
Member

Choose a reason for hiding this comment

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

The change in command line URL from "/api/v1/resource" to "/api/v1/dashboard/current" seems incorrect. The API endpoint should remain consistent with intended functionality based on the original description provided. Additionally, there's no explanation or documentation about the purpose of including "dashboard" in the URL, which could confuse users.

Copy link
Member

@wanghe-fit2cloud wanghe-fit2cloud left a comment

Choose a reason for hiding this comment

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

/lgtm

@wanghe-fit2cloud
Copy link
Member

/approve

Copy link

f2c-ci-robot bot commented Jan 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wanghe-fit2cloud

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot merged commit 999e5a7 into dev Jan 13, 2025
6 checks passed
@f2c-ci-robot f2c-ci-robot bot deleted the pr@dev@feat_swag branch January 13, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants