[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
This commit is contained in:
		
							parent
							
								
									103991d73f
								
							
						
					
					
						commit
						0b45380765
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		
							
								
								
									
										2
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								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_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|"basePath": "/api/v1"|g
 | 
				
			||||||
SWAGGER_EXCLUDE := code.gitea.io/sdk
 | 
					SWAGGER_EXCLUDE := code.gitea.io/sdk
 | 
				
			||||||
SWAGGER_NEWLINE_COMMAND := -e '$$a\'
 | 
					SWAGGER_NEWLINE_COMMAND := -e '$$a\'
 | 
				
			||||||
 | 
					SWAGGER_SPEC_BRANDING := s|Gitea API|Forgejo API|g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_MYSQL_HOST ?= mysql:3306
 | 
					TEST_MYSQL_HOST ?= mysql:3306
 | 
				
			||||||
TEST_MYSQL_DBNAME ?= testgitea
 | 
					TEST_MYSQL_DBNAME ?= testgitea
 | 
				
			||||||
| 
						 | 
					@ -331,6 +332,7 @@ $(SWAGGER_SPEC): $(GO_SOURCES_NO_BINDATA)
 | 
				
			||||||
	$(GO) run $(SWAGGER_PACKAGE) generate spec -x "$(SWAGGER_EXCLUDE)" -o './$(SWAGGER_SPEC)'
 | 
						$(GO) run $(SWAGGER_PACKAGE) generate spec -x "$(SWAGGER_EXCLUDE)" -o './$(SWAGGER_SPEC)'
 | 
				
			||||||
	$(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
 | 
						$(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
 | 
				
			||||||
	$(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)'
 | 
						$(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)'
 | 
				
			||||||
 | 
						$(SED_INPLACE) '$(SWAGGER_SPEC_BRANDING)' './$(SWAGGER_SPEC)'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: swagger-check
 | 
					.PHONY: swagger-check
 | 
				
			||||||
swagger-check: generate-swagger
 | 
					swagger-check: generate-swagger
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,8 +13,8 @@
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "swagger": "2.0",
 | 
					  "swagger": "2.0",
 | 
				
			||||||
  "info": {
 | 
					  "info": {
 | 
				
			||||||
    "description": "This documentation describes the Gitea API.",
 | 
					    "description": "This documentation describes the Forgejo API.",
 | 
				
			||||||
    "title": "Gitea API.",
 | 
					    "title": "Forgejo API.",
 | 
				
			||||||
    "license": {
 | 
					    "license": {
 | 
				
			||||||
      "name": "MIT",
 | 
					      "name": "MIT",
 | 
				
			||||||
      "url": "http://opensource.org/licenses/MIT"
 | 
					      "url": "http://opensource.org/licenses/MIT"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue