Skip to content

fix: return 201 Created for CreateVariable API responses #34517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 26, 2025

Conversation

appleboy
Copy link
Member

@appleboy appleboy commented May 22, 2025

  • Change CreateVariable API response status from 204 No Content to 201 Created
  • Update related integration tests to expect 201 Created instead of 204 No Content

⚠️ BREAKING ⚠️

Change the response status code of the Create Variable API under both Org and Repo levels to 201 instead of 204.

API SDK: https://gitea.com/gitea/go-sdk/pulls/713

- Change CreateVariable API response status from 204 No Content to 201 Created
- Update related integration tests to expect 201 Created instead of 204 No Content

Signed-off-by: Bo-Yi Wu <[email protected]>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 22, 2025
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels May 22, 2025
appleboy added 2 commits May 22, 2025 09:24
- Change API response status for variable creation from 204 No Content to 201 Created
- Update integration tests to expect 201 Created status after creating variables

Signed-off-by: Bo-Yi Wu <[email protected]>
- Change response status code from 204 No Content to 201 Created when creating a variable

Signed-off-by: Bo-Yi Wu <[email protected]>
@lunny
Copy link
Member

lunny commented May 22, 2025

swagger documentation need to be updated.

@lunny lunny added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label May 22, 2025
@lunny lunny added this to the 1.25.0 milestone May 22, 2025
- 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]>
@appleboy
Copy link
Member Author

@lunny Done in 104b736

@silverwind
Copy link
Member

silverwind commented May 22, 2025

Changing 2xx to 2xx and 4xx to 4xx is probably a low-impact change, but could you add a note regarding the 4xx change to OP message and some textual justifications? Also please follow template from https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#how-to-handle-breaking-prs.

@lunny
Copy link
Member

lunny commented May 22, 2025

LGTM except #34517 (comment)

appleboy and others added 4 commits May 25, 2025 20:31
- Document error response for HTTP 500 when creating org and repo variables
- Update Swagger to add HTTP 500 error response for variable creation endpoints
- Clarify success descriptions for org-level and user-level variable creation in Swagger

Signed-off-by: appleboy <[email protected]>
@appleboy
Copy link
Member Author

