{-# 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,
swaggerSchemaUIServer',
swaggerUiIndexTemplate,
swaggerUiFiles,
) where
import Servant.Swagger.UI.Core
import Data.ByteString (ByteString)
import Data.Swagger (Swagger)
import Data.Text (Text)
import FileEmbedLzma
import Servant
swaggerSchemaUIServer
:: (Server api ~ Handler Swagger)
=> Swagger -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer :: Swagger -> Server (SwaggerSchemaUI' dir api)
swaggerSchemaUIServer =
Text
-> [(FilePath, ByteString)]
-> Swagger
-> Server (SwaggerSchemaUI' dir api)
forall api (dir :: Symbol).
(Server api ~ Handler Swagger) =>
Text
-> [(FilePath, ByteString)]
-> Swagger
-> Server (SwaggerSchemaUI' dir api)
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 api (dir :: Symbol).
Text
-> [(FilePath, ByteString)]
-> Server api
-> Server (SwaggerSchemaUI' dir api)
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-3.36.1")