Skip to content

Commit 104b736

Browse files
committed
fix: refine variable creation API responses and documentation
- Update variable creation responses to use repo-level terminology instead of org-level or generic descriptions - Replace 404 not found responses with 409 conflict responses when a variable name already exists - Remove redundant or outdated 204 response descriptions for variable creation endpoints Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 5d9703d commit 104b736

File tree

4 files changed

+16
-31
lines changed

4 files changed

+16
-31
lines changed

routers/api/v1/org/action.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,11 @@ func (Action) CreateVariable(ctx *context.APIContext) {
384384
// "$ref": "#/definitions/CreateVariableOption"
385385
// responses:
386386
// "201":
387-
// description: response when creating an org-level variable
388-
// "204":
389-
// description: response when creating an org-level variable
387+
// description: response when creating a repo-level variable
390388
// "400":
391389
// "$ref": "#/responses/error"
392-
// "404":
393-
// "$ref": "#/responses/notFound"
390+
// "409":
391+
// description: variable name already exists.
394392

395393
opt := web.GetForm(ctx).(*api.CreateVariableOption)
396394

routers/api/v1/repo/action.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,10 @@ func (Action) CreateVariable(ctx *context.APIContext) {
339339
// responses:
340340
// "201":
341341
// description: response when creating a repo-level variable
342-
// "204":
343-
// description: response when creating a repo-level variable
344342
// "400":
345343
// "$ref": "#/responses/error"
346-
// "404":
347-
// "$ref": "#/responses/notFound"
344+
// "409":
345+
// description: variable name already exists.
348346

349347
opt := web.GetForm(ctx).(*api.CreateVariableOption)
350348

routers/api/v1/user/action.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,11 @@ func CreateVariable(ctx *context.APIContext) {
127127
// "$ref": "#/definitions/CreateVariableOption"
128128
// responses:
129129
// "201":
130-
// description: response when creating a variable
131-
// "204":
132-
// description: response when creating a variable
130+
// description: response when creating a repo-level variable
133131
// "400":
134132
// "$ref": "#/responses/error"
135-
// "404":
136-
// "$ref": "#/responses/notFound"
133+
// "409":
134+
// description: variable name already exists.
137135

138136
opt := web.GetForm(ctx).(*api.CreateVariableOption)
139137

templates/swagger/v1_json.tmpl

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

0 commit comments

Comments
 (0)