Skip to content

Commit 20c3dc3

Browse files
authored
docs: update funcs documentation with go 1.19 doc standards (#499)
1 parent 11fe175 commit 20c3dc3

File tree

12 files changed

+143
-8
lines changed

12 files changed

+143
-8
lines changed

.golangci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@ linters:
3030
enable:
3131
- gocyclo
3232
- godot
33-
# Disabled as the latest version - 0.4.0 from 2022-09-27 is not built with go 1.19 and
34-
# therefore disagrees with swag fmt about the formatting of the swagger comments.
35-
# See https://github.com/mvdan/gofumpt/issues/254
36-
# - gofumpt
37-
38-
# Disabled since goimports reformats correct 1.19 doc comments
39-
# - goimports
33+
- gofumpt
34+
- goimports
4035
- govet
4136
- revive
4237
- whitespace
@@ -50,4 +45,4 @@ linters-settings:
5045

5146
godot:
5247
exclude:
53-
- "^ @[A-Za-z]+ "
48+
- "^\t+@[A-Za-z]+\t+"

pkg/controllers/account.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func (co Controller) RegisterAccountRoutes(r *gin.RouterGroup) {
7171
}
7272
}
7373

74+
// OptionsAccountList returns the allowed HTTP verbs
75+
//
7476
// @Summary Allowed HTTP verbs
7577
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
7678
// @Tags Accounts
@@ -82,6 +84,8 @@ func (co Controller) OptionsAccountList(c *gin.Context) {
8284
httputil.OptionsGetPost(c)
8385
}
8486

87+
// OptionsAccountDetail returns the allowed HTTP verbs
88+
//
8589
// @Summary Allowed HTTP verbs
8690
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
8791
// @Tags Accounts
@@ -104,6 +108,8 @@ func (co Controller) OptionsAccountDetail(c *gin.Context) {
104108
httputil.OptionsGetPatchDelete(c)
105109
}
106110

111+
// CreateAccount creates a new account
112+
//
107113
// @Summary Create account
108114
// @Description Creates a new account
109115
// @Tags Accounts
@@ -135,6 +141,8 @@ func (co Controller) CreateAccount(c *gin.Context) {
135141
c.JSON(http.StatusCreated, AccountResponse{Data: accountObject})
136142
}
137143

144+
// GetAccounts returns a list of all accounts matching the filter parameters
145+
//
138146
// @Summary List accounts
139147
// @Description Returns a list of accounts
140148
// @Tags Accounts
@@ -185,6 +193,8 @@ func (co Controller) GetAccounts(c *gin.Context) {
185193
c.JSON(http.StatusOK, AccountListResponse{Data: accountObjects})
186194
}
187195

196+
// GetAccount returns data for a specific account
197+
//
188198
// @Summary Get account
189199
// @Description Returns a specific account
190200
// @Tags Accounts
@@ -210,6 +220,8 @@ func (co Controller) GetAccount(c *gin.Context) {
210220
c.JSON(http.StatusOK, AccountResponse{Data: accountObject})
211221
}
212222

223+
// UpdateAccount updates data for a specific account
224+
//
213225
// @Summary Update account
214226
// @Description Updates an account. Only values to be updated need to be specified.
215227
// @Tags Accounts
@@ -251,6 +263,8 @@ func (co Controller) UpdateAccount(c *gin.Context) {
251263
c.JSON(http.StatusOK, AccountResponse{Data: accountObject})
252264
}
253265

266+
// DeleteAccount deletes an account
267+
//
254268
// @Summary Delete account
255269
// @Description Deletes an account
256270
// @Tags Accounts

pkg/controllers/allocation.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func (co Controller) RegisterAllocationRoutes(r *gin.RouterGroup) {
6969
}
7070
}
7171

72+
// OptionsAllocationList returns the allowed HTTP verbs
73+
//
7274
// @Summary Allowed HTTP verbs
7375
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
7476
// @Tags Allocations
@@ -78,6 +80,8 @@ func (co Controller) OptionsAllocationList(c *gin.Context) {
7880
httputil.OptionsGetPost(c)
7981
}
8082

