{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Servant.Swagger.UI (
SwaggerSchemaUI,
SwaggerSchemaUI',
swaggerSchemaUIServer,
swaggerSchemaUIServerT,
swaggerSchemaUIServer',
swaggerSchemaUIServerT',
swaggerUiIndexTemplate,
swaggerUiFiles,
) where
import Servant.Swagger.UI.Core
import Data.Aeson (ToJSON, Value)
import Data.ByteString (ByteString)
import Data.Text (Text)
import FileEmbedLzma
import Servant
swaggerSchemaUIServer
:: (Server api ~ Handler Value, ToJSON a)
=> a -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer :: a -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer =
Text
-> [(FilePath, ByteString)]
-> a
-> Server (SwaggerSchemaUI' dir api)
forall (m :: * -> *) api a (dir :: Symbol).
(Monad m, ServerT api m ~ m Value, ToJSON a) =>
Text
-> [(FilePath, ByteString)]
-> a
-> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerImpl Text
swaggerUiIndexTemplate [(FilePath, ByteString)]
swaggerUiFiles
swaggerSchemaUIServerT
:: (Monad m, ServerT api m ~ m Value, ToJSON a)
=> a -> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerT :: a -> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerT =
Text
-> [(FilePath, ByteString)]
-> a
-> ServerT (SwaggerSchemaUI' dir api) m
forall (m :: * -> *) api a (dir :: Symbol).
(Monad m, ServerT api m ~ m Value, ToJSON a) =>
Text
-> [(FilePath, ByteString)]
-> a
-> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerImpl Text
swaggerUiIndexTemplate [(FilePath, ByteString)]
swaggerUiFiles
swaggerSchemaUIServer'
:: Server api -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer' :: Server api -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer' =
Text
-> [(FilePath, ByteString)]
-> Server api
-> Server (SwaggerSchemaUI' dir api)
forall (m :: * -> *) api (dir :: Symbol).
Monad m =>
Text
-> [(FilePath, ByteString)]
-> ServerT api m
-> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerImpl' Text
swaggerUiIndexTemplate [(FilePath, ByteString)]
swaggerUiFiles
swaggerSchemaUIServerT'
:: Monad m => ServerT api m -> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerT' :: ServerT api m -> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerT' =
Text
-> [(FilePath, ByteString)]
-> ServerT api m
-> ServerT (SwaggerSchemaUI' dir api) m
forall (m :: * -> *) api (dir :: Symbol).
Monad m =>
Text
-> [(FilePath, ByteString)]
-> ServerT api m
-> ServerT (SwaggerSchemaUI' dir api) m
swaggerSchemaUIServerImpl' Text
swaggerUiIndexTemplate [(FilePath, ByteString)]
swaggerUiFiles
swaggerUiIndexTemplate :: Text
swaggerUiIndexTemplate :: Text
swaggerUiIndexTemplate = $(embedText "index.html.tmpl")
swaggerUiFiles :: [(FilePath, ByteString)]
swaggerUiFiles :: [(FilePath, ByteString)]
swaggerUiFiles = $(embedRecursiveDir "swagger-ui-dist-4.5.0")