Skip to content

Commit 655aea1

Browse files
6543lunny
authored andcommitted
update swagger info (#9558)
1 parent 2775771 commit 655aea1

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

modules/structs/hook.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,19 @@ type Hook struct {
3434
// HookList represents a list of API hook.
3535
type HookList []*Hook
3636

37+
// CreateHookOptionConfig has all config options in it
38+
// required are "content_type" and "url" Required
39+
type CreateHookOptionConfig map[string]string
40+
3741
// CreateHookOption options when create a hook
3842
type CreateHookOption struct {
3943
// required: true
40-
// enum: gitea,gogs,slack,discord
44+
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram
4145
Type string `json:"type" binding:"Required"`
4246
// required: true
43-
Config map[string]string `json:"config" binding:"Required"`
44-
Events []string `json:"events"`
45-
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
47+
Config CreateHookOptionConfig `json:"config" binding:"Required"`
48+
Events []string `json:"events"`
49+
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
4650
// default: false
4751
Active bool `json:"active"`
4852
}

templates/swagger/v1_json.tmpl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8609,11 +8609,7 @@
86098609
"x-go-name": "BranchFilter"
86108610
},
86118611
"config": {
8612-
"type": "object",
8613-
"additionalProperties": {
8614-
"type": "string"
8615-
},
8616-
"x-go-name": "Config"
8612+
"$ref": "#/definitions/CreateHookOptionConfig"
86178613
},
86188614
"events": {
86198615
"type": "array",
@@ -8625,16 +8621,27 @@
86258621
"type": {
86268622
"type": "string",
86278623
"enum": [
8624+
"dingtalk",
8625+
"discord",
86288626
"gitea",
86298627
"gogs",
8628+
"msteams",
86308629
"slack",
8631-
"discord"
8630+
"telegram"
86328631
],
86338632
"x-go-name": "Type"
86348633
}
86358634
},
86368635
"x-go-package": "code.gitea.io/gitea/modules/structs"
86378636
},
8637+
"CreateHookOptionConfig": {
8638+
"description": "CreateHookOptionConfig has all config options in it\nrequired are \"content_type\" and \"url\" Required",
8639+
"type": "object",
8640+
"additionalProperties": {
8641+
"type": "string"
8642+
},
8643+
"x-go-package": "code.gitea.io/gitea/modules/structs"
8644+
},
86388645
"CreateIssueCommentOption": {
86398646
"description": "CreateIssueCommentOption options for creating a comment on an issue",
86408647
"type": "object",

0 commit comments

Comments
 (0)