Skip to content

fix: Update swagger docs #8002

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

Merged
merged 1 commit into from
Feb 26, 2025
Merged

fix: Update swagger docs #8002

merged 1 commit into from
Feb 26, 2025

Conversation

lan-yonghui
Copy link
Member

Refs #8001

@1Panel-bot 1Panel-bot added the dev label Feb 26, 2025
@@ -26721,7 +26727,7 @@ const docTemplate = `{
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "- ` + "`" + `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.

The code contains a few issues that need to be addressed:

  1. Type Inconsistency:

    • Line 3483: The type from "integer" to "string" should be re-evaluated since container identifiers are typically integers, not strings.
  2. Missing Property:

    • Line 20708: Add the missing property domainName of type string under dto.OllamaBindDomainRes.
  3. Code Formatting:

    • Lines 2966 and 2191 contain markdown syntax (-) which might interfere with JSON formatting. These lines should be removed as they are intended for comment blocks and do not affect the JSON structure.

Here's the revised code snippet:

const docTemplate = `{
    ...
        "type": "object",
        "properties": {
            ...
            },
            "allowIPs": {
                "type": "array",
                "items": {
                    }
                }
            ]
        },
        ...
};

Additional changes needed outside this context can be provided if additional information or context is required.

@@ -391,7 +391,7 @@ func (b *BaseApi) ContainerOperation(c *gin.Context) {

// @Tags Container
// @Summary Container stats
// @Param id path integer true "container id"
// @Param id path string true "container id"
// @Success 200 {object} dto.ContainerStats
// @Security ApiKeyAuth
// @Security Timestamp
Copy link
Member

Choose a reason for hiding this comment

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

There is no significant issue with this function definition but there is a recommendation to change the type of id from integer to string as specified in the comment above it. This allows more flexibility for what kind of value can be used when calling the endpoint, which could include strings like 'all' that represent all containers rather than just integers.

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 wanghe-fit2cloud merged commit 193b0f3 into dev Feb 26, 2025
5 checks passed
@wanghe-fit2cloud wanghe-fit2cloud deleted the pr@dev@fix_docs_bug branch February 26, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants