From 6020688fa34d89ad6a1d3c8e4f18f7a1ee98bbb7 Mon Sep 17 00:00:00 2001 From: Artyom Kazak Date: Sat, 1 Sep 2018 20:25:47 +0200 Subject: [PATCH] Use ReDoc instead of Swagger-UI --- guide.cabal | 2 +- src/Guide/Api/Server.hs | 6 +++--- stack.yaml | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/guide.cabal b/guide.cabal index b1837bc..51fa9af 100644 --- a/guide.cabal +++ b/guide.cabal @@ -142,7 +142,7 @@ library , servant-generic , servant-server , servant-swagger - , servant-swagger-ui + , servant-swagger-ui-redoc , swagger2 , shortcut-links >= 0.4.2 , slave-thread diff --git a/src/Guide/Api/Server.hs b/src/Guide/Api/Server.hs index 753b601..c9024bd 100644 --- a/src/Guide/Api/Server.hs +++ b/src/Guide/Api/Server.hs @@ -16,7 +16,7 @@ import Data.Acid as Acid import Servant import Servant.Generic import Servant.Swagger -import Servant.Swagger.UI +import Servant.Swagger.UI.ReDoc import Network.Wai.Handler.Warp (run) import Network.Wai (Middleware) import Network.Wai.Middleware.Cors (CorsResourcePolicy (..), cors @@ -37,12 +37,12 @@ apiServer db = Site type FullApi = Api :<|> - "docs" :> SwaggerSchemaUI "api" "swagger.json" + SwaggerSchemaUI "api" "swagger.json" fullServer :: DB -> Server FullApi fullServer db = toServant (apiServer db) :<|> - swaggerSchemaUIServer (toSwagger (Proxy @Api)) + redocSchemaUIServer (toSwagger (Proxy @Api)) -- | Serve the API on port 4400. -- diff --git a/stack.yaml b/stack.yaml index 988ae66..c10f054 100644 --- a/stack.yaml +++ b/stack.yaml @@ -14,6 +14,9 @@ extra-deps: - digestive-functors-0.8.4.0 - servant-generic-0.1.0.3 - acid-state-0.14.3 +- servant-swagger-ui-redoc-0.3.0.1.21.2 +- file-embed-lzma-0 +- servant-swagger-ui-core-0.3.1 - git: https://github.com/neongreen/patches-vector commit: 9bb704cf7f14cff9ef76a5d177e4e56ceee24705 - git: https://github.com/aelve/stache-plus