@@ -46,6 +46,7 @@ type TestApi
46 :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] NoContent
46 :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] NoContent
47 :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent
47 :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent
48 :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent
48 :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent
49+ :<|> "test" :> CaptureAll "ids" Int :> Get '[JSON] [Int]
50testApi :: [Req String]
51testApi :: [Req String]
51testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi)
52testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi)
@@ -53,9 +54,9 @@ testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: P
53listFromAPISpec :: Spec
54listFromAPISpec :: Spec
54listFromAPISpec = describe "listFromAPI" $ do
55listFromAPISpec = describe "listFromAPI" $ do
55 it "generates 4 endpoints for TestApi" $ do
56 it "generates 4 endpoints for TestApi" $ do
56− length testApi `shouldBe` 4
57+ length testApi `shouldBe` 5
58− let [getReq, postReq, putReq, deleteReq] = testApi
59+ let [getReq, postReq, putReq, deleteReq, captureAllReq] = testApi
60 it "collects all info for get request" $ do
61 it "collects all info for get request" $ do
61 shouldBe getReq $ defReq
62 shouldBe getReq $ defReq
@@ -106,3 +107,16 @@ listFromAPISpec = describe "listFromAPI" $ do
106 , _reqReturnType = Just "voidX"
107 , _reqReturnType = Just "voidX"
107 , _reqFuncName = FunctionName ["delete", "test", "by", "id"]
108 , _reqFuncName = FunctionName ["delete", "test", "by", "id"]
111+ it "collects all info for capture all request" $ do
112+ shouldBe captureAllReq $ defReq
114+ [ Segment $ Static "test"
115+ , Segment $ Cap (Arg "ids" "listX of intX") ]
117+ , _reqMethod = "GET"
119+ , _reqBody = Nothing
120+ , _reqReturnType = Just "listX of intX"
121+ , _reqFuncName = FunctionName ["get", "test", "by", "ids"]