From 3a66c1df18b506f7bbca8195315ff571688e424a 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 --- Makefile | 2 ++ templates/swagger/v1_json.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b55fbae939..8dc9cd737e 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,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 @@ -305,6 +306,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/v1_json.tmpl b/templates/swagger/v1_json.tmpl index cd64b7070f..ab58db3549 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"