Skip to content

Commit a6225b2

Browse files
committed
update swagger docs
1 parent eb5e788 commit a6225b2

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

modules/structs/admin_user.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ type CreateUserOption struct {
2323

2424
// EditUserOption edit user options
2525
type EditUserOption struct {
26-
SourceID int64 `json:"source_id"`
27-
LoginName string `json:"login_name"`
28-
FullName *string `json:"full_name" binding:"MaxSize(100)"`
26+
// required: true
27+
SourceID int64 `json:"source_id"`
28+
// required: true
29+
LoginName string `json:"login_name" binding:"Required"`
2930
// swagger:strfmt email
30-
Email *string `json:"email" binding:"Email;MaxSize(254)"`
31+
Email *string `json:"email" binding:"MaxSize(254)"`
32+
FullName *string `json:"full_name" binding:"MaxSize(100)"`
3133
Password string `json:"password" binding:"MaxSize(255)"`
3234
MustChangePassword *bool `json:"must_change_password"`
3335
Website *string `json:"website" binding:"MaxSize(50)"`

routers/api/v1/admin/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
189189
if form.Email != nil {
190190
u.Email = *form.Email
191191
if len(u.Email) == 0 {
192-
ctx.Error(http.StatusUnprocessableEntity, "", fmt.Errorf("email is not allowed to be empty"))
192+
ctx.Error(http.StatusUnprocessableEntity, "", fmt.Errorf("email is not allowed to be empty string"))
193193
return
194194
}
195195
}

templates/swagger/v1_json.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13096,6 +13096,10 @@
1309613096
"EditUserOption": {
1309713097
"description": "EditUserOption edit user options",
1309813098
"type": "object",
13099+
"required": [
13100+
"source_id",
13101+
"login_name"
13102+
],
1309913103
"properties": {
1310013104
"active": {
1310113105
"type": "boolean",

0 commit comments

Comments
 (0)