Generate HasField instance for responses returning it's status

This commit is contained in:
Alex Biehl 2023-01-09 10:30:29 +01:00 committed by Alexander Biehl
parent f1bf26d876
commit f4df5169ae
17 changed files with 310 additions and 2 deletions

View File

@ -33,6 +33,11 @@ codegenModuleHeader moduleName =
<> PP.line
<> "{-#"
<+> "LANGUAGE"
<+> "DataKinds"
<+> "#-}"
<> PP.line
<> "{-#"
<+> "LANGUAGE"
<+> "DuplicateRecordFields"
<+> "#-}"
<> PP.line
@ -135,6 +140,10 @@ codegenModuleHeader moduleName =
<> PP.line
<> "import"
<+> "qualified"
<+> "GHC.Records"
<> PP.line
<> "import"
<+> "qualified"
<+> "GHC.Types"
<> PP.line
<> "import"

View File

@ -114,9 +114,12 @@ codegenResponses resolver responseModuleName Operation {..} = do
]
)
instances =
toResponseInstance =
codegenToResponses responseModuleName name responses defaultResponse
hasStatusInstance =
codegenHasStatusField name responses defaultResponse
showInstance =
"instance"
<+> "Show"
@ -131,9 +134,51 @@ codegenResponses resolver responseModuleName Operation {..} = do
pure
( PP.vsep $
intersperse mempty $
[decl, instances] ++ [showInstance | requiresCustomShowInstance]
[decl, toResponseInstance, hasStatusInstance] ++ [showInstance | requiresCustomShowInstance]
)
codegenHasStatusField ::
Name ->
[(Int, Response)] ->
Maybe Response ->
Doc ann
codegenHasStatusField operationName responses defaultResponse =
"instance"
<+> "GHC.Records.HasField"
<+> "\"status\""
<+> toApiResponseTypeName operationName
<+> "Network.HTTP.Types.Status"
<+> "where"
<> PP.line
<> PP.indent
4
( PP.vsep $
[ "getField"
<+> "(" <> toApiResponseConstructorName operationName statusCode
<+> "{}" <> ")"
<+> "="
<+> "Network.HTTP.Types.status" <> PP.pretty statusCode
| (statusCode, _response) <- responses
]
++ [ "getField"
<+> "("
<> PP.hsep
( concat
[ [toApiDefaultResponseConstructorName operationName, "status"],
( case response of
Response {responseContent = _ : _} -> ["_"]
_ -> []
),
["_" | Header {name} <- headers]
]
)
<> ")"
<+> "="
<+> "status"
| Just response@Response {headers} <- [defaultResponse]
]
)
codegenToResponses ::
-- | Aux. Response module name TODO make this a proper type
Text ->

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -452,6 +454,7 @@ class ToResponse a where
Test/Response/ListPets.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -477,6 +480,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -493,10 +497,14 @@ data ListPetsResponse
instance ToResponse ListPetsResponse where
toResponse (ListPetsResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPetsResponse Network.HTTP.Types.Status where
getField (ListPetsResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPets2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -522,6 +530,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -578,10 +587,14 @@ data ListPets2Response
instance ToResponse ListPets2Response where
toResponse (ListPets2Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPets2Response Network.HTTP.Types.Status where
getField (ListPets2Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Pet.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -607,6 +620,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -647,6 +661,7 @@ instance Data.Aeson.FromJSON Pet where
Test/Schemas/Pets.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -672,6 +687,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -438,6 +440,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -463,6 +466,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -481,6 +485,9 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
test.cabal

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -452,6 +454,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -477,6 +480,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -493,12 +497,16 @@ instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseStream Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "text/csv")]) x
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
instance Show TestResponse where
show _ = "TestResponse {}"
---------------------
Test/Response/Test2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -524,6 +532,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -540,6 +549,9 @@ data Test2Response
instance ToResponse Test2Response where
toResponse (Test2Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" Test2Response Network.HTTP.Types.Status where
getField (Test2Response200 {}) = Network.HTTP.Types.status200
---------------------
test.cabal

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -438,6 +440,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -463,6 +466,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -479,10 +483,14 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -508,6 +516,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -441,6 +443,7 @@ class ToResponse a where
Test/Response/Dummy.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -466,6 +469,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -482,10 +486,14 @@ data DummyResponse
instance ToResponse DummyResponse where
toResponse (DummyResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" DummyResponse Network.HTTP.Types.Status where
getField (DummyResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/DockerPackage.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -511,6 +519,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -572,6 +581,7 @@ instance Data.Aeson.FromJSON DockerPackage where
Test/Schemas/FilePackage.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -597,6 +607,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -658,6 +669,7 @@ instance Data.Aeson.FromJSON FilePackage where
Test/Schemas/Package.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -683,6 +695,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -713,6 +726,7 @@ instance Data.Aeson.FromJSON Package where
Test/Schemas/PackageBase.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -738,6 +752,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -790,6 +805,7 @@ instance Data.Aeson.FromJSON PackageBase where
Test/Schemas/PackageType.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -815,6 +831,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -505,6 +507,7 @@ class ToResponse a where
Test/Response/ListPackages.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -530,6 +533,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -546,10 +550,14 @@ data ListPackagesResponse
instance ToResponse ListPackagesResponse where
toResponse (ListPackagesResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackagesResponse Network.HTTP.Types.Status where
getField (ListPackagesResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -575,6 +583,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -630,10 +639,14 @@ data ListPackages2Response
instance ToResponse ListPackages2Response where
toResponse (ListPackages2Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages2Response Network.HTTP.Types.Status where
getField (ListPackages2Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages3.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -659,6 +672,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -708,10 +722,14 @@ data ListPackages3Response
instance ToResponse ListPackages3Response where
toResponse (ListPackages3Response201) =
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([]) mempty
instance GHC.Records.HasField "status" ListPackages3Response Network.HTTP.Types.Status where
getField (ListPackages3Response201 {}) = Network.HTTP.Types.status201
---------------------
Test/Response/ListPackages4.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -737,6 +755,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -753,10 +772,14 @@ data ListPackages4Response
instance ToResponse ListPackages4Response where
toResponse (ListPackages4Response201) =
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([]) mempty
instance GHC.Records.HasField "status" ListPackages4Response Network.HTTP.Types.Status where
getField (ListPackages4Response201 {}) = Network.HTTP.Types.status201
---------------------
Test/Response/ListPackages5.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -782,6 +805,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -798,10 +822,14 @@ data ListPackages5Response
instance ToResponse ListPackages5Response where
toResponse (ListPackages5Response201) =
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([]) mempty
instance GHC.Records.HasField "status" ListPackages5Response Network.HTTP.Types.Status where
getField (ListPackages5Response201 {}) = Network.HTTP.Types.status201
---------------------
Test/Schemas/InsightsTimeRange.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -827,6 +855,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -878,6 +907,7 @@ instance Web.HttpApiData.FromHttpApiData InsightsTimeRange where
Test/Schemas/Order.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -903,6 +933,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -948,6 +979,7 @@ instance Web.HttpApiData.FromHttpApiData Order where
Test/Schemas/Package.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -973,6 +1005,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -442,6 +444,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -467,6 +470,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -483,10 +487,14 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -512,6 +520,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -469,6 +471,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -494,6 +497,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -510,10 +514,14 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/Test1.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -539,6 +547,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -555,10 +564,14 @@ data Test1Response
instance ToResponse Test1Response where
toResponse (Test1Response201 __Location) =
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([("Location", Web.HttpApiData.toHeader __Location) | Just __Location <- [__Location]] ++ []) mempty
instance GHC.Records.HasField "status" Test1Response Network.HTTP.Types.Status where
getField (Test1Response201 {}) = Network.HTTP.Types.status201
---------------------
Test/Response/Test2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -584,6 +597,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -600,10 +614,14 @@ data Test2Response
instance ToResponse Test2Response where
toResponse (Test2Response201 __Location) =
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([("Location", Web.HttpApiData.toHeader __Location)]) mempty
instance GHC.Records.HasField "status" Test2Response Network.HTTP.Types.Status where
getField (Test2Response201 {}) = Network.HTTP.Types.status201
---------------------
Test/Schemas/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -629,6 +647,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -502,6 +504,7 @@ class ToResponse a where
Test/Response/ListPackages.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -527,6 +530,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -543,10 +547,14 @@ data ListPackagesResponse
instance ToResponse ListPackagesResponse where
toResponse (ListPackagesResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackagesResponse Network.HTTP.Types.Status where
getField (ListPackagesResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -572,6 +580,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -588,10 +597,14 @@ data ListPackages2Response
instance ToResponse ListPackages2Response where
toResponse (ListPackages2Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages2Response Network.HTTP.Types.Status where
getField (ListPackages2Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages3.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -617,6 +630,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -633,10 +647,14 @@ data ListPackages3Response
instance ToResponse ListPackages3Response where
toResponse (ListPackages3Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages3Response Network.HTTP.Types.Status where
getField (ListPackages3Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages4.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -662,6 +680,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -678,10 +697,14 @@ data ListPackages4Response
instance ToResponse ListPackages4Response where
toResponse (ListPackages4Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages4Response Network.HTTP.Types.Status where
getField (ListPackages4Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages5.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -707,6 +730,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -723,10 +747,14 @@ data ListPackages5Response
instance ToResponse ListPackages5Response where
toResponse (ListPackages5Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages5Response Network.HTTP.Types.Status where
getField (ListPackages5Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Inline.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -752,6 +780,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -787,6 +816,7 @@ type Inline = [ InlineElem ]
Test/Schemas/Package.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -812,6 +842,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -845,6 +876,7 @@ instance Data.Aeson.FromJSON Package where
Test/Schemas/Packages.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -870,6 +902,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -438,6 +440,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -463,6 +466,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -479,10 +483,14 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -508,6 +516,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -438,6 +440,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -463,6 +466,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -481,6 +485,9 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
test.cabal

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -468,6 +470,7 @@ class ToResponse a where
Test/Response/ListPackages.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -493,6 +496,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -509,10 +513,14 @@ data ListPackagesResponse
instance ToResponse ListPackagesResponse where
toResponse (ListPackagesResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackagesResponse Network.HTTP.Types.Status where
getField (ListPackagesResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -538,6 +546,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -554,10 +563,14 @@ data ListPackages2Response
instance ToResponse ListPackages2Response where
toResponse (ListPackages2Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages2Response Network.HTTP.Types.Status where
getField (ListPackages2Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/ListPackages3.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -583,6 +596,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -599,10 +613,14 @@ data ListPackages3Response
instance ToResponse ListPackages3Response where
toResponse (ListPackages3Response200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPackages3Response Network.HTTP.Types.Status where
getField (ListPackages3Response200 {}) = Network.HTTP.Types.status200
---------------------
Test/Schemas/Inline.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -628,6 +646,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -682,6 +701,7 @@ instance Data.Aeson.FromJSON Inline where
Test/Schemas/Inline2.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -707,6 +727,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -778,6 +799,7 @@ instance Data.Aeson.FromJSON Inline2 where
Test/Schemas/Package.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -803,6 +825,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -900,6 +923,7 @@ instance Data.Aeson.FromJSON Package where
Test/Schemas/Pet.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -925,6 +949,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -958,6 +983,7 @@ instance Data.Aeson.FromJSON Pet where
Test/Schemas/PetOrPackage.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -983,6 +1009,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -469,6 +471,7 @@ class ToResponse a where
Test/Response/CreatePets.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -494,6 +497,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -513,10 +517,15 @@ instance ToResponse CreatePetsResponse where
Network.Wai.responseBuilder Network.HTTP.Types.status201 ([]) mempty
toResponse (CreatePetsDefaultResponse status x) =
Network.Wai.responseBuilder status ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" CreatePetsResponse Network.HTTP.Types.Status where
getField (CreatePetsResponse201 {}) = Network.HTTP.Types.status201
getField (CreatePetsDefaultResponse status _) = status
---------------------
Test/Response/ListPets.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -542,6 +551,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -562,10 +572,15 @@ instance ToResponse ListPetsResponse where
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([("x-next", Web.HttpApiData.toHeader __x_next) | Just __x_next <- [__x_next]] ++ [(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
toResponse (ListPetsDefaultResponse status x) =
Network.Wai.responseBuilder status ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ListPetsResponse Network.HTTP.Types.Status where
getField (ListPetsResponse200 {}) = Network.HTTP.Types.status200
getField (ListPetsDefaultResponse status _) = status
---------------------
Test/Response/ShowPetById.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -591,6 +606,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -611,10 +627,15 @@ instance ToResponse ShowPetByIdResponse where
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
toResponse (ShowPetByIdDefaultResponse status x) =
Network.Wai.responseBuilder status ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" ShowPetByIdResponse Network.HTTP.Types.Status where
getField (ShowPetByIdResponse200 {}) = Network.HTTP.Types.status200
getField (ShowPetByIdDefaultResponse status _) = status
---------------------
Test/Schemas/Error.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -640,6 +661,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -677,6 +699,7 @@ instance Data.Aeson.FromJSON Error where
Test/Schemas/Pet.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -702,6 +725,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -742,6 +766,7 @@ instance Data.Aeson.FromJSON Pet where
Test/Schemas/Pets.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -767,6 +792,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -472,6 +474,7 @@ class ToResponse a where
Test/Response/CreateUser.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -497,6 +500,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -555,10 +559,14 @@ data CreateUserResponse
instance ToResponse CreateUserResponse where
toResponse (CreateUserResponse200 x) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" CreateUserResponse Network.HTTP.Types.Status where
getField (CreateUserResponse200 {}) = Network.HTTP.Types.status200
---------------------
Test/Response/GetUser.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -584,6 +592,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -603,10 +612,15 @@ instance ToResponse GetUserResponse where
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
toResponse (GetUserResponse404) =
Network.Wai.responseBuilder Network.HTTP.Types.status404 ([]) mempty
instance GHC.Records.HasField "status" GetUserResponse Network.HTTP.Types.Status where
getField (GetUserResponse200 {}) = Network.HTTP.Types.status200
getField (GetUserResponse404 {}) = Network.HTTP.Types.status404
---------------------
Test/Schemas/Car.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -632,6 +646,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -680,6 +695,7 @@ instance Data.Aeson.FromJSON Car where
Test/Schemas/NISE.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -705,6 +721,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -774,6 +791,7 @@ instance Data.Aeson.FromJSON NISE where
Test/Schemas/PackageId.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -799,6 +817,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -923,6 +942,7 @@ instance Data.Aeson.FromJSON PackageId where
Test/Schemas/Plane.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -948,6 +968,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -1006,6 +1027,7 @@ instance Data.Aeson.FromJSON Plane where
Test/Schemas/Vehicle.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -1031,6 +1053,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai

View File

@ -1,6 +1,7 @@
Test/Api.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -26,6 +27,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -438,6 +440,7 @@ class ToResponse a where
Test/Response/Test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -463,6 +466,7 @@ import qualified Data.Time
import qualified Data.Text.Encoding
import qualified GHC.Float
import qualified GHC.Int
import qualified GHC.Records
import qualified GHC.Types
import qualified Network.HTTP.Types
import qualified Network.Wai
@ -481,6 +485,9 @@ data TestResponse
instance ToResponse TestResponse where
toResponse (TestResponse200 x __Set_Cookie __NULSet_Cookie) =
Network.Wai.responseBuilder Network.HTTP.Types.status200 ([("Set-Cookie", Web.HttpApiData.toHeader __Set_Cookie) | Just __Set_Cookie <- [__Set_Cookie]] ++ [("Set-Cookie", Web.HttpApiData.toHeader __NULSet_Cookie) | Just __NULSet_Cookie <- [__NULSet_Cookie]] ++ [(Network.HTTP.Types.hContentType, "application/json")]) (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x))
instance GHC.Records.HasField "status" TestResponse Network.HTTP.Types.Status where
getField (TestResponse200 {}) = Network.HTTP.Types.status200
---------------------
test.cabal