From 655aea13a5ad5dd51bcaafd1b96ecce2673f0312 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 31 Dec 2019 05:11:15 +0100 Subject: [PATCH] update swagger info (#9558) --- modules/structs/hook.go | 12 ++++++++---- templates/swagger/v1_json.tmpl | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/modules/structs/hook.go b/modules/structs/hook.go index d62c900f4..7ec46254e 100644 --- a/modules/structs/hook.go +++ b/modules/structs/hook.go @@ -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"` } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 7f08b939c..77def7aea 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -8609,11 +8609,7 @@ "x-go-name": "BranchFilter" }, "config": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-go-name": "Config" + "$ref": "#/definitions/CreateHookOptionConfig" }, "events": { "type": "array", @@ -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",