From bdc26aa0ad239ce57aa67b3e949da9624442028c Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 4 Sep 2019 15:51:44 -0400 Subject: [PATCH] rudaments but it fails because stripe-core-2.5.0:Web.Stripe.Types.Event has no ToJSON instance --- PaymentServer.cabal | 9 +++++++++ apidocs/Main.hs | 19 +++++++++++++++++++ src/PaymentServer/Server.hs | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 apidocs/Main.hs diff --git a/PaymentServer.cabal b/PaymentServer.cabal index 56d7c01..b7be6c4 100644 --- a/PaymentServer.cabal +++ b/PaymentServer.cabal @@ -43,6 +43,15 @@ executable PaymentServer-exe , PaymentServer default-language: Haskell2010 +executable PaymentServer-apidocs + hs-source-dirs: apidocs + main-is: Main.hs + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wmissing-import-lists -Wunused-imports + build-depends: base + , servant-docs + , PaymentServer + default-language: Haskell2010 + test-suite PaymentServer-test type: exitcode-stdio-1.0 hs-source-dirs: test diff --git a/apidocs/Main.hs b/apidocs/Main.hs new file mode 100644 index 0000000..4b9683d --- /dev/null +++ b/apidocs/Main.hs @@ -0,0 +1,19 @@ +module Main + ( main + ) where + +import PaymentServer.Server + ( paymentServerAPI + ) +import Servant.Docs + ( API + , docs + , markdown + ) + +-- Generate the Documentation's ADT +greetDocs :: API +greetDocs = docs paymentServerAPI + +main :: IO () +main = print $ markdown greetDocs diff --git a/src/PaymentServer/Server.hs b/src/PaymentServer/Server.hs index f55b779..f63f99a 100644 --- a/src/PaymentServer/Server.hs +++ b/src/PaymentServer/Server.hs @@ -4,7 +4,9 @@ -- | This module exposes a Servant-based Network.Wai server for payment -- interactions. module PaymentServer.Server - ( paymentServerApp + ( PaymentServerAPI + , paymentServerAPI + , paymentServerApp ) where import Servant -- GitLab