Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

OpenAPI schema for POST /api/v3/packages does not reflect paginated and polymorphic response

未關閉
#2,331 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
58/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
openapi, python

研究方向

從 POST /api/v3/packages/ 的 OpenAPI 定義開始,檢查其回應 schema 是如何產生的。驗證文件中的回應是否與實際的 200 分頁結構一致,包括依賴參數的 PURL-string 或 PackageV3 結果,並確認產生的文件或用戶端解析反映了修正後的回應。

由索引模型根據 Issue 內容生成。

描述

The current OpenAPI schema incorrectly documents the response structure of the POST /api/v3/packages/ endpoint.

The schema currently lists a 201 response as a direct mapping to #/components/schemas/PackageV3:

        "/api/v3/packages/": {
            "post": {
                "operationId": "v3_packages_create",
                "tags": [
                    "v3"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PackageQuery"
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "$ref": "#/components/schemas/PackageQuery"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/PackageQuery"
                            }
                        }
                    }
                },
                "security": [
                    {
                        "cookieAuth": []
                    },
                    {
                        "tokenAuth": []
                    },
                    {}
                ],
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PackageV3"
                                }
                            }
                        },
                        "description": ""
                    }
                }
            }
        },

However, the actual API response is paginated, and the contents of the results array vary depending on request parameters (such as the details boolean option), so the response can also contain a list of PURL strings, instead of PackageV3 objects.

The response also has an incorrect status code in the schema (actual status code is 200).

This causes automated client generators to fail to parse the actual API responses because they expect a 201 flat object instead of the 200 paginated response structure.

主要語言
Python
星號
716
分支
347
平均合併
12 小時 15 分鐘
30 天內合併 PR
9

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

aboutcode-org/vulnerablecode 的其他 Issue

查看 aboutcode-org/vulnerablecode 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。