From dbdd396315da9b7809f20a0370a41faf71927466 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 9fefe3dc6aa8bba1b6f9f609b42cb58c2109c4f8) (cherry picked from commit 1e88465eeda4d1696e79302a23b28cebf2b4a350) (cherry picked from commit 5ba2f6e3a1fb13fe141e15f2fa28f916aba566a1) --- 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 048973c352..081f46a871 100644 --- a/Makefile +++ b/Makefile @@ -159,6 +159,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 @@ -333,6 +334,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 57b560bc15..56346e8fec 100644 --- a/templates/swagger/ui.tmpl +++ b/templates/swagger/ui.tmpl @@ -2,7 +2,7 @@ - Gitea API + Forgejo API diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index c9bba3ae51..8b282a0a60 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"