git.iko.soy/typeable/servant-swagger-ui
on master help sign in
Merge pull request #36 from phadej/servant-0.12

Allow servant-0.12

commit1ee4f6c26e5ed720604b9e2e93c66a3b857e6253 authorOleg Grenrus <oleg.grenrus@iki.fi> dateWed 8 Nov 2017, 11:55 (9 years ago) parentbb280699de9bb6
3 files changed+12−6
example/Main.hs+9−4 screenshot.png servant-swagger-ui.cabal+3−2
example/Main.hs+9−4
@@ -44,6 +44,11 @@ import Control.Monad.Trans.Either (EitherT)
4444#endif
4545#endif
4646
47+#if MIN_VERSION_servant(0,12,0)
48+#define SUMMARY(d) Summary d :>
49+#else
50+#define SUMMARY(d)
51+#endif
4752
4853-- data types
4954data Cat = Cat { catName :: CatName, catIsMale :: Bool }
@@ -72,10 +77,10 @@ instance ToSchema CatName
7277
7378-- api
7479type BasicAPI = Get '[PlainText, JSON] Text
75− :<|> "cat" :> Capture ":name" CatName :> Get '[JSON] Cat
76− :<|> "cat2" :> Capture ":name" CatName :> Get '[JSON] Cat
77− :<|> "cat3" :> Capture ":name" CatName :> Get '[JSON] Cat
78− :<|> "post-cat" :> ReqBody '[JSON] Cat :> Get '[JSON] Cat
80+ :<|> SUMMARY("First cat") "cat" :> Capture ":name" CatName :> Get '[JSON] Cat
81+ :<|> SUMMARY("Second cat") "cat2" :> Capture ":name" CatName :> Get '[JSON] Cat
82+ :<|> SUMMARY("Third cat") "cat3" :> Capture ":name" CatName :> Get '[JSON] Cat
83+ :<|> SUMMARY("Post endpoint") "post-cat" :> ReqBody '[JSON] Cat :> Get '[JSON] Cat
7984
8085type API =
8186 -- this serves both: swagger.json and swagger-ui
screenshot.png

Binary file not shown.

servant-swagger-ui.cabal+3−2
@@ -1,5 +1,6 @@
11name: servant-swagger-ui
22version: 0.2.4.3.4.0
3+x-revision: 1
34synopsis: Servant swagger ui
45description: Provide embedded swagger UI for servant and swagger (i.e. servant-swagger)
56category: Web, Servant, Swagger
@@ -96,9 +97,9 @@ library
9697 , file-embed >=0.0.9 && <0.1
9798 , filepath >=1.3.0.2 && <1.5
9899 , http-media >=0.6.2 && <0.8
99− , servant >=0.4.4.5 && <0.12
100+ , servant >=0.4.4.5 && <0.13
100101 , servant-blaze >=0.4.4.5 && <0.9
101− , servant-server >=0.4.4.5 && <0.12
102+ , servant-server >=0.4.4.5 && <0.13
102103 , servant-swagger >=1.0.3 && <1.2
103104 , swagger2 >=2.0.1 && <2.3
104105 , template-haskell >=2.9 && <2.13