From 22f904e785a4c84a8f1dc84e647f7c00a03d12af Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 9 Aug 2018 14:26:42 +0200 Subject: [PATCH] Allow swagger-servant-ui with redoc to be nested in an API In the current state, if we were to declare a servant-swagger-ui server behind some path, for instance: type API = "docs" :> ServantSwaggerUI "swagger-ui" "swagger.json" One would correctly have access to the template in `/docs/swagger.ui` but the template would refer to a swagger.json at `/swagger.json` whereas it is hosted under `/docs/swagger.json`. To cope with this, we can use relative paths in the template, making sure that the current url is always ending with a slash. --- servant-swagger-ui-redoc/redoc.index.html.tmpl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/servant-swagger-ui-redoc/redoc.index.html.tmpl b/servant-swagger-ui-redoc/redoc.index.html.tmpl index 41e4fc6..3523de2 100644 --- a/servant-swagger-ui-redoc/redoc.index.html.tmpl +++ b/servant-swagger-ui-redoc/redoc.index.html.tmpl @@ -7,9 +7,17 @@ + - +