servant-foreign 0.10 → 0.10.1
raw patch · 4 files changed
+24/−4 lines, 4 filesdep ~servant
Dependency ranges changed: servant
Files
- CHANGELOG.md +9/−0
- servant-foreign.cabal +2/−2
- src/Servant/Foreign/Internal.hs +11/−1
- test/Servant/ForeignSpec.hs +2/−1
CHANGELOG.md view
@@ -1,3 +1,12 @@+0.10.1+------++### Changes++* Don't drop samples in `HasDocs ReqBody` instance+ ([#755](https://github.com/haskell-servant/servant/pull/755/files)).+ *Breaking change in an `Internal` module*.+ 0.10 ----
servant-foreign.cabal view
@@ -1,5 +1,5 @@ name: servant-foreign-version: 0.10+version: 0.10.1 synopsis: Helpers for generating clients for servant APIs in any programming language description: Helper types and functions for generating client functions for servant APIs in any programming language@@ -32,7 +32,7 @@ , Servant.Foreign.Inflections build-depends: base == 4.* , lens == 4.*- , servant == 0.10.*+ , servant == 0.11.* , text >= 1.2 && < 1.3 , http-types hs-source-dirs: src
src/Servant/Foreign/Internal.hs view
@@ -187,9 +187,16 @@ foreignFor lang ftype (Proxy :: Proxy a) req :<|> foreignFor lang ftype (Proxy :: Proxy b) req +data EmptyForeignAPI = EmptyForeignAPI++instance HasForeign lang ftype EmptyAPI where+ type Foreign ftype EmptyAPI = EmptyForeignAPI++ foreignFor Proxy Proxy Proxy _ = EmptyForeignAPI+ instance (KnownSymbol sym, HasForeignType lang ftype t, HasForeign lang ftype api) => HasForeign lang ftype (Capture sym t :> api) where- type Foreign ftype (Capture sym a :> api) = Foreign ftype api+ type Foreign ftype (Capture sym t :> api) = Foreign ftype api foreignFor lang Proxy Proxy req = foreignFor lang Proxy (Proxy :: Proxy api) $@@ -348,6 +355,9 @@ -- and hands it all back in a list. class GenerateList ftype reqs where generateList :: reqs -> [Req ftype]++instance GenerateList ftype EmptyForeignAPI where+ generateList _ = [] instance GenerateList ftype (Req ftype) where generateList r = [r]
test/Servant/ForeignSpec.hs view
@@ -57,13 +57,14 @@ :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent :<|> "test" :> CaptureAll "ids" Int :> Get '[JSON] [Int]+ :<|> "test" :> EmptyAPI testApi :: [Req String] testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi) listFromAPISpec :: Spec listFromAPISpec = describe "listFromAPI" $ do- it "generates 4 endpoints for TestApi" $ do+ it "generates 5 endpoints for TestApi" $ do length testApi `shouldBe` 5 let [getReq, postReq, putReq, deleteReq, captureAllReq] = testApi