go-zero
go-zero copied to clipboard
Will go-zero support auto validation in api types.go?
trafficstars
现在生成的 types.go 并没有实现自动校验的功能, 但是浏览代码的时候发现预留了接口和执行逻辑,
if valid, ok := v.(validation.Validator); ok {
return valid.Validate()
} else if val := validator.Load(); val != nil {
return val.(Validator).Validate(r, v)
}
如果自己在types.go中实现 validation.Validator 参数发生改变的时候重新生成就会被覆盖,
You can implement the interface in a different file like types_validation.go
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.