refactor: clean up form binding & validation (#38873)

Clarify the "validation" and "error display" logic.

All the copied&pasted `Validate` functions are removed.
This commit is contained in:
wxiaoguang
2026-08-14 10:15:33 +08:00
committed by GitHub
parent 8b40df255b
commit 72a9debaff
30 changed files with 331 additions and 737 deletions
+2 -14
View File
@@ -3,22 +3,10 @@
package forms
import (
"net/http"
"gitea.dev/modules/web/middleware"
"gitea.dev/services/context"
"gitea.com/go-chi/binding"
)
import "gitea.dev/modules/web/middleware"
// EditRunnerForm form for admin to create runner
type EditRunnerForm struct {
middleware.FormDefaultValidator
Description string
}
// Validate validates form fields
func (f *EditRunnerForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetValidateContext(req)
return middleware.Validate(ctx, errs, f)
}