From c1d19c1836ba48013a64d5f95d02fd3b29b86e12 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 0a91a055aeb856908eb82865059c8209af5ccf0c) (cherry picked from commit 56b404baa02bb9c53c80218ecc1380054834618a) --- 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 9e91751531..75b4e0a43e 100644 --- a/Makefile +++ b/Makefile @@ -144,6 +144,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 @@ -329,6 +330,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 e78c077fc3..6b1418e7bf 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"