From 619b9b5547dab4f30acedbf816550df02bb3c1c5 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Sat, 21 Oct 2017 16:05:50 +0200 Subject: [PATCH] Move swagger-ui under /api/v1 (#2746) * Move swagger interface under /api/v1 * Update swagger-ui * Add /api/swagger and prepare for multiple api version * Update test links * Fix footer link --- Makefile | 4 +- integrations/links_test.go | 6 +- public/vendor/assets/swagger-ui/index.html | 12 +- .../assets/swagger-ui/oauth2-redirect.html | 54 ++--- .../assets/swagger-ui/swagger-ui-bundle.js | 190 ++++++++---------- .../swagger-ui/swagger-ui-bundle.js.map | 2 +- .../swagger-ui-standalone-preset.js | 19 +- .../swagger-ui-standalone-preset.js.map | 2 +- .../vendor/assets/swagger-ui/swagger-ui.css | 2 +- public/vendor/assets/swagger-ui/swagger-ui.js | 21 +- .../assets/swagger-ui/swagger-ui.js.map | 2 +- routers/api/v1/api.go | 3 + routers/api/v1/misc/swagger.go | 19 ++ routers/home.go | 7 - routers/routes/routes.go | 1 - templates/base/footer.tmpl | 2 +- templates/swagger.tmpl | 12 +- 17 files changed, 166 insertions(+), 192 deletions(-) create mode 100644 routers/api/v1/misc/swagger.go diff --git a/Makefile b/Makefile index 146ef6de8..8ac3940b8 100644 --- a/Makefile +++ b/Makefile @@ -304,10 +304,10 @@ generate-stylesheets: .PHONY: swagger-ui swagger-ui: rm -Rf public/vendor/assets/swagger-ui - git clone --depth=10 -b v3.0.7 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui + git clone --depth=10 -b v3.3.2 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui rm -Rf $(TMPDIR)/swagger-ui - $(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../swagger.v1.json;g" public/assets/swagger-ui/index.html + $(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../../swagger.v1.json;g" public/vendor/assets/swagger-ui/index.html .PHONY: update-translations update-translations: diff --git a/integrations/links_test.go b/integrations/links_test.go index d9d647f4b..27e405469 100644 --- a/integrations/links_test.go +++ b/integrations/links_test.go @@ -26,7 +26,8 @@ func TestLinksNoLogin(t *testing.T) { "/user/sign_up", "/user/login", "/user/forgot_password", - "/swagger", + "/api/swagger", + "/api/v1/swagger", // TODO: follow this page and test every link "/vendor/librejs.html", } @@ -47,7 +48,8 @@ func testLinksAsUser(userName string, t *testing.T) { "/explore/organizations?q=test&tab=", "/", "/user/forgot_password", - "/swagger", + "/api/swagger", + "/api/v1/swagger", "/issues", "/issues?type=your_repositories&repo=0&sort=&state=open", "/issues?type=assigned&repo=0&sort=&state=open", diff --git a/public/vendor/assets/swagger-ui/index.html b/public/vendor/assets/swagger-ui/index.html index 75f52a926..9bf4493bb 100644 --- a/public/vendor/assets/swagger-ui/index.html +++ b/public/vendor/assets/swagger-ui/index.html @@ -11,15 +11,15 @@