add simple descriptions for swagger validate (#4087)

* Partial fix for #4010

Swagger needs a comment line above each swagger:response comment -- it
uses these to populate the description: fields.  Adding minimal text
for now on the way to getting swagger validate to pass.  Many standard
swagger client libraries will not work at all with gitea until validate
passes, so prioritizing that over better descriptions for now.

Signed-off-by: Steve Traugott <stevegt@t7a.org>
This commit is contained in:
stevegt 2018-05-31 04:13:55 -07:00 committed by Lunny Xiao
parent 728cc27284
commit 7707ad7a0a
8 changed files with 82 additions and 0 deletions

View file

@ -7376,11 +7376,13 @@
"description": "AccessTokenList represents a list of API access token." "description": "AccessTokenList represents a list of API access token."
}, },
"Attachment": { "Attachment": {
"description": "Attachment",
"schema": { "schema": {
"$ref": "#/definitions/Attachment" "$ref": "#/definitions/Attachment"
} }
}, },
"AttachmentList": { "AttachmentList": {
"description": "AttachmentList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7389,11 +7391,13 @@
} }
}, },
"Branch": { "Branch": {
"description": "Branch",
"schema": { "schema": {
"$ref": "#/definitions/Branch" "$ref": "#/definitions/Branch"
} }
}, },
"BranchList": { "BranchList": {
"description": "BranchList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7402,11 +7406,13 @@
} }
}, },
"Comment": { "Comment": {
"description": "Comment",
"schema": { "schema": {
"$ref": "#/definitions/Comment" "$ref": "#/definitions/Comment"
} }
}, },
"CommentList": { "CommentList": {
"description": "CommentList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7415,11 +7421,13 @@
} }
}, },
"DeployKey": { "DeployKey": {
"description": "DeployKey",
"schema": { "schema": {
"$ref": "#/definitions/DeployKey" "$ref": "#/definitions/DeployKey"
} }
}, },
"DeployKeyList": { "DeployKeyList": {
"description": "DeployKeyList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7428,6 +7436,7 @@
} }
}, },
"EmailList": { "EmailList": {
"description": "EmailList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7436,11 +7445,13 @@
} }
}, },
"GPGKey": { "GPGKey": {
"description": "GPGKey",
"schema": { "schema": {
"$ref": "#/definitions/GPGKey" "$ref": "#/definitions/GPGKey"
} }
}, },
"GPGKeyList": { "GPGKeyList": {
"description": "GPGKeyList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7449,6 +7460,7 @@
} }
}, },
"Hook": { "Hook": {
"description": "Hook",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7457,6 +7469,7 @@
} }
}, },
"HookList": { "HookList": {
"description": "HookList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7465,11 +7478,13 @@
} }
}, },
"Issue": { "Issue": {
"description": "Issue",
"schema": { "schema": {
"$ref": "#/definitions/Issue" "$ref": "#/definitions/Issue"
} }
}, },
"IssueList": { "IssueList": {
"description": "IssueList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7478,11 +7493,13 @@
} }
}, },
"Label": { "Label": {
"description": "Label",
"schema": { "schema": {
"$ref": "#/definitions/Label" "$ref": "#/definitions/Label"
} }
}, },
"LabelList": { "LabelList": {
"description": "LabelList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7494,11 +7511,13 @@
"description": "MarkdownRender is a rendered markdown document" "description": "MarkdownRender is a rendered markdown document"
}, },
"Milestone": { "Milestone": {
"description": "Milestone",
"schema": { "schema": {
"$ref": "#/definitions/Milestone" "$ref": "#/definitions/Milestone"
} }
}, },
"MilestoneList": { "MilestoneList": {
"description": "MilestoneList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7507,11 +7526,13 @@
} }
}, },
"Organization": { "Organization": {
"description": "Organization",
"schema": { "schema": {
"$ref": "#/definitions/Organization" "$ref": "#/definitions/Organization"
} }
}, },
"OrganizationList": { "OrganizationList": {
"description": "OrganizationList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7520,11 +7541,13 @@
} }
}, },
"PublicKey": { "PublicKey": {
"description": "PublicKey",
"schema": { "schema": {
"$ref": "#/definitions/PublicKey" "$ref": "#/definitions/PublicKey"
} }
}, },
"PublicKeyList": { "PublicKeyList": {
"description": "PublicKeyList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7533,11 +7556,13 @@
} }
}, },
"PullRequest": { "PullRequest": {
"description": "PullRequest",
"schema": { "schema": {
"$ref": "#/definitions/PullRequest" "$ref": "#/definitions/PullRequest"
} }
}, },
"PullRequestList": { "PullRequestList": {
"description": "PullRequestList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7546,11 +7571,13 @@
} }
}, },
"Release": { "Release": {
"description": "Release",
"schema": { "schema": {
"$ref": "#/definitions/Release" "$ref": "#/definitions/Release"
} }
}, },
"ReleaseList": { "ReleaseList": {
"description": "ReleaseList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7559,11 +7586,13 @@
} }
}, },
"Repository": { "Repository": {
"description": "Repository",
"schema": { "schema": {
"$ref": "#/definitions/Repository" "$ref": "#/definitions/Repository"
} }
}, },
"RepositoryList": { "RepositoryList": {
"description": "RepositoryList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7572,6 +7601,7 @@
} }
}, },
"SearchResults": { "SearchResults": {
"description": "SearchResults",
"schema": { "schema": {
"$ref": "#/definitions/SearchResults" "$ref": "#/definitions/SearchResults"
}, },
@ -7580,16 +7610,19 @@
} }
}, },
"ServerVersion": { "ServerVersion": {
"description": "ServerVersion",
"schema": { "schema": {
"$ref": "#/definitions/ServerVersion" "$ref": "#/definitions/ServerVersion"
} }
}, },
"Status": { "Status": {
"description": "Status",
"schema": { "schema": {
"$ref": "#/definitions/Status" "$ref": "#/definitions/Status"
} }
}, },
"StatusList": { "StatusList": {
"description": "StatusList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7598,11 +7631,13 @@
} }
}, },
"Team": { "Team": {
"description": "Team",
"schema": { "schema": {
"$ref": "#/definitions/Team" "$ref": "#/definitions/Team"
} }
}, },
"TeamList": { "TeamList": {
"description": "TeamList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7611,11 +7646,13 @@
} }
}, },
"TrackedTime": { "TrackedTime": {
"description": "TrackedTime",
"schema": { "schema": {
"$ref": "#/definitions/TrackedTime" "$ref": "#/definitions/TrackedTime"
} }
}, },
"TrackedTimeList": { "TrackedTimeList": {
"description": "TrackedTimeList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7624,11 +7661,13 @@
} }
}, },
"User": { "User": {
"description": "User",
"schema": { "schema": {
"$ref": "#/definitions/User" "$ref": "#/definitions/User"
} }
}, },
"UserList": { "UserList": {
"description": "UserList",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -7637,6 +7676,7 @@
} }
}, },
"WatchInfo": { "WatchInfo": {
"description": "WatchInfo",
"schema": { "schema": {
"$ref": "#/definitions/WatchInfo" "$ref": "#/definitions/WatchInfo"
} }
@ -7670,6 +7710,7 @@
"description": "APINotFound is a not found empty response" "description": "APINotFound is a not found empty response"
}, },
"parameterBodies": { "parameterBodies": {
"description": "parameterBodies",
"schema": { "schema": {
"$ref": "#/definitions/EditAttachmentOptions" "$ref": "#/definitions/EditAttachmentOptions"
}, },

View file

@ -8,60 +8,70 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// Issue
// swagger:response Issue // swagger:response Issue
type swaggerResponseIssue struct { type swaggerResponseIssue struct {
// in:body // in:body
Body api.Issue `json:"body"` Body api.Issue `json:"body"`
} }
// IssueList
// swagger:response IssueList // swagger:response IssueList
type swaggerResponseIssueList struct { type swaggerResponseIssueList struct {
// in:body // in:body
Body []api.Issue `json:"body"` Body []api.Issue `json:"body"`
} }
// Comment
// swagger:response Comment // swagger:response Comment
type swaggerResponseComment struct { type swaggerResponseComment struct {
// in:body // in:body
Body api.Comment `json:"body"` Body api.Comment `json:"body"`
} }
// CommentList
// swagger:response CommentList // swagger:response CommentList
type swaggerResponseCommentList struct { type swaggerResponseCommentList struct {
// in:body // in:body
Body []api.Comment `json:"body"` Body []api.Comment `json:"body"`
} }
// Label
// swagger:response Label // swagger:response Label
type swaggerResponseLabel struct { type swaggerResponseLabel struct {
// in:body // in:body
Body api.Label `json:"body"` Body api.Label `json:"body"`
} }
// LabelList
// swagger:response LabelList // swagger:response LabelList
type swaggerResponseLabelList struct { type swaggerResponseLabelList struct {
// in:body // in:body
Body []api.Label `json:"body"` Body []api.Label `json:"body"`
} }
// Milestone
// swagger:response Milestone // swagger:response Milestone
type swaggerResponseMilestone struct { type swaggerResponseMilestone struct {
// in:body // in:body
Body api.Milestone `json:"body"` Body api.Milestone `json:"body"`
} }
// MilestoneList
// swagger:response MilestoneList // swagger:response MilestoneList
type swaggerResponseMilestoneList struct { type swaggerResponseMilestoneList struct {
// in:body // in:body
Body []api.Milestone `json:"body"` Body []api.Milestone `json:"body"`
} }
// TrackedTime
// swagger:response TrackedTime // swagger:response TrackedTime
type swaggerResponseTrackedTime struct { type swaggerResponseTrackedTime struct {
// in:body // in:body
Body api.TrackedTime `json:"body"` Body api.TrackedTime `json:"body"`
} }
// TrackedTimeList
// swagger:response TrackedTimeList // swagger:response TrackedTimeList
type swaggerResponseTrackedTimeList struct { type swaggerResponseTrackedTimeList struct {
// in:body // in:body

View file

@ -8,36 +8,42 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// PublicKey
// swagger:response PublicKey // swagger:response PublicKey
type swaggerResponsePublicKey struct { type swaggerResponsePublicKey struct {
// in:body // in:body
Body api.PublicKey `json:"body"` Body api.PublicKey `json:"body"`
} }
// PublicKeyList
// swagger:response PublicKeyList // swagger:response PublicKeyList
type swaggerResponsePublicKeyList struct { type swaggerResponsePublicKeyList struct {
// in:body // in:body
Body []api.PublicKey `json:"body"` Body []api.PublicKey `json:"body"`
} }
// GPGKey
// swagger:response GPGKey // swagger:response GPGKey
type swaggerResponseGPGKey struct { type swaggerResponseGPGKey struct {
// in:body // in:body
Body api.GPGKey `json:"body"` Body api.GPGKey `json:"body"`
} }
// GPGKeyList
// swagger:response GPGKeyList // swagger:response GPGKeyList
type swaggerResponseGPGKeyList struct { type swaggerResponseGPGKeyList struct {
// in:body // in:body
Body []api.GPGKey `json:"body"` Body []api.GPGKey `json:"body"`
} }
// DeployKey
// swagger:response DeployKey // swagger:response DeployKey
type swaggerResponseDeployKey struct { type swaggerResponseDeployKey struct {
// in:body // in:body
Body api.DeployKey `json:"body"` Body api.DeployKey `json:"body"`
} }
// DeployKeyList
// swagger:response DeployKeyList // swagger:response DeployKeyList
type swaggerResponseDeployKeyList struct { type swaggerResponseDeployKeyList struct {
// in:body // in:body

View file

@ -8,6 +8,7 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// ServerVersion
// swagger:response ServerVersion // swagger:response ServerVersion
type swaggerResponseServerVersion struct { type swaggerResponseServerVersion struct {
// in:body // in:body

View file

@ -12,6 +12,7 @@ import (
// not actually a response, just a hack to get go-swagger to include definitions // not actually a response, just a hack to get go-swagger to include definitions
// of the various XYZOption structs // of the various XYZOption structs
// parameterBodies
// swagger:response parameterBodies // swagger:response parameterBodies
type swaggerParameterBodies struct { type swaggerParameterBodies struct {
AddCollaboratorOption api.AddCollaboratorOption AddCollaboratorOption api.AddCollaboratorOption

View file

@ -8,24 +8,28 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// Organization
// swagger:response Organization // swagger:response Organization
type swaggerResponseOrganization struct { type swaggerResponseOrganization struct {
// in:body // in:body
Body api.Organization `json:"body"` Body api.Organization `json:"body"`
} }
// OrganizationList
// swagger:response OrganizationList // swagger:response OrganizationList
type swaggerResponseOrganizationList struct { type swaggerResponseOrganizationList struct {
// in:body // in:body
Body []api.Organization `json:"body"` Body []api.Organization `json:"body"`
} }
// Team
// swagger:response Team // swagger:response Team
type swaggerResponseTeam struct { type swaggerResponseTeam struct {
// in:body // in:body
Body api.Team `json:"body"` Body api.Team `json:"body"`
} }
// TeamList
// swagger:response TeamList // swagger:response TeamList
type swaggerResponseTeamList struct { type swaggerResponseTeamList struct {
// in:body // in:body

View file

@ -8,95 +8,111 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// Repository
// swagger:response Repository // swagger:response Repository
type swaggerResponseRepository struct { type swaggerResponseRepository struct {
// in:body // in:body
Body api.Repository `json:"body"` Body api.Repository `json:"body"`
} }
// RepositoryList
// swagger:response RepositoryList // swagger:response RepositoryList
type swaggerResponseRepositoryList struct { type swaggerResponseRepositoryList struct {
// in:body // in:body
Body []api.Repository `json:"body"` Body []api.Repository `json:"body"`
} }
// Branch
// swagger:response Branch // swagger:response Branch
type swaggerResponseBranch struct { type swaggerResponseBranch struct {
// in:body // in:body
Body api.Branch `json:"body"` Body api.Branch `json:"body"`
} }
// BranchList
// swagger:response BranchList // swagger:response BranchList
type swaggerResponseBranchList struct { type swaggerResponseBranchList struct {
// in:body // in:body
Body []api.Branch `json:"body"` Body []api.Branch `json:"body"`
} }
// Hook
// swagger:response Hook // swagger:response Hook
type swaggerResponseHook struct { type swaggerResponseHook struct {
// in:body // in:body
Body []api.Branch `json:"body"` Body []api.Branch `json:"body"`
} }
// HookList
// swagger:response HookList // swagger:response HookList
type swaggerResponseHookList struct { type swaggerResponseHookList struct {
// in:body // in:body
Body []api.Branch `json:"body"` Body []api.Branch `json:"body"`
} }
// Release
// swagger:response Release // swagger:response Release
type swaggerResponseRelease struct { type swaggerResponseRelease struct {
// in:body // in:body
Body api.Release `json:"body"` Body api.Release `json:"body"`
} }
// ReleaseList
// swagger:response ReleaseList // swagger:response ReleaseList
type swaggerResponseReleaseList struct { type swaggerResponseReleaseList struct {
// in:body // in:body
Body []api.Release `json:"body"` Body []api.Release `json:"body"`
} }
// PullRequest
// swagger:response PullRequest // swagger:response PullRequest
type swaggerResponsePullRequest struct { type swaggerResponsePullRequest struct {
// in:body // in:body
Body api.PullRequest `json:"body"` Body api.PullRequest `json:"body"`
} }
// PullRequestList
// swagger:response PullRequestList // swagger:response PullRequestList
type swaggerResponsePullRequestList struct { type swaggerResponsePullRequestList struct {
// in:body // in:body
Body []api.PullRequest `json:"body"` Body []api.PullRequest `json:"body"`
} }
// Status
// swagger:response Status // swagger:response Status
type swaggerResponseStatus struct { type swaggerResponseStatus struct {
// in:body // in:body
Body api.Status `json:"body"` Body api.Status `json:"body"`
} }
// StatusList
// swagger:response StatusList // swagger:response StatusList
type swaggerResponseStatusList struct { type swaggerResponseStatusList struct {
// in:body // in:body
Body []api.Status `json:"body"` Body []api.Status `json:"body"`
} }
// WatchInfo
// swagger:response WatchInfo // swagger:response WatchInfo
type swaggerResponseWatchInfo struct { type swaggerResponseWatchInfo struct {
// in:body // in:body
Body api.WatchInfo `json:"body"` Body api.WatchInfo `json:"body"`
} }
// SearchResults
// swagger:response SearchResults // swagger:response SearchResults
type swaggerResponseSearchResults struct { type swaggerResponseSearchResults struct {
Body api.SearchResults `json:"body"` Body api.SearchResults `json:"body"`
} }
// AttachmentList
// swagger:response AttachmentList // swagger:response AttachmentList
type swaggerResponseAttachmentList struct { type swaggerResponseAttachmentList struct {
//in: body //in: body
Body []api.Attachment `json:"body"` Body []api.Attachment `json:"body"`
} }
// Attachment
// swagger:response Attachment // swagger:response Attachment
type swaggerResponseAttachment struct { type swaggerResponseAttachment struct {
//in: body //in: body

View file

@ -8,18 +8,21 @@ import (
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
) )
// User
// swagger:response User // swagger:response User
type swaggerResponseUser struct { type swaggerResponseUser struct {
// in:body // in:body
Body api.User `json:"body"` Body api.User `json:"body"`
} }
// UserList
// swagger:response UserList // swagger:response UserList
type swaggerResponseUserList struct { type swaggerResponseUserList struct {
// in:body // in:body
Body []api.User `json:"body"` Body []api.User `json:"body"`
} }
// EmailList
// swagger:response EmailList // swagger:response EmailList
type swaggerResponseEmailList struct { type swaggerResponseEmailList struct {
// in:body // in:body