@silverwind Updated the PR description.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 25, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 26, 2025
@techknowlogick techknowlogick merged commit 11ee7ff into go-gitea:main May 26, 2025
26 checks passed
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 27, 2025
* giteaofficial/main:
  Split GetLatestCommitStatus as two functions (go-gitea#34535)
  Don't display error log when .git-blame-ignore-revs doesn't exist (go-gitea#34457)
  Add sort option recentclose for issues and pulls (go-gitea#34525)
  fix: return 201 Created for CreateVariable API responses (go-gitea#34517)
  Actions list (go-gitea#34530)
@appleboy appleboy deleted the http branch May 31, 2025 06:17
hantang pushed a commit to qundao/mirror-forgejo that referenced this pull request Jun 17, 2025
## Checklist

- [x] go to the last cherry-pick PR (forgejo/forgejo#7965) to figure out how far it went: [gitea@9d4ebc1f2c](go-gitea/gitea@9d4ebc1)
- [x] cherry-pick and open PR (forgejo/forgejo#8040)
- [ ] have the PR pass the CI
- end-to-end (specially important if there are actions related changes)
  - [ ] add `run-end-to-end` label
  - [ ] check the result
- [ ] write release notes
- [ ] assign reviewers
- [ ] 48h later, last call
- merge 1 hour after the last call

## Legend

- ❓ - No decision about the commit has been made.
- 🍒 - The commit has been cherry picked.
- ⏩ - The commit has been skipped.
- 💡 - The commit has been skipped, but should be ported to Forgejo.
- ✍️ - The commit has been skipped, and a port to Forgejo already exists.

## Commits

- 🍒 [`gitea`](go-gitea/gitea@50d9565) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/c3e6eab73235ac189ca3a36ce2b8ea8d8ad82c81) Add sort option recentclose for issues and pulls ([gitea#34525](go-gitea/gitea#34525))

## TODO

- 💡 [`gitea`](go-gitea/gitea@d5bbaee) Retain issue sort type when a keyword search is introduced ([gitea#34559](go-gitea/gitea#34559))
  UI: Small bat might be nice. Test needed? Do we've frontend tests covering the search?
------
- 💡 [`gitea`](go-gitea/gitea@82ea238) Always use an empty line to separate the commit message and trailer ([gitea#34512](go-gitea/gitea#34512))
  Needs merge
------
- 💡 [`gitea`](go-gitea/gitea@74858dc) Fix line-button issue after file selection in file tree ([gitea#34574](go-gitea/gitea#34574))
  Frontend: Makes it sense to pick/port ui logic in *.ts files?
------
- 💡 [`gitea`](go-gitea/gitea@7149c9c) Fix doctor deleting orphaned issues attachments ([gitea#34142](go-gitea/gitea#34142))
  Doctor: seems useful.
------
- 💡 [`gitea`](go-gitea/gitea@0cec4b8) Fix actions skipped commit status indicator ([gitea#34507](go-gitea/gitea#34507))
  Actions: Might benefit from additional tests.
------
- 💡 [`gitea`](go-gitea/gitea@4cb0c64) Add "View workflow file" to Actions list page ([gitea#34538](go-gitea/gitea#34538))
  Actions: Needs tests
------
- 💡 [`gitea`](go-gitea/gitea@b0936f4) Do not mutate incoming options to RenderUserSearch and SearchUsers ([gitea#34544](go-gitea/gitea#34544))
  Nice refactoring but needs manual merge.
------
- 💡 [`gitea`](go-gitea/gitea@498088c) Add webhook assigning test and fix possible bug ([gitea#34420](go-gitea/gitea#34420))
  Integrationtest has conflicts needs merge.
------
- 💡 [`gitea`](go-gitea/gitea@24a5105) Fix possible nil description of pull request when migrating from CodeCommit ([gitea#34541](go-gitea/gitea#34541))
  Is this relevant to forgejo? Did not find the place to apply this small change.
------
- 💡 [`gitea`](go-gitea/gitea@688da55) Split GetLatestCommitStatus as two functions ([gitea#34535](go-gitea/gitea#34535))
  Merge required.
------
- 💡 [`gitea`](go-gitea/gitea@ab96912) Don't display error log when .git-blame-ignore-revs doesn't exist ([gitea#34457](go-gitea/gitea#34457))
  Unsure wheter this affects forgejo. Tests missing.
------
- 💡 [`gitea`](go-gitea/gitea@11ee7ff) fix: return 201 Created for CreateVariable API responses ([gitea#34517](go-gitea/gitea#34517))
  Actions: This is marked as breaking the api. Pls think about whether this breaking change iss needed & how this impact api-version-increase.
  The corresponding clinet change can be found here: https://gitea.com/gitea/go-sdk/pulls/713/files
------
- 💡 [`gitea`](go-gitea/gitea@9b295e9) Actions list ([gitea#34530](go-gitea/gitea#34530))
  Actions: Regression from go-gitea/gitea#34337 Part of https://codeberg.org/forgejo/forgejo/pulls/7909
------

## Skipped

- ⏩ [`gitea`](go-gitea/gitea@bb6377d) [skip ci] Updated translations via Crowdin
------
- ⏩ [`gitea`](go-gitea/gitea@07d802a) [skip ci] Updated translations via Crowdin
------
- ⏩ [`gitea`](go-gitea/gitea@c6e2093) Clean up "file-view" related styles ([gitea#34558](go-gitea/gitea#34558))

  - gitea ui specific specific
------
- ⏩ [`gitea`](go-gitea/gitea@9f10885) Refactor commit reader ([gitea#34542](go-gitea/gitea#34542))

  - gitea refactor specific
------

<details>
<summary><h2>Stats</h2></summary>

<br>

Between [`gitea@9d4ebc1f2c`](go-gitea/gitea@9d4ebc1) and [`gitea@d5bbaee64e`](go-gitea/gitea@d5bbaee), **18** commits have been reviewed. We picked **1**, skipped **4**, and decided to port **13**.

</details>

Co-authored-by: Markus Amshove <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8040
Reviewed-by: Earl Warren <[email protected]>
Co-authored-by: Michael Jerger <[email protected]>
Co-committed-by: Michael Jerger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants