Move SwaggerUI to /api/v3/swagger-ui

Include the `v3` path component in the Swagger UI URL.
This commit is contained in:
Sybren A. Stüvel 2022-07-04 12:17:57 +02:00
parent 5537f2c07c
commit 7d64d1bca4
5 changed files with 7 additions and 5 deletions

@ -105,7 +105,7 @@ project, which is unfortunate. However, this approach does have some advantages:
## Swagger UI
Flamenco Manager has a SwaggerUI interface at http://localhost:8080/api/swagger-ui/
Flamenco Manager has a SwaggerUI interface at http://localhost:8080/api/v3/swagger-ui/
## SocketIO

@ -287,7 +287,7 @@ func buildWebService(
api.RegisterHandlers(e, flamenco)
webUpdater.RegisterHandlers(e)
swagger_ui.RegisterSwaggerUIStaticFiles(e)
e.GET("/api/openapi3.json", func(c echo.Context) error {
e.GET("/api/v3/openapi3.json", func(c echo.Context) error {
return c.JSON(http.StatusOK, swagger)
})

@ -39,7 +39,7 @@
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "/api/openapi3.json",
url: "/api/v3/openapi3.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [

@ -12,6 +12,8 @@ import (
//go:embed static
var swaggerUI embed.FS
const swaggerURL = "/api/v3/swagger-ui/"
func RegisterSwaggerUIStaticFiles(router *echo.Echo) {
files, err := fs.Sub(swaggerUI, "static")
if err != nil {
@ -19,5 +21,5 @@ func RegisterSwaggerUIStaticFiles(router *echo.Echo) {
}
httpHandler := http.FileServer(http.FS(files))
router.GET("/api/swagger-ui/*", echo.WrapHandler(http.StripPrefix("/api/swagger-ui/", httpHandler)))
router.GET(swaggerURL+"*", echo.WrapHandler(http.StripPrefix(swaggerURL, httpHandler)))
}

@ -17,7 +17,7 @@
<api-spinner />
<span class="app-version">
<a href="/flamenco3-addon.zip">addon</a>
| <a href="/api/swagger-ui/">API</a>
| <a href="/api/v3/swagger-ui/">API</a>
| version: {{ flamencoVersion }}
</span>
</header>