From f7f813ab84866b41d02ac1c68dfe5fbf0cc79489 Mon Sep 17 00:00:00 2001 From: Gusted Date: Mon, 9 Jan 2023 22:28:04 +0100 Subject: [PATCH] [BRANDING] Replace branding in Swagger - "Gitea" is automatically being determined in Swagger and cannot be overridden, therefor we override it after `swagger generate spec` is run. - Resolves https://codeberg.org/forgejo/forgejo/issues/226 (cherry picked from commit 0b453807656b6fbe54284d865e59880460f3d253) [BRANDING] Change Swagger title to Forgejo API (cherry picked from commit 79f6a70b53421be9984a9ad96ebd0d06ab5af02e) (cherry picked from commit 6cd47afe3366a615d40655a435275d5543910065) (cherry picked from commit a7ae2e4c09431cd7a1f18c5b87b9dd87981b538d) (cherry picked from commit 59f837e4661233dafc202ded9ad907dbdf7e3e69) (cherry picked from commit c1c3d1f0e63b880baa32d285d3eba6034137b45a) (cherry picked from commit 4b088713fb0a55c2c37f734ce82f13190ca412dd) (cherry picked from commit 3df1d2137112a95279a8c84a8601e4c137d75d4f) (cherry picked from commit a4a5fdbde4f9ebbf5ba6ba66c8f20a89e54860de) (cherry picked from commit 57aa9ed710a95aa51ae3824873c3766b38da7850) (cherry picked from commit 948b49bf9449af744a1f2e1324187897ed1c0809) (cherry picked from commit be4929ab6a802d7d748f537ab8b798e30588c1d4) (cherry picked from commit 9ecb507457d8a6aa60713762a1a5d2995ed986e5) Conflicts: templates/swagger/ui.tmpl (cherry picked from commit 8e57e688637b9fbd3c33d3e38aed8768a2c07208) (cherry picked from commit f0b3f621e34130c75b35c113ad509ab73118e123) (cherry picked from commit 5b0a6d093ea5210a5ba27705b1d1636e23da8738) (cherry picked from commit 2e0f6b5de8837a439ecadaf3434d006d7014016c) (cherry picked from commit bb08076f5c26481d78855823c2daa1a76d3865fb) (cherry picked from commit 5c9360e38a41a4494b1b1b247f9d57b1a0d91ef0) (cherry picked from commit 2f277561489e1228af163fa4e5d153ceb7eec864) (cherry picked from commit 6fce7eeb511d949249e045a995cc637d3788a1f0) (cherry picked from commit 8d27e7bebd961468bd492c4d64e132a46d97f62b) (cherry picked from commit fda2ee2aaedac8f394d9fc38085f768c775d2c38) (cherry picked from commit fe0489a4d856655fdcf93c16a41995709c47f78f) (cherry picked from commit fe9479b357d2ef0f5fd8247e8356ce7c75135b88) (cherry picked from commit 1deadb2f35c8c0c87cd93b6f04675312b1e667bb) (cherry picked from commit d1cb84b2f225c484755172735841e3b75abce409) (cherry picked from commit 9de15d49f8ff0ef0803e8b3a7437a45358e924b9) (cherry picked from commit 461fbe219c30de7e756ce2cb6dbc354417655a6f) (cherry picked from commit f39bf3ba5b6325898968533e79fdfc5fe74c3810) (cherry picked from commit b3f31c2f7bc5b4f5ed3f7fb6e6a6649331eb179a) (cherry picked from commit b9f493c139bc40bb5aaf361b813019968be75968) (cherry picked from commit 83781b16411d49f2f27b622ac3e806234b477984) (cherry picked from commit 4438ee0434f88fc0dcb917304a5baf5b8c2d11a8) (cherry picked from commit 56b6b368334fe3d11fb55b8e35bbfc314f45405a) (cherry picked from commit dde88ed2fda2403159e78f174357c5e993bce1de) (cherry picked from commit 96bb13ce5428dd88866c92cd4d9b4e216d7e544f) (cherry picked from commit aacc824826922e1a17be556dfbaf36667950a5aa) (cherry picked from commit 0db579b0b365e832b4722fb1a70906c77d384afc) (cherry picked from commit c1fd3777defb547c1aef01b95d7a0feba2258ad9) Conflicts: templates/swagger/v1_json.tmpl https://codeberg.org/forgejo/forgejo/pulls/1832 (cherry picked from commit 5c8a6e1ca883cc0ac65b25ff4fde2e5d52b274f4) (cherry picked from commit ff145b32c729ace3ed11bfbb5a7f1aba5454e999) (cherry picked from commit db9b904b84158c27b1c6004b9ca7f1f7f89066c7) (cherry picked from commit a79e2b2b560851c895c776e737bcf44336e0b31d) (cherry picked from commit a5830247dfece7ee3609bfe89050743d175d924e) (cherry picked from commit 9120bc461727f35062bd2bc8129f422f7e435a0f) (cherry picked from commit cd873945b26ed3008b75de52c8a829880d684126) (cherry picked from commit 6a48e3ea5be6cf818dbccd36611ec07406d6bd35) (cherry picked from commit 489c1ac8fbd87e3f23d91b829728f77e6aafe57c) (cherry picked from commit a1f7fd771eda03c8009f2844f35ea1fdcc4fd158) --- Makefile | 2 ++ templates/swagger/ui.tmpl | 2 +- templates/swagger/v1_json.tmpl | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0e0b389a11..c4de2d2bf6 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,7 @@ SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl \| JSEs SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|"basePath": "/api/v1"|g SWAGGER_EXCLUDE := code.gitea.io/sdk SWAGGER_NEWLINE_COMMAND := -e '$$a\' +SWAGGER_SPEC_BRANDING := s|Gitea API|Forgejo API|g TEST_MYSQL_HOST ?= mysql:3306 TEST_MYSQL_DBNAME ?= testgitea @@ -343,6 +344,7 @@ $(SWAGGER_SPEC): $(GO_SOURCES_NO_BINDATA) $(GO) run $(SWAGGER_PACKAGE) generate spec -x "$(SWAGGER_EXCLUDE)" -o './$(SWAGGER_SPEC)' $(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)' $(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)' + $(SED_INPLACE) '$(SWAGGER_SPEC_BRANDING)' './$(SWAGGER_SPEC)' .PHONY: swagger-check swagger-check: generate-swagger diff --git a/templates/swagger/ui.tmpl b/templates/swagger/ui.tmpl index 9935ab9c5a..bcdc96c54f 100644 --- a/templates/swagger/ui.tmpl +++ b/templates/swagger/ui.tmpl @@ -1,7 +1,7 @@ - Gitea API + Forgejo API diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 1b56e84766..aa05d72247 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -13,8 +13,8 @@ ], "swagger": "2.0", "info": { - "description": "This documentation describes the Gitea API.", - "title": "Gitea API", + "description": "This documentation describes the Forgejo API.", + "title": "Forgejo API", "license": { "name": "MIT", "url": "http://opensource.org/licenses/MIT"