0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-09-26 17:44:08 -04:00

Upgrade golang to 1.25.1 and add descriptions for the swagger structs' fields (#35418)

This commit is contained in:
Lunny Xiao
2025-09-06 09:52:41 -07:00
committed by GitHub
parent b8f1c9f048
commit c290682521
51 changed files with 1928 additions and 656 deletions

View File

@@ -5,16 +5,26 @@ package structs
// Organization represents an organization
type Organization struct {
ID int64 `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Email string `json:"email"`
AvatarURL string `json:"avatar_url"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
Visibility string `json:"visibility"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
// The unique identifier of the organization
ID int64 `json:"id"`
// The name of the organization
Name string `json:"name"`
// The full display name of the organization
FullName string `json:"full_name"`
// The email address of the organization
Email string `json:"email"`
// The URL of the organization's avatar
AvatarURL string `json:"avatar_url"`
// The description of the organization
Description string `json:"description"`
// The website URL of the organization
Website string `json:"website"`
// The location of the organization
Location string `json:"location"`
// The visibility level of the organization (public, limited, private)
Visibility string `json:"visibility"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
// username of the organization
// deprecated
UserName string `json:"username"`
@@ -22,10 +32,15 @@ type Organization struct {
// OrganizationPermissions list different users permissions on an organization
type OrganizationPermissions struct {
IsOwner bool `json:"is_owner"`
IsAdmin bool `json:"is_admin"`
CanWrite bool `json:"can_write"`
CanRead bool `json:"can_read"`
// Whether the user is an owner of the organization
IsOwner bool `json:"is_owner"`
// Whether the user is an admin of the organization
IsAdmin bool `json:"is_admin"`
// Whether the user can write to the organization
CanWrite bool `json:"can_write"`
// Whether the user can read the organization
CanRead bool `json:"can_read"`
// Whether the user can create repositories in the organization
CanCreateRepository bool `json:"can_create_repository"`
}
@@ -33,31 +48,43 @@ type OrganizationPermissions struct {
type CreateOrgOption struct {
// username of the organization
// required: true
UserName string `json:"username" binding:"Required;Username;MaxSize(40)"`
FullName string `json:"full_name" binding:"MaxSize(100)"`
Email string `json:"email" binding:"MaxSize(255)"`
UserName string `json:"username" binding:"Required;Username;MaxSize(40)"`
// The full display name of the organization
FullName string `json:"full_name" binding:"MaxSize(100)"`
// The email address of the organization
Email string `json:"email" binding:"MaxSize(255)"`
// The description of the organization
Description string `json:"description" binding:"MaxSize(255)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
// The website URL of the organization
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
// The location of the organization
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public` (default), `limited` or `private`
// enum: public,limited,private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
}
// TODO: make EditOrgOption fields optional after https://gitea.com/go-chi/binding/pulls/5 got merged
// EditOrgOption options for editing an organization
type EditOrgOption struct {
FullName string `json:"full_name" binding:"MaxSize(100)"`
Email string `json:"email" binding:"MaxSize(255)"`
// The full display name of the organization
FullName string `json:"full_name" binding:"MaxSize(100)"`
// The email address of the organization
Email string `json:"email" binding:"MaxSize(255)"`
// The description of the organization
Description string `json:"description" binding:"MaxSize(255)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
// The website URL of the organization
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
// The location of the organization
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public`, `limited` or `private`
// enum: public,limited,private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
}
// RenameOrgOption options when renaming an organization