servant-validate: Chekc static properties of servant APIs

[ bsd3, library, web ] [ Propose Tags ]

A package with "test suites" to help verify that your servant APIs are valid at compile-time.

Currently the only property tested is that there are no duplicated paths.

```haskell data DeadlySinEnum = Lust | Gluttony | Greed | Sloth | Wrath | Envy | Pride

type MathApi = "sin" :> ReqBody '[JSON] Double :> Post '[JSON] NoContent type SatanApi = "sin" :> ReqBody '[JSON] DeadlySinEnum :> Post '[JSON] NoContent

type MyApi = MathApi :| SatanApi

myApi :: Proxy MyApi myApi = Proxy

validMyApi :: ValidApiTree MyApi validMyApi = validApiTree myApi ```

```haskell warning: [-Wdeferred-type-errors] • Duplicate method in API at path /sin: POST • In the expression: validApiTree myApi In an equation for ‘validMyApi’: validMyApi = validApiTree myApi ```


[Skip to Readme]
Versions [RSS] [faq] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), containers, servant, text [details]
License BSD-3-Clause
Copyright (c) 2021 Justin Le
Author Justin Le
Maintainer justin@jle.im
Category Web
Home page https://github.com/mstksg/servant-validate#readme
Bug tracker https://github.com/mstksg/servant-validate/issues
Source repo head: git clone https://github.com/mstksg/servant-validate
Uploaded by jle at 2021-02-19T05:26:33Z
Distributions NixOS:0.1.0.0
Downloads 54 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for servant-validate-0.1.0.0

[back to package description]

servant-validate

A package with "test suites" to help verify that your servant APIs are valid at compile-time.

Currently the only property tested is that there are no duplicated paths.

data DeadlySinEnum = Lust | Gluttony | Greed | Sloth | Wrath | Envy | Pride

type MathApi  = "sin" :> ReqBody '[JSON] Double        :> Post '[JSON] NoContent
type SatanApi = "sin" :> ReqBody '[JSON] DeadlySinEnum :> Post '[JSON] NoContent

type MyApi = MathApi :<|> SatanApi

myApi :: Proxy MyApi
myApi = Proxy

validMyApi :: ValidApiTree MyApi
validMyApi = validApiTree myApi
warning: [-Wdeferred-type-errors]
    • Duplicate method in API at path /sin: "POST"
    • In the expression: validApiTree myApi
      In an equation for ‘validMyApi’: validMyApi = validApiTree myApi