From d04aece7b147f2b2d663bca6380c805eeecc8f2d Mon Sep 17 00:00:00 2001 From: c1ucki3 Date: Tue, 26 May 2026 14:53:46 -0700 Subject: [PATCH] fix descriptions generated from struct comments trailing periods and double quotes caused inconsistent rendering --- modules/structs/issue.go | 2 +- modules/structs/mirror.go | 2 +- modules/structs/moderation.go | 2 +- modules/structs/repo_commit.go | 8 +++---- modules/structs/repo_compare.go | 2 +- modules/structs/repo_file.go | 2 +- modules/structs/repo_refs.go | 4 ++-- modules/structs/runner.go | 4 ++-- modules/structs/secret.go | 2 +- modules/structs/user_app.go | 4 ++-- modules/structs/variable.go | 4 ++-- templates/swagger/v1_json.tmpl | 38 ++++++++++++++++----------------- 12 files changed, 37 insertions(+), 37 deletions(-) diff --git a/modules/structs/issue.go b/modules/structs/issue.go index 37c71f5736..ac7ccabca7 100644 --- a/modules/structs/issue.go +++ b/modules/structs/issue.go @@ -131,7 +131,7 @@ type IssueDeadline struct { Deadline *time.Time `json:"due_date"` } -// IssueFormFieldType defines issue form field type, can be "markdown", "textarea", "input", "dropdown" or "checkboxes" +// IssueFormFieldType defines issue form field type, can be `markdown`, `textarea`, `input`, `dropdown` or `checkboxes` type IssueFormFieldType string const ( diff --git a/modules/structs/mirror.go b/modules/structs/mirror.go index 4909ae20ca..714ce220c7 100644 --- a/modules/structs/mirror.go +++ b/modules/structs/mirror.go @@ -5,7 +5,7 @@ package structs import "time" -// CreatePushMirrorOption represents need information to create a push mirror of a repository. +// CreatePushMirrorOption represents need information to create a push mirror of a repository type CreatePushMirrorOption struct { RemoteAddress string `json:"remote_address"` RemoteUsername string `json:"remote_username"` diff --git a/modules/structs/moderation.go b/modules/structs/moderation.go index c1e55085a7..36028b90e3 100644 --- a/modules/structs/moderation.go +++ b/modules/structs/moderation.go @@ -5,7 +5,7 @@ package structs import "time" -// BlockedUser represents a blocked user. +// BlockedUser represents a blocked user type BlockedUser struct { BlockID int64 `json:"block_id"` // swagger:strfmt date-time diff --git a/modules/structs/repo_commit.go b/modules/structs/repo_commit.go index fec7d97608..49780153fd 100644 --- a/modules/structs/repo_commit.go +++ b/modules/structs/repo_commit.go @@ -15,7 +15,7 @@ type Identity struct { Email string `json:"email" binding:"MaxSize(254)"` } -// CommitMeta contains meta information of a commit in terms of API. +// CommitMeta contains meta information of a commit in terms of API type CommitMeta struct { URL string `json:"url"` SHA string `json:"sha"` @@ -23,13 +23,13 @@ type CommitMeta struct { Created time.Time `json:"created"` } -// CommitUser contains information of a user in the context of a commit. +// CommitUser contains information of a user in the context of a commit type CommitUser struct { Identity Date string `json:"date"` } -// RepoCommit contains information of a commit in the context of a repository. +// RepoCommit contains information of a commit in the context of a repository type RepoCommit struct { URL string `json:"url"` Author *CommitUser `json:"author"` @@ -46,7 +46,7 @@ type CommitStats struct { Deletions int `json:"deletions"` } -// Commit contains information generated from a Git commit. +// Commit contains information generated from a Git commit type Commit struct { *CommitMeta HTMLURL string `json:"html_url"` diff --git a/modules/structs/repo_compare.go b/modules/structs/repo_compare.go index 6e77a813d3..751d4e17b9 100644 --- a/modules/structs/repo_compare.go +++ b/modules/structs/repo_compare.go @@ -3,7 +3,7 @@ package structs -// Compare represents a comparison between two commits. +// Compare represents a comparison between two commits type Compare struct { TotalCommits int `json:"total_commits"` // Total number of commits in the comparison. Commits []*Commit `json:"commits"` // List of commits in the comparison. diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go index 242343493b..fa6b5fd763 100644 --- a/modules/structs/repo_file.go +++ b/modules/structs/repo_file.go @@ -143,7 +143,7 @@ type ContentsResponse struct { Links *FileLinksResponse `json:"_links"` } -// FileCommitResponse contains information generated from a Git commit for a repo's file. +// FileCommitResponse contains information generated from a Git commit for a repo's file type FileCommitResponse struct { CommitMeta HTMLURL string `json:"html_url"` diff --git a/modules/structs/repo_refs.go b/modules/structs/repo_refs.go index 6ffbc74a51..73296f1fd8 100644 --- a/modules/structs/repo_refs.go +++ b/modules/structs/repo_refs.go @@ -3,14 +3,14 @@ package structs -// Reference represents a Git reference. +// Reference represents a Git reference type Reference struct { Ref string `json:"ref"` URL string `json:"url"` Object *GitObject `json:"object"` } -// GitObject represents a Git object. +// GitObject represents a Git object type GitObject struct { Type string `json:"type"` SHA string `json:"sha"` diff --git a/modules/structs/runner.go b/modules/structs/runner.go index 5ac88f0488..7efdddfaa4 100644 --- a/modules/structs/runner.go +++ b/modules/structs/runner.go @@ -3,7 +3,7 @@ package structs -// RegisterRunnerOptions declares the accepted options for registering runners. +// RegisterRunnerOptions declares the accepted options for registering runners // swagger:model type RegisterRunnerOptions struct { // Name of the runner to register. The name of the runner does not have to be unique. @@ -22,7 +22,7 @@ type RegisterRunnerOptions struct { Ephemeral bool `json:"ephemeral"` } -// RegisterRunnerResponse contains the details of the just registered runner. +// RegisterRunnerResponse contains the details of the just registered runner // swagger:model type RegisterRunnerResponse struct { ID int64 `json:"id" binding:"Required"` diff --git a/modules/structs/secret.go b/modules/structs/secret.go index acd5c36f06..ed72320ef6 100644 --- a/modules/structs/secret.go +++ b/modules/structs/secret.go @@ -14,7 +14,7 @@ type Secret struct { Created time.Time `json:"created_at"` } -// CreateOrUpdateSecretOption defines the properties of the secret to create or update. +// CreateOrUpdateSecretOption defines the properties of the secret to create or update // swagger:model type CreateOrUpdateSecretOption struct { // Data of the secret. Special characters will be retained. Line endings will be normalized to LF to match the diff --git a/modules/structs/user_app.go b/modules/structs/user_app.go index 5e27e5b0f4..46d14e7044 100644 --- a/modules/structs/user_app.go +++ b/modules/structs/user_app.go @@ -8,7 +8,7 @@ import ( "time" ) -// AccessToken represents an API access token. +// AccessToken represents an API access token // swagger:response AccessToken type AccessToken struct { ID int64 `json:"id"` @@ -43,7 +43,7 @@ type CreateOAuth2ApplicationOptions struct { RedirectURIs []string `json:"redirect_uris" binding:"Required"` } -// OAuth2Application represents an OAuth2 application. +// OAuth2Application represents an OAuth2 application // swagger:response OAuth2Application type OAuth2Application struct { ID int64 `json:"id"` diff --git a/modules/structs/variable.go b/modules/structs/variable.go index c88aad5138..6ba3ed7bd0 100644 --- a/modules/structs/variable.go +++ b/modules/structs/variable.go @@ -3,7 +3,7 @@ package structs -// CreateVariableOption defines the properties of the variable to create. +// CreateVariableOption defines the properties of the variable to create // swagger:model type CreateVariableOption struct { // Value of the variable to create. Special characters will be retained. Line endings will be normalized to LF to @@ -13,7 +13,7 @@ type CreateVariableOption struct { Value string `json:"value" binding:"Required"` } -// UpdateVariableOption defines the properties of the variable to update. +// UpdateVariableOption defines the properties of the variable to update // swagger:model type UpdateVariableOption struct { // New name for the variable. If the field is empty, the variable name won't be updated. Forgejo will convert it to diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 3b04fd4146..84362d5f8c 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -22807,8 +22807,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "AccessToken": { + "description": "AccessToken represents an API access token", "type": "object", - "title": "AccessToken represents an API access token.", "properties": { "created_at": { "type": "string", @@ -23528,8 +23528,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "BlockedUser": { + "description": "BlockedUser represents a blocked user", "type": "object", - "title": "BlockedUser represents a blocked user.", "properties": { "block_id": { "type": "integer", @@ -23969,8 +23969,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "Commit": { + "description": "Commit contains information generated from a Git commit", "type": "object", - "title": "Commit contains information generated from a Git commit.", "properties": { "author": { "$ref": "#/definitions/User" @@ -24051,8 +24051,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "CommitMeta": { + "description": "CommitMeta contains meta information of a commit in terms of API", "type": "object", - "title": "CommitMeta contains meta information of a commit in terms of API.", "properties": { "created": { "type": "string", @@ -24142,8 +24142,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "CommitUser": { + "description": "CommitUser contains information of a user in the context of a commit", "type": "object", - "title": "CommitUser contains information of a user in the context of a commit.", "properties": { "date": { "type": "string", @@ -24162,8 +24162,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "Compare": { + "description": "Compare represents a comparison between two commits", "type": "object", - "title": "Compare represents a comparison between two commits.", "properties": { "commits": { "type": "array", @@ -24809,8 +24809,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "CreateOrUpdateSecretOption": { + "description": "CreateOrUpdateSecretOption defines the properties of the secret to create or update", "type": "object", - "title": "CreateOrUpdateSecretOption defines the properties of the secret to create or update.", "required": [ "data" ], @@ -24980,8 +24980,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "CreatePushMirrorOption": { + "description": "CreatePushMirrorOption represents need information to create a push mirror of a repository", "type": "object", - "title": "CreatePushMirrorOption represents need information to create a push mirror of a repository.", "properties": { "branch_filter": { "type": "string", @@ -25381,8 +25381,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "CreateVariableOption": { + "description": "CreateVariableOption defines the properties of the variable to create", "type": "object", - "title": "CreateVariableOption defines the properties of the variable to create.", "required": [ "value" ], @@ -26560,8 +26560,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "FileCommitResponse": { + "description": "FileCommitResponse contains information generated from a Git commit for a repo's file", "type": "object", - "title": "FileCommitResponse contains information generated from a Git commit for a repo's file.", "properties": { "author": { "$ref": "#/definitions/CommitUser" @@ -27031,8 +27031,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "GitObject": { + "description": "GitObject represents a Git object", "type": "object", - "title": "GitObject represents a Git object.", "properties": { "sha": { "type": "string", @@ -27414,8 +27414,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "IssueFormFieldType": { + "description": "IssueFormFieldType defines issue form field type, can be `markdown`, `textarea`, `input`, `dropdown` or `checkboxes`", "type": "string", - "title": "IssueFormFieldType defines issue form field type, can be \"markdown\", \"textarea\", \"input\", \"dropdown\" or \"checkboxes\"", "x-go-package": "forgejo.org/modules/structs" }, "IssueFormFieldVisible": { @@ -28142,8 +28142,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "OAuth2Application": { + "description": "OAuth2Application represents an OAuth2 application", "type": "object", - "title": "OAuth2Application represents an OAuth2 application.", "properties": { "client_id": { "type": "string", @@ -29263,8 +29263,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "Reference": { + "description": "Reference represents a Git reference", "type": "object", - "title": "Reference represents a Git reference.", "properties": { "object": { "$ref": "#/definitions/GitObject" @@ -29281,8 +29281,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "RegisterRunnerOptions": { + "description": "RegisterRunnerOptions declares the accepted options for registering runners", "type": "object", - "title": "RegisterRunnerOptions declares the accepted options for registering runners.", "required": [ "name" ], @@ -29306,8 +29306,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "RegisterRunnerResponse": { + "description": "RegisterRunnerResponse contains the details of the just registered runner", "type": "object", - "title": "RegisterRunnerResponse contains the details of the just registered runner.", "properties": { "id": { "type": "integer", @@ -29484,8 +29484,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "RepoCommit": { + "description": "RepoCommit contains information of a commit in the context of a repository", "type": "object", - "title": "RepoCommit contains information of a commit in the context of a repository.", "properties": { "author": { "$ref": "#/definitions/CommitUser" @@ -30525,8 +30525,8 @@ "x-go-package": "forgejo.org/modules/structs" }, "UpdateVariableOption": { + "description": "UpdateVariableOption defines the properties of the variable to update", "type": "object", - "title": "UpdateVariableOption defines the properties of the variable to update.", "required": [ "value" ], @@ -32491,4 +32491,4 @@ "TOTPHeader": [] } ] -} +} \ No newline at end of file