83+
// OptionsAllocationDetail returns the allowed HTTP verbs
84+
//
8185
// @Summary Allowed HTTP verbs
8286
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
8387
// @Tags Allocations
@@ -98,6 +102,8 @@ func (co Controller) OptionsAllocationDetail(c *gin.Context) {
98102
httputil.OptionsGetPatchDelete(c)
99103
}
100104

105+
// CreateAllocation creates a new allocation
106+
//
101107
// @Summary Create allocations
102108
// @Description Create a new allocation of funds to an envelope for a specific month
103109
// @Tags Allocations
@@ -132,6 +138,8 @@ func (co Controller) CreateAllocation(c *gin.Context) {
132138
c.JSON(http.StatusCreated, AllocationResponse{Data: allocationObject})
133139
}
134140

141+
// GetAllocations returns a list of allocations matching the search parameters
142+
//
135143
// @Summary Get allocations
136144
// @Description Returns a list of allocations
137145
// @Tags Allocations
@@ -180,6 +188,8 @@ func (co Controller) GetAllocations(c *gin.Context) {
180188
c.JSON(http.StatusOK, AllocationListResponse{Data: allocationObjects})
181189
}
182190

191+
// GetAllocation returns data about a specific allocation
192+
//
183193
// @Summary Get allocation
184194
// @Description Returns a specific allocation
185195
// @Tags Allocations
@@ -205,6 +215,8 @@ func (co Controller) GetAllocation(c *gin.Context) {
205215
c.JSON(http.StatusOK, AllocationResponse{Data: allocationObject})
206216
}
207217

218+
// UpdateAllocation updates allocation data
219+
//
208220
// @Summary Update allocation
209221
// @Description Update an allocation. Only values to be updated need to be specified.
210222
// @Tags Allocations
@@ -250,6 +262,8 @@ func (co Controller) UpdateAllocation(c *gin.Context) {
250262
c.JSON(http.StatusOK, AllocationResponse{Data: allocationObject})
251263
}
252264

265+
// DeleteAllocation deletes an allocation
266+
//
253267
// @Summary Delete allocation
254268
// @Description Deletes an allocation
255269
// @Tags Allocations

pkg/controllers/budget.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ func (co Controller) RegisterBudgetRoutes(r *gin.RouterGroup) {
8383
}
8484
}
8585

86+
// OptionsBudgetList returns the allowed HTTP methods
87+
//
8688
// @Summary Allowed HTTP verbs
8789
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
8890
// @Tags Budgets
@@ -93,6 +95,8 @@ func (co Controller) OptionsBudgetList(c *gin.Context) {
9395
httputil.OptionsGetPost(c)
9496
}
9597

98+
// OptionsBudgetDetail returns the allowed HTTP methods
99+
//
96100
// @Summary Allowed HTTP verbs
97101
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
98102
// @Tags Budgets
@@ -116,6 +120,8 @@ func (co Controller) OptionsBudgetDetail(c *gin.Context) {
116120
httputil.OptionsGetPatchDelete(c)
117121
}
118122

123+
// OptionsBudgetMonth returns the allowed HTTP methods
124+
//
119125
// @Summary Allowed HTTP verbs
120126
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**
121127
// @Tags Budgets
@@ -147,6 +153,8 @@ func (co Controller) OptionsBudgetMonth(c *gin.Context) {
147153
httputil.OptionsGet(c)
148154
}
149155

156+
// OptionsBudgetMonthAllocations returns the allowed HTTP methods
157+
//
150158
// @Summary Allowed HTTP verbs
151159
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**
152160
// @Tags Budgets
@@ -179,6 +187,8 @@ func (co Controller) OptionsBudgetMonthAllocations(c *gin.Context) {
179187
httputil.OptionsDelete(c)
180188
}
181189

190+
// CreateBudget creates a new budget
191+
//
182192
// @Summary Create budget
183193
// @Description Creates a new budget
184194
// @Tags Budgets
@@ -208,6 +218,8 @@ func (co Controller) CreateBudget(c *gin.Context) {
208218
c.JSON(http.StatusCreated, BudgetResponse{Data: budgetObject})
209219
}
210220

221+
// GetBudgets returns data for all budgets filtered by the query parameters
222+
//
211223
// @Summary List budgets
212224
// @Description Returns a list of budgets
213225
// @Tags Budgets
@@ -252,6 +264,8 @@ func (co Controller) GetBudgets(c *gin.Context) {
252264
c.JSON(http.StatusOK, BudgetListResponse{Data: budgetObjects})
253265
}
254266

