Skip to content

Commit c4b5e29

Browse files
committed
Support servant-0.12
1 parent d414c3e commit c4b5e29

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.1.4
2+
-----
3+
4+
* Notes:
5+
* `servant-0.12` compatible release
6+
17
1.1.3.1
28
---
39

servant-swagger.cabal

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: servant-swagger
2-
version: 1.1.3.1
3-
x-revision: 1
2+
version: 1.1.4
43
synopsis: Generate Swagger specification for your servant API.
54
description: Please see README.md
65
homepage: https://github.com/haskell-servant/servant-swagger
@@ -62,7 +61,7 @@ library
6261
, http-media >=0.6.3 && <0.8
6362
, insert-ordered-containers >=0.1.0.0 && <0.3
6463
, lens >=4.7.0.1 && <4.16
65-
, servant >=0.5 && <0.12
64+
, servant >=0.5 && <0.13
6665
, swagger2 >=2.1 && <2.3
6766
, text >=1.2.0.6 && <1.3
6867
, unordered-containers >=0.2.5.1 && <0.3
@@ -77,7 +76,7 @@ test-suite doctests
7776
base,
7877
directory >= 1.0,
7978
doctest >= 0.11.1 && <0.14,
80-
servant >= 0.10,
79+
servant,
8180
QuickCheck,
8281
filepath
8382
default-language: Haskell2010
@@ -96,7 +95,7 @@ test-suite spec
9695
, hspec
9796
, QuickCheck
9897
, lens
99-
, servant >= 0.10
98+
, servant
10099
, servant-swagger
101100
, swagger2
102101
, text

src/Servant/Swagger/Internal.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ instance (KnownSymbol sym, ToParamSchema a, HasSwagger sub) => HasSwagger (Captu
236236
toSwagger _ = toSwagger (Proxy :: Proxy (Capture sym a :> sub))
237237
#endif
238238

239+
#if MIN_VERSION_servant(0,12,0)
240+
instance (KnownSymbol desc, HasSwagger api) => HasSwagger (Description desc :> api) where
241+
toSwagger _ = toSwagger (Proxy :: Proxy api)
242+
& allOperations.description %~ (Just (Text.pack (symbolVal (Proxy :: Proxy desc))) <>)
243+
244+
instance (KnownSymbol desc, HasSwagger api) => HasSwagger (Summary desc :> api) where
245+
toSwagger _ = toSwagger (Proxy :: Proxy api)
246+
& allOperations.summary %~ (Just (Text.pack (symbolVal (Proxy :: Proxy desc))) <>)
247+
#endif
248+
239249
instance (KnownSymbol sym, ToParamSchema a, HasSwagger sub) => HasSwagger (QueryParam sym a :> sub) where
240250
toSwagger _ = toSwagger (Proxy :: Proxy sub)
241251
& addParam param

test/Servant/SwaggerSpec.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE DataKinds #-}
23
{-# LANGUAGE DeriveDataTypeable #-}
34
{-# LANGUAGE DeriveGeneric #-}
45
{-# LANGUAGE OverloadedStrings #-}
56
{-# LANGUAGE QuasiQuotes #-}
67
{-# LANGUAGE TypeOperators #-}
8+
#if __GLASGOW_HASKELL__ == 708
9+
{-# OPTIONS_GHC -fcontext-stack=31 #-}
10+
#endif
711
module Servant.SwaggerSpec where
812

913
import Control.Lens

0 commit comments

Comments
 (0)