Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] [Docs] CreateHook: update swagger info #9558

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update swagger info
  • Loading branch information
6543 committed Dec 31, 2019
commit fd33cf87b7420e9d685f4881f6687ed83207b7a0
12 changes: 8 additions & 4 deletions modules/structs/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ type Hook struct {
// HookList represents a list of API hook.
type HookList []*Hook

// CreateHookOptionConfig has all config options in it
// required are "content_type" and "url" Required
type CreateHookOptionConfig map[string]string

// CreateHookOption options when create a hook
type CreateHookOption struct {
// required: true
// enum: gitea,gogs,slack,discord
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram
Type string `json:"type" binding:"Required"`
// required: true
Config map[string]string `json:"config" binding:"Required"`
Events []string `json:"events"`
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
Config CreateHookOptionConfig `json:"config" binding:"Required"`
Events []string `json:"events"`
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
// default: false
Active bool `json:"active"`
}
Expand Down
19 changes: 13 additions & 6 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8609,11 +8609,7 @@
"x-go-name": "BranchFilter"
},
"config": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-name": "Config"
"$ref": "#/definitions/CreateHookOptionConfig"
},
"events": {
"type": "array",
Expand All @@ -8625,16 +8621,27 @@
"type": {
"type": "string",
"enum": [
"dingtalk",
"discord",
"gitea",
"gogs",
"msteams",
"slack",
"discord"
"telegram"
],
"x-go-name": "Type"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateHookOptionConfig": {
"description": "CreateHookOptionConfig has all config options in it\nrequired are \"content_type\" and \"url\" Required",
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateIssueCommentOption": {
"description": "CreateIssueCommentOption options for creating a comment on an issue",
"type": "object",
Expand Down