Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant.Swagger.UI.Core
Synopsis
- type SwaggerSchemaUI (dir :: Symbol) (schema :: Symbol) = SwaggerSchemaUI' dir (schema :> Get '[JSON] Value)
- type SwaggerSchemaUI' (dir :: Symbol) api = api :<|> (dir :> (Get '[HTML] (SwaggerUiHtml dir api) :<|> (("index.html" :> Get '[HTML] (SwaggerUiHtml dir api)) :<|> Raw)))
- data SwaggerUiHtml (dir :: Symbol) api = SwaggerUiHtml Text
- swaggerSchemaUIServerImpl :: forall (m :: Type -> Type) api a (dir :: Symbol). (Monad m, ServerT api m ~ m Value, ToJSON a) => Text -> [(FilePath, ByteString)] -> a -> ServerT (SwaggerSchemaUI' dir api) m
- swaggerSchemaUIServerImpl' :: forall (m :: Type -> Type) api (dir :: Symbol). Monad m => Text -> [(FilePath, ByteString)] -> ServerT api m -> ServerT (SwaggerSchemaUI' dir api) m
- data Handler a
Swagger UI API
type SwaggerSchemaUI (dir :: Symbol) (schema :: Symbol) = SwaggerSchemaUI' dir (schema :> Get '[JSON] Value) Source #
Swagger schema + ui api.
SwaggerSchemaUI "swagger-ui" "swagger.json"
will result into following hierarchy:
/swagger.json /swagger-ui /swagger-ui/index.html /swagger-ui/...
This type does not actually force served type to be Swagger
from swagger2
package,
it could be arbitrary aeson
Value
.
type SwaggerSchemaUI' (dir :: Symbol) api = api :<|> (dir :> (Get '[HTML] (SwaggerUiHtml dir api) :<|> (("index.html" :> Get '[HTML] (SwaggerUiHtml dir api)) :<|> Raw))) Source #
Use SwaggerSchemaUI'
when you need even more control over
where swagger.json
is served (e.g. subdirectory).
Implementation details
data SwaggerUiHtml (dir :: Symbol) api Source #
Index file for swagger ui.
It's configured by the location of swagger schema and directory it lives under.
Implementation detail: the index.html
is prepopulated with parameters
to find schema file automatically.
Constructors
SwaggerUiHtml Text |
Instances
(KnownSymbol dir, HasLink api, Link ~ MkLink api Link, IsElem api api) => ToMarkup (SwaggerUiHtml dir api) Source # | |
Defined in Servant.Swagger.UI.Core Methods toMarkup :: SwaggerUiHtml dir api -> Markup # preEscapedToMarkup :: SwaggerUiHtml dir api -> Markup # |
swaggerSchemaUIServerImpl :: forall (m :: Type -> Type) api a (dir :: Symbol). (Monad m, ServerT api m ~ m Value, ToJSON a) => Text -> [(FilePath, ByteString)] -> a -> ServerT (SwaggerSchemaUI' dir api) m Source #
swaggerSchemaUIServerImpl' :: forall (m :: Type -> Type) api (dir :: Symbol). Monad m => Text -> [(FilePath, ByteString)] -> ServerT api m -> ServerT (SwaggerSchemaUI' dir api) m Source #
Use a custom server to serve the Swagger spec source.