Use constants from net/http for the status codes
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
查看程式碼庫中的程式碼生成邏輯,可能在 pkg/codegen/templates.go 或類似檔案中。找到 OpenAPI 規範中的狀態碼被寫成原始整數的地方。將這些整數替換為 net/http 套件中對應的常數(例如,504 對應 http.StatusGatewayTimeout)。執行現有測試以確保生成的程式碼仍能正確編譯和運行。
由索引模型根據 Issue 內容生成。
描述
When generating the api.gen.go, we only see one constant from the net/http package:
w.WriteHeader(http.StatusNotImplemented)
All other places it just uses the raw status code integer value from the spec:
w.WriteHeader(504)
Would be helpful to get a readable constant name instead of the integer,
especially when you use more than the typical 200 and 404 status codes.
- 主要語言
- Go
- 星號
- 8.6k
- 分支
- 1.1k
- 平均合併
- 14 小時 45 分鐘
- 30 天內合併 PR
- 29
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
oapi-codegen/oapi-codegen 的其他 Issue
-
client
難度 2/5 1-3 小時 新手友好度 70/100
oapi-codegen/oapi-codegen#2483 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
oapi-codegen/oapi-codegen#2408 ·
維護者通常 1 天內回覆
-
documentation
難度 2/5 1-3 小時 新手友好度 65/100
oapi-codegen/oapi-codegen#2168 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
oapi-codegen/oapi-codegen#1996 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
oapi-codegen/oapi-codegen#1988 ·
維護者通常 1 天內回覆
查看 oapi-codegen/oapi-codegen 的全部 Issue
相似的 Issue
-
area: global bug dx priority: low
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
grafana/mcp-grafana#1267 ·
維護者通常 1 天內回覆
-
automation models
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
coverage-gap good-first-pattern help wanted
難度 2/5 1-3 小時 新手友好度 78/100
GoogleCloudPlatform/k8s-aibom#114 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
txn2/mcp-data-platform#1984 ·
維護者通常 1 天內回覆