Skip to content

Commit 98e9ce6

Browse files
committed
improve
1 parent 90e3f9f commit 98e9ce6

File tree

7 files changed

+24
-34
lines changed

7 files changed

+24
-34
lines changed

modules/structs/issue.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ type PullRequestMeta struct {
3535

3636
// RepositoryMeta basic repository information
3737
type RepositoryMeta struct {
38-
ID int64 `json:"id"`
39-
Name string `json:"name"`
40-
// owner of the repo
38+
ID int64 `json:"id"`
39+
Name string `json:"name"`
4140
Owner string `json:"owner"`
4241
FullName string `json:"full_name"`
4342
}
@@ -264,7 +263,7 @@ func (it IssueTemplate) Type() IssueTemplateType {
264263
// swagger:model
265264
type IssueMeta struct {
266265
Index int64 `json:"index"`
267-
// owner of the issue
266+
// owner of the issue's repo
268267
Owner string `json:"owner"`
269268
Name string `json:"repo"`
270269
}

modules/structs/issue_stopwatch.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ import (
1010
// StopWatch represent a running stopwatch
1111
type StopWatch struct {
1212
// swagger:strfmt date-time
13-
Created time.Time `json:"created"`
14-
Seconds int64 `json:"seconds"`
15-
Duration string `json:"duration"`
16-
IssueIndex int64 `json:"issue_index"`
17-
IssueTitle string `json:"issue_title"`
18-
// owner of the repo
19-
RepoOwnerName string `json:"repo_owner_name"`
20-
RepoName string `json:"repo_name"`
13+
Created time.Time `json:"created"`
14+
Seconds int64 `json:"seconds"`
15+
Duration string `json:"duration"`
16+
IssueIndex int64 `json:"issue_index"`
17+
IssueTitle string `json:"issue_title"`
18+
RepoOwnerName string `json:"repo_owner_name"`
19+
RepoName string `json:"repo_name"`
2120
}
2221

2322
// StopWatches represent a list of stopwatches

modules/structs/package.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import (
99

1010
// Package represents a package
1111
type Package struct {
12-
ID int64 `json:"id"`
13-
// owner of the package
12+
ID int64 `json:"id"`
1413
Owner *User `json:"owner"`
1514
Repository *Repository `json:"repository"`
1615
Creator *User `json:"creator"`

modules/structs/repo.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ type ExternalWiki struct {
4848

4949
// Repository represents a repository
5050
type Repository struct {
51-
ID int64 `json:"id"`
52-
// owner of the repo
51+
ID int64 `json:"id"`
5352
Owner *User `json:"owner"`
5453
Name string `json:"name"`
5554
FullName string `json:"full_name"`
@@ -58,7 +57,7 @@ type Repository struct {
5857
Private bool `json:"private"`
5958
Fork bool `json:"fork"`
6059
Template bool `json:"template"`
61-
// the original repository if the repository in the parameter is a fork; else empty
60+
// the original repository if this repository is a fork, otherwise null
6261
Parent *Repository `json:"parent,omitempty"`
6362
Mirror bool `json:"mirror"`
6463
Size int `json:"size"`
@@ -230,7 +229,7 @@ type EditRepoOption struct {
230229
// GenerateRepoOption options when creating repository using a template
231230
// swagger:model
232231
type GenerateRepoOption struct {
233-
// owner of the repo
232+
// The organization's name or individual user's name who will own the new repository
234233
//
235234
// required: true
236235
Owner string `json:"owner"`
@@ -293,7 +292,6 @@ type UpdateBranchRepoOption struct {
293292
// TransferRepoOption options when transfer a repository's ownership
294293
// swagger:model
295294
type TransferRepoOption struct {
296-
// new owner of the repo
297295
// required: true
298296
NewOwner string `json:"new_owner"`
299297
// ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
@@ -354,9 +352,8 @@ type MigrateRepoOptions struct {
354352
// required: true
355353
CloneAddr string `json:"clone_addr" binding:"Required"`
356354
// deprecated (only for backwards compatibility)
357-
RepoOwnerID int64 `json:"uid"`
358-
// owner of the repo after migration
359-
RepoOwner string `json:"repo_owner"`
355+
RepoOwnerID int64 `json:"uid"`
356+
RepoOwner string `json:"repo_owner"`
360357
// required: true
361358
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
362359

modules/structs/user_key.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ type PublicKey struct {
1515
Title string `json:"title,omitempty"`
1616
Fingerprint string `json:"fingerprint,omitempty"`
1717
// swagger:strfmt date-time
18-
Created time.Time `json:"created_at"`
19-
Updated time.Time `json:"last_used_at"`
20-
// owner of the key
21-
Owner *User `json:"user,omitempty"`
22-
ReadOnly bool `json:"read_only,omitempty"`
23-
KeyType string `json:"key_type,omitempty"`
18+
Created time.Time `json:"created_at"`
19+
Updated time.Time `json:"last_used_at"`
20+
Owner *User `json:"user,omitempty"`
21+
ReadOnly bool `json:"read_only,omitempty"`
22+
KeyType string `json:"key_type,omitempty"`
2423
}

templates/swagger/ui.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<link href="{{AssetUrlPrefix}}/css/swagger.css?v={{AssetVersion}}" rel="stylesheet">
66
</head>
77
<body>
8+
{{/* TODO: add Help & Glossary to help users understand the API, and explain some concepts like "Owner" */}}
89
<a class="swagger-back-link" href="{{AppSubUrl}}/">{{svg "octicon-reply"}}{{ctx.Locale.Tr "return_to_gitea"}}</a>
910
<div id="swagger-ui" data-source="{{AppSubUrl}}/swagger.{{.APIJSONVersion}}.json"></div>
1011
<footer class="page-footer"></footer>

templates/swagger/v1_json.tmpl

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)