99designs / 99designs/gqlgen

Enums not validated on marshal

未關閉
#2,385 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
10.8k
分支
1.3k
平均合併
2 天 36 分鐘
30 天內合併 PR
26

描述

### What happened?
Enums are validated on unmarshal, but not on marshal

### What did you expect?
I'd expect validation in both cases

### versions
- v0.17.9
- go1.19.1

I'm thinking of proposing a change to add a validate check in marshal https://github.com/99designs/gqlgen/blob/master/plugin/modelgen/models.gotpl#L99. Thoughts?

貢獻指南

開啟貢獻指南

研究方向

該 issue 指向 plugin/modelgen/models.gotpl 第 99 行。首先檢查該 template,以了解 enum 是如何進行 marshal 的。在 unmarshal 路徑中尋找 validation 邏輯並進行比較。檢查是否已有針對 enum validation 的測試,以了解預期行為。修正可能涉及在 marshal template 中加入 validation 呼叫。執行與 enum marshaling 相關的測試進行驗證。

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

評估

技術堆疊
go
領域
backend-api-design
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
50/100

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

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