From f39bf3ba5b6325898968533e79fdfc5fe74c3810 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) --- 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 c5565d058f..a960d169f8 100644 --- a/Makefile +++ b/Makefile @@ -150,6 +150,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 @@ -338,6 +339,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 e2324f9b5b..355169f007 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 456e80893a..36615d4799 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"