refactor: move go-chi/binding into Gitea (#39528)

The `gitea.com/go-chi/binding` package only exists for Gitea, so it
moves into `modules/web/binding` to fix its bugs directly. Split out of
https://github.com/go-gitea/gitea/pull/39504.

- GET and HEAD always bind the query
- JSON `null` slice elements and nested `TrimSpace` fields bind
correctly
- Integer fields reject out-of-range values instead of wrapping
- An empty JSON body binds nothing and an unknown binding rule is an
error

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
silverwind
2026-10-02 15:37:41 +02:00
committed by GitHub
parent 2f01ec38bd
commit e6ffbea888
17 changed files with 748 additions and 72 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ type CreateTeamOption struct {
// Whether the team can create repositories in the organization
CanCreateOrgRepo bool `json:"can_create_org_repo"`
// Team visibility within the organization. Defaults to "private".
Visibility TeamVisibility `json:"visibility" binding:"OmitEmpty;In(public,limited,private)"`
Visibility TeamVisibility `json:"visibility" binding:"In(public,limited,private)"`
}
// EditTeamOption options for editing a team
@@ -85,5 +85,5 @@ type EditTeamOption struct {
CanCreateOrgRepo *bool `json:"can_create_org_repo"`
// Team visibility within the organization. When omitted, visibility is
// left unchanged.
Visibility *TeamVisibility `json:"visibility" binding:"OmitEmpty;In(public,limited,private)"`
Visibility *TeamVisibility `json:"visibility" binding:"In(public,limited,private)"`
}