git.iko.soy/typeable/servant
on master help sign in
Make ComprehensiveAPI part of public API
7634e08Oleg Grenrus
servant-client/test/Servant/ClientSpec.hs+1−1
@@ -64,7 +64,7 @@ import Servant.API
64 DeleteNoContent, EmptyAPI, FormUrlEncoded, Get, Header,
64 DeleteNoContent, EmptyAPI, FormUrlEncoded, Get, Header,
65 Headers, JSON, NoContent (NoContent), Post, Put, QueryFlag,
65 Headers, JSON, NoContent (NoContent), Post, Put, QueryFlag,
66 QueryParam, QueryParams, Raw, ReqBody, addHeader, getHeaders)
66 QueryParam, QueryParams, Raw, ReqBody, addHeader, getHeaders)
67−import Servant.API.Internal.Test.ComprehensiveAPI
67+import Servant.Test.ComprehensiveAPI
68import Servant.Client
68import Servant.Client
69import qualified Servant.Client.Core.Internal.Auth as Auth
69import qualified Servant.Client.Core.Internal.Auth as Auth
70import qualified Servant.Client.Core.Internal.Request as Req
70import qualified Servant.Client.Core.Internal.Request as Req
servant-docs/test/Servant/DocsSpec.hs+1−1
@@ -21,7 +21,7 @@ import GHC.Generics
21import Test.Hspec
21import Test.Hspec
22
22
23import Servant.API
23import Servant.API
24−import Servant.API.Internal.Test.ComprehensiveAPI
24+import Servant.Test.ComprehensiveAPI
25import Servant.Docs.Internal
25import Servant.Docs.Internal
26
26
27-- * comprehensive api
27-- * comprehensive api
servant-foreign/test/Servant/ForeignSpec.hs+1−1
@@ -14,7 +14,7 @@ module Servant.ForeignSpec where
14import Data.Monoid
14import Data.Monoid
15 ((<>))
15 ((<>))
16import Data.Proxy
16import Data.Proxy
17−import Servant.API.Internal.Test.ComprehensiveAPI
17+import Servant.Test.ComprehensiveAPI
18import Servant.Foreign
18import Servant.Foreign
19import Servant.Types.SourceT
19import Servant.Types.SourceT
20 (SourceT)
20 (SourceT)
servant-server/test/Servant/ServerSpec.hs+1−1
@@ -51,7 +51,7 @@ import Servant.API
51 PlainText, Post, Put, QueryFlag, QueryParam, QueryParams, Raw,
51 PlainText, Post, Put, QueryFlag, QueryParam, QueryParams, Raw,
52 RemoteHost, ReqBody, StdMethod (..), Stream,
52 RemoteHost, ReqBody, StdMethod (..), Stream,
53 SourceIO, Verb, addHeader)
53 SourceIO, Verb, addHeader)
54−import Servant.API.Internal.Test.ComprehensiveAPI
54+import Servant.Test.ComprehensiveAPI
55import Servant.Server
55import Servant.Server
56 (Context ((:.), EmptyContext), Handler, Server, Tagged (..),
56 (Context ((:.), EmptyContext), Handler, Server, Tagged (..),
57 emptyServer, err401, err403, err404, serve, serveWithContext)
57 emptyServer, err401, err403, err404, serve, serveWithContext)
servant/servant.cabal+5−1
@@ -48,7 +48,6 @@ library
48 Servant.API.Generic
48 Servant.API.Generic
49 Servant.API.Header
49 Servant.API.Header
50 Servant.API.HttpVersion
50 Servant.API.HttpVersion
51− Servant.API.Internal.Test.ComprehensiveAPI
52 Servant.API.IsSecure
51 Servant.API.IsSecure
53 Servant.API.Modifiers
52 Servant.API.Modifiers
54 Servant.API.QueryParam
53 Servant.API.QueryParam
@@ -67,6 +66,10 @@ library
67 exposed-modules:
66 exposed-modules:
68 Servant.Types.SourceT
67 Servant.Types.SourceT
69
68
69+ -- Test stuff
70+ exposed-modules:
71+ Servant.Test.ComprehensiveAPI
72+
70 -- Safe links
73 -- Safe links
71 exposed-modules:
74 exposed-modules:
72 Servant.Links
75 Servant.Links
@@ -74,6 +77,7 @@ library
74 -- Deprecated modules, to be removed in late 2019
77 -- Deprecated modules, to be removed in late 2019
75 exposed-modules:
78 exposed-modules:
76 Servant.Utils.Links
79 Servant.Utils.Links
80+ Servant.API.Internal.Test.ComprehensiveAPI
77
81
78 -- Bundled with GHC: Lower bound to not force re-installs
82 -- Bundled with GHC: Lower bound to not force re-installs
79 -- text and mtl are bundled starting with GHC-8.4
83 -- text and mtl are bundled starting with GHC-8.4
servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+5−51
@@ -1,52 +1,6 @@
1−{-# LANGUAGE DataKinds #-}
1+module Servant.API.Internal.Test.ComprehensiveAPI
2−{-# LANGUAGE TypeOperators #-}
2+ {-# DEPRECATED "Use Servant.TestComprehensiveAPI" #-}
3+ ( module Servant.Test.ComprehensiveAPI )
4+ where
3
5
4−-- | This is a module containing an API with all `Servant.API` combinators. It
5−-- is used for testing only (in particular, checking that instances exist for
6−-- the core servant classes for each combinator), and should not be imported.
7−module Servant.API.Internal.Test.ComprehensiveAPI where
6+import Servant.Test.ComprehensiveAPI
8−
9−import Data.Proxy
10− (Proxy (..))
11−import Servant.API
12−import Servant.Types.SourceT
13− (SourceT)
14−
15−type GET = Get '[JSON] NoContent
16−
17−type ComprehensiveAPI =
18− ComprehensiveAPIWithoutRaw :<|>
19− Raw
20−
21−comprehensiveAPI :: Proxy ComprehensiveAPI
22−comprehensiveAPI = Proxy
23−
24−type ComprehensiveAPIWithoutRaw =
25− GET :<|>
26− Get '[JSON] Int :<|>
27− Capture' '[Description "example description"] "foo" Int :> GET :<|>
28− Header "foo" Int :> GET :<|>
29− Header' '[Required, Lenient] "bar" Int :> GET :<|>
30− HttpVersion :> GET :<|>
31− IsSecure :> GET :<|>
32− QueryParam "foo" Int :> GET :<|>
33− QueryParam' '[Required, Lenient] "bar" Int :> GET :<|>
34− QueryParams "foo" Int :> GET :<|>
35− QueryFlag "foo" :> GET :<|>
36− RemoteHost :> GET :<|>
37− ReqBody '[JSON] Int :> GET :<|>
38− ReqBody' '[Lenient] '[JSON] Int :> GET :<|>
39− Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|>
40− "foo" :> GET :<|>
41− Vault :> GET :<|>
42− Verb 'POST 204 '[JSON] NoContent :<|>
43− Verb 'POST 204 '[JSON] Int :<|>
44− StreamBody NetstringFraming JSON (SourceT IO Int) :> Stream 'GET 200 NetstringFraming JSON (SourceT IO Int) :<|>
45− WithNamedContext "foo" '[] GET :<|>
46− CaptureAll "foo" Int :> GET :<|>
47− Summary "foo" :> GET :<|>
48− Description "foo" :> GET :<|>
49− EmptyAPI
50−
51−comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPIWithoutRaw
52−comprehensiveAPIWithoutRaw = Proxy
servant/src/Servant/Test/ComprehensiveAPI.hsnew file+52
@@ -0,0 +1,52 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE TypeOperators #-}
3+
4+-- | This is a module containing an API with all `Servant.API` combinators. It
5+-- is used for testing only (in particular, checking that instances exist for
6+-- the core servant classes for each combinator).
7+module Servant.Test.ComprehensiveAPI where
8+
9+import Data.Proxy
10+ (Proxy (..))
11+import Servant.API
12+import Servant.Types.SourceT
13+ (SourceT)
14+
15+type GET = Get '[JSON] NoContent
16+
17+type ComprehensiveAPI =
18+ ComprehensiveAPIWithoutRaw :<|>
19+ Raw
20+
21+comprehensiveAPI :: Proxy ComprehensiveAPI
22+comprehensiveAPI = Proxy
23+
24+type ComprehensiveAPIWithoutRaw =
25+ GET :<|>
26+ Get '[JSON] Int :<|>
27+ Capture' '[Description "example description"] "foo" Int :> GET :<|>
28+ Header "foo" Int :> GET :<|>
29+ Header' '[Required, Lenient] "bar" Int :> GET :<|>
30+ HttpVersion :> GET :<|>
31+ IsSecure :> GET :<|>
32+ QueryParam "foo" Int :> GET :<|>
33+ QueryParam' '[Required, Lenient] "bar" Int :> GET :<|>
34+ QueryParams "foo" Int :> GET :<|>
35+ QueryFlag "foo" :> GET :<|>
36+ RemoteHost :> GET :<|>
37+ ReqBody '[JSON] Int :> GET :<|>
38+ ReqBody' '[Lenient] '[JSON] Int :> GET :<|>
39+ Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|>
40+ "foo" :> GET :<|>
41+ Vault :> GET :<|>
42+ Verb 'POST 204 '[JSON] NoContent :<|>
43+ Verb 'POST 204 '[JSON] Int :<|>
44+ StreamBody NetstringFraming JSON (SourceT IO Int) :> Stream 'GET 200 NetstringFraming JSON (SourceT IO Int) :<|>
45+ WithNamedContext "foo" '[] GET :<|>
46+ CaptureAll "foo" Int :> GET :<|>
47+ Summary "foo" :> GET :<|>
48+ Description "foo" :> GET :<|>
49+ EmptyAPI
50+
51+comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPIWithoutRaw
52+comprehensiveAPIWithoutRaw = Proxy
servant/test/Servant/LinksSpec.hs+1−1
@@ -13,7 +13,7 @@ import Test.Hspec
13 (Expectation, Spec, describe, it, shouldBe)
13 (Expectation, Spec, describe, it, shouldBe)
14
14
15import Servant.API
15import Servant.API
16−import Servant.API.Internal.Test.ComprehensiveAPI
16+import Servant.Test.ComprehensiveAPI
17 (comprehensiveAPIWithoutRaw)
17 (comprehensiveAPIWithoutRaw)
18import Servant.Links
18import Servant.Links
19
19