Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mstksg/servant-validate
Validate well-formed servant APIs at compile time
https://github.com/mstksg/servant-validate
Last synced: about 2 months ago
JSON representation
Validate well-formed servant APIs at compile time
- Host: GitHub
- URL: https://github.com/mstksg/servant-validate
- Owner: mstksg
- License: bsd-3-clause
- Created: 2020-11-18T22:37:15.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-17T20:39:52.000Z (almost 4 years ago)
- Last Synced: 2024-10-12T00:55:13.462Z (2 months ago)
- Language: Haskell
- Size: 102 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```haskell
data DeadlySinEnum = Lust | Gluttony | Greed | Sloth | Wrath | Envy | Pridetype MathApi = "sin" :> ReqBody '[JSON] Double :> Post '[JSON] NoContent
type SatanApi = "sin" :> ReqBody '[JSON] DeadlySinEnum :> Post '[JSON] NoContenttype MyApi = MathApi :<|> SatanApi
myApi :: Proxy MyApi
myApi = ProxyvalidMyApi :: 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
```