From f05b960494cdf434de7338dc3c831cfc8d45cea6 Mon Sep 17 00:00:00 2001 From: Sven Steinbauer Date: Fri, 21 Feb 2025 14:09:21 +0000 Subject: [PATCH] Fix invalid swagger syntax of $ref with sibling (#7019) Ticket #5676 states that the output from `make generate-swagger` is not valid according to the current [OpenAPI specification](https://swagger.io/specification/#path-item-object). In future this [may change](https://swagger.io/specification/#reference-object) but currently this has the effect that the `description` field will be ignored. Removing the description from the type definition of the offending entry will fix the invalid output and have the same end result as before, as the description would have been ignored anyway. ## Checklist ### Tests No changes to Go (except removal of comment) or Javascript code. Have added the `lint-swagger` task to the CI test run however. ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/.md` to be be used for the release notes instead of the title. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7019 Reviewed-by: Earl Warren Co-authored-by: Sven Steinbauer Co-committed-by: Sven Steinbauer --- .forgejo/workflows/testing.yml | 2 +- modules/structs/pull_review.go | 1 - templates/swagger/v1_json.tmpl | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.forgejo/workflows/testing.yml b/.forgejo/workflows/testing.yml index 784bc45736..2e97b90c70 100644 --- a/.forgejo/workflows/testing.yml +++ b/.forgejo/workflows/testing.yml @@ -24,7 +24,7 @@ jobs: - uses: https://data.forgejo.org/actions/checkout@v4 - uses: ./.forgejo/workflows-composite/setup-env - run: su forgejo -c 'make deps-backend deps-tools' - - run: su forgejo -c 'make --always-make -j$(nproc) lint-backend tidy-check swagger-check fmt-check swagger-validate' # ensure the "go-licenses" make target runs + - run: su forgejo -c 'make --always-make -j$(nproc) lint-backend tidy-check swagger-check lint-swagger fmt-check swagger-validate' # ensure the "go-licenses" make target runs - uses: ./.forgejo/workflows-composite/build-backend frontend-checks: if: vars.ROLE == 'forgejo-coding' || vars.ROLE == 'forgejo-testing' diff --git a/modules/structs/pull_review.go b/modules/structs/pull_review.go index c77ebea07d..f89c1f2a63 100644 --- a/modules/structs/pull_review.go +++ b/modules/structs/pull_review.go @@ -89,7 +89,6 @@ type CreatePullReviewComment struct { NewLineNum int64 `json:"new_position"` } -// CreatePullReviewCommentOptions are options to create a pull review comment type CreatePullReviewCommentOptions CreatePullReviewComment // SubmitPullReviewOptions are options to submit a pending pull review diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index cfe6ae7656..037ee48b8c 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -22411,7 +22411,6 @@ "x-go-package": "code.gitea.io/gitea/modules/structs" }, "CreatePullReviewCommentOptions": { - "description": "CreatePullReviewCommentOptions are options to create a pull review comment", "$ref": "#/definitions/CreatePullReviewComment" }, "CreatePullReviewOptions": {