267+
// GetBudget returns data for a single budget
268+
//
255269
// @Summary Get budget
256270
// @Description Returns a specific budget
257271
// @Tags Budgets
@@ -277,6 +291,8 @@ func (co Controller) GetBudget(c *gin.Context) {
277291
c.JSON(http.StatusOK, BudgetResponse{Data: budgetObject})
278292
}
279293

294+
// GetBudgetMonth returns data for a month for a specific budget
295+
//
280296
// @Summary Get Budget month data
281297
// @Description Returns data about a budget for a for a specific month. **Use GET /month endpoint with month and budgetId query parameters instead.**
282298
// @Tags Budgets
@@ -391,6 +407,8 @@ func (co Controller) GetBudgetMonth(c *gin.Context) {
391407
}})
392408
}
393409

410+
// UpdateBudget updates data for a budget
411+
//
394412
// @Summary Update budget
395413
// @Description Update an existing budget. Only values to be updated need to be specified.
396414
// @Tags Budgets
@@ -437,6 +455,8 @@ func (co Controller) UpdateBudget(c *gin.Context) {
437455
c.JSON(http.StatusOK, BudgetResponse{Data: budgetObject})
438456
}
439457

458+
// Do stuff
459+
//
440460
// @Summary Delete budget
441461
// @Description Deletes a budget
442462
// @Tags Budgets
@@ -465,6 +485,8 @@ func (co Controller) DeleteBudget(c *gin.Context) {
465485
c.JSON(http.StatusNoContent, gin.H{})
466486
}
467487

488+
// DeleteAllocationsMonth deletes all allocations for a specific month
489+
//
468490
// @Summary Delete allocations for a month
469491
// @Description Deletes all allocation for the specified month. **Use DELETE /month endpoint with month and budgetId query parameters instead.**
470492
// @Tags Budgets
@@ -520,6 +542,8 @@ func (co Controller) DeleteAllocationsMonth(c *gin.Context) {
520542
c.JSON(http.StatusNoContent, gin.H{})
521543
}
522544

545+
// SetAllocationsMonth sets all allocations for a specific month
546+
//
523547
// @Summary Set allocations for a month
524548
// @Description Sets allocations for a month for all envelopes that do not have an allocation yet. **Use POST /month endpoint with month and budgetId query parameters instead.**
525549
// @Tags Budgets

pkg/controllers/category.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ func (co Controller) RegisterCategoryRoutes(r *gin.RouterGroup) {
6868
}
6969
}
7070

71+
// OptionsCategoryList returns the allowed HTTP methods
72+
//
7173
// @Summary Allowed HTTP verbs
7274
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
7375
// @Tags Categories
@@ -79,6 +81,8 @@ func (co Controller) OptionsCategoryList(c *gin.Context) {
7981
httputil.OptionsGetPost(c)
8082
}
8183

84+
// OptionsCategoryDetail returns the allowed HTTP methods
85+
//
8286
// @Summary Allowed HTTP verbs
8387
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
8488
// @Tags Categories
@@ -101,6 +105,8 @@ func (co Controller) OptionsCategoryDetail(c *gin.Context) {
101105
httputil.OptionsGetPatchDelete(c)
102106
}
103107

108+
// CreateCategory creates a new category
109+
//
104110
// @Summary Create category
105111
// @Description Creates a new category
106112
// @Tags Categories
@@ -132,6 +138,8 @@ func (co Controller) CreateCategory(c *gin.Context) {
132138
c.JSON(http.StatusCreated, CategoryResponse{Data: categoryObject})
133139
}
134140

141+
// GetCategories returns a list of categories filtered by the query parameters
142+
//
135143
// @Summary Get categories
136144
// @Description Returns a list of categories
137145
// @Tags Categories
@@ -179,6 +187,8 @@ func (co Controller) GetCategories(c *gin.Context) {
179187
c.JSON(http.StatusOK, CategoryListResponse{Data: categoryObjects})
180188
}
181189

190+
// GetCategory returns data for a specific category
191+
//
182192
// @Summary Get category
183193
// @Description Returns a specific category
184194
// @Tags Categories
@@ -204,6 +214,8 @@ func (co Controller) GetCategory(c *gin.Context) {
204214
c.JSON(http.StatusOK, CategoryResponse{Data: categoryObject})
205215
}
206216

217+
// UpdateCategory updates data for a specific category
218+
//
207219
// @Summary Update category
208220
// @Description Update an existing category. Only values to be updated need to be specified.
209221
// @Tags Categories
@@ -246,6 +258,8 @@ func (co Controller) UpdateCategory(c *gin.Context) {
246258
c.JSON(http.StatusOK, CategoryResponse{Data: categoryObject})
247259
}
248260

261+
// DeleteCategory deletes a specific category
262+
//
249263
// @Summary Delete category
250264
// @Description Deletes a category
251265
// @Tags Categories

pkg/controllers/cleanup.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"github.com/gin-gonic/gin"
99
)
1010

11+
// DeleteAll permanently deletes all resources in the database
12+
//
1113
// @Summary Delete everything
1214
// @Description Permanently deletes all resources
1315
// @Tags v1

pkg/controllers/envelope.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func (co Controller) RegisterEnvelopeRoutes(r *gin.RouterGroup) {
7474
}
7575
}
7676

77+
// OptionsEnvelopeList returns the allowed HTTP methods
78+
//
7779
// @Summary Allowed HTTP verbs
7880
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
7981
// @Tags Envelopes
@@ -83,6 +85,8 @@ func (co Controller) OptionsEnvelopeList(c *gin.Context) {
8385
httputil.OptionsGetPost(c)
8486
}
8587

88+
// OptionsEnvelopeDetail returns the allowed HTTP methods
89+
//
8690
// @Summary Allowed HTTP verbs
8791
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
8892
// @Tags Envelopes
@@ -104,6 +108,8 @@ func (co Controller) OptionsEnvelopeDetail(c *gin.Context) {
104108
httputil.OptionsGetPatchDelete(c)
105109
}
106110

111+
// CreateEnvelope creates a new envelope
112+
//
107113
// @Summary Create envelope
108114
// @Description Creates a new envelope
109115
// @Tags Envelopes
@@ -135,6 +141,8 @@ func (co Controller) CreateEnvelope(c *gin.Context) {
135141
c.JSON(http.StatusCreated, EnvelopeResponse{Data: envelopeObject})
136142
}
137143

144+
// GetEnvelopes returns a list of envelopes filtered by the query parameters
145+
//
138146
// @Summary Get envelopes
139147
// @Description Returns a list of envelopes
140148
// @Tags Envelopes
@@ -181,6 +189,8 @@ func (co Controller) GetEnvelopes(c *gin.Context) {
181189
c.JSON(http.StatusOK, EnvelopeListResponse{Data: envelopeObjects})
182190
}
183191

192+
// GetEnvelope returns data about a specific envelope
193+
//
184194
// @Summary Get envelope
185195
// @Description Returns a specific envelope
186196
// @Tags Envelopes
@@ -206,6 +216,8 @@ func (co Controller) GetEnvelope(c *gin.Context) {
206216
c.JSON(http.StatusOK, EnvelopeResponse{Data: envelopeObject})
207217
}
208218

219+
// GetEnvelopeMonth returns month data for a specific envelope
220+
//
209221
// @Summary Get Envelope month data
210222
// @Description Returns data about an envelope for a for a specific month. **Use GET /month endpoint with month and budgetId query parameters instead.**
211223
// @Tags Envelopes
@@ -251,6 +263,8 @@ func (co Controller) GetEnvelopeMonth(c *gin.Context) {
251263
c.JSON(http.StatusOK, EnvelopeMonthResponse{Data: envelopeMonth})
252264
}
253265

266+
// UpdateEnvelope updates data for an envelope
267+
//
254268
// @Summary Update envelope
255269
// @Description Updates an existing envelope. Only values to be updated need to be specified.
256270
// @Tags Envelopes
@@ -293,6 +307,8 @@ func (co Controller) UpdateEnvelope(c *gin.Context) {
293307
c.JSON(http.StatusOK, EnvelopeResponse{Data: envelopeObject})
294308
}
295309

310+
// DeleteEnvelope deletes an envelope
311+
//
296312
// @Summary Delete envelope
297313
// @Description Deletes an envelope
298314
// @Tags Envelopes

0 commit comments

Comments
 (0)