git.iko.soy/typeable/swagger2
on master help sign in
Bump dependencies, drop aesonQQ
647ba3fOleg Grenrus
stack.yaml+3−4
@@ -1,7 +1,6 @@
1−resolver: lts-11.14
1+resolver: lts-12.10
2packages:
2packages:
3- '.'
3- '.'
4extra-deps:
4extra-deps:
5−- aeson-1.3.1.0
6−- base-compat-0.10.1
7−- base-compat-batteries-0.10.1
5+- base-compat-batteries-0.10.4
6+- contravariant-1.5
swagger2.cabal+28−19
@@ -1,8 +1,9 @@
1cabal-version: >=1.10
1cabal-version: >=1.10
2name: swagger2
2name: swagger2
3−version: 2.3
3+version: 2.3.0.1
4
4
5synopsis: Swagger 2.0 data model
5synopsis: Swagger 2.0 data model
6+category: Web, Swagger
6description:
7description:
7 This library is inteded to be used for decoding and encoding Swagger 2.0 API
8 This library is inteded to be used for decoding and encoding Swagger 2.0 API
8 specifications as well as manipulating them.
9 specifications as well as manipulating them.
@@ -16,14 +17,19 @@ license-file: LICENSE
16author: Nickolay Kudasov
17author: Nickolay Kudasov
17maintainer: nickolay@getshoptv.com
18maintainer: nickolay@getshoptv.com
18copyright: (c) 2015-2016, GetShopTV
19copyright: (c) 2015-2016, GetShopTV
19−category: Web, Swagger
20build-type: Custom
20build-type: Custom
21extra-source-files:
21extra-source-files:
22 README.md
22 README.md
23 , CHANGELOG.md
23 , CHANGELOG.md
24 , examples/*.hs
24 , examples/*.hs
25 , include/overlapping-compat.h
25 , include/overlapping-compat.h
26−tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.1
26+tested-with:
27+ GHC ==7.8.4
28+ || ==7.10.3
29+ || ==8.0.2
30+ || ==8.2.2
31+ || ==8.4.3
32+ || ==8.6.1
27
33
28custom-setup
34custom-setup
29 setup-depends:
35 setup-depends:
@@ -53,12 +59,12 @@ library
53
59
54 -- GHC boot libraries
60 -- GHC boot libraries
55 build-depends:
61 build-depends:
56− base >=4.7 && <4.13
62+ base >=4.7 && <4.13
57− , bytestring >=0.10.4 && <0.11
63+ , bytestring >=0.10.4.0 && <0.11
58− , containers >=0.5.5.1 && <0.7
64+ , containers >=0.5.5.1 && <0.7
59− , template-haskell >=2.9.0.0 && <2.15
65+ , template-haskell >=2.9.0.0 && <2.15
60− , time >=1.4.2 && <1.9
66+ , time >=1.4.2 && <1.9
61− , transformers >=0.3.0.0 && <0.6
67+ , transformers >=0.3.0.0 && <0.6
62
68
63 build-depends:
69 build-depends:
64 mtl >=2.1 && <2.3
70 mtl >=2.1 && <2.3
@@ -66,18 +72,18 @@ library
66
72
67 -- other dependencies
73 -- other dependencies
68 build-depends:
74 build-depends:
69− base-compat-batteries >=0.10.1 && <0.11
75+ base-compat-batteries >=0.10.4 && <0.11
70− , aeson >=1.0.0.0 && <1.5
76+ , aeson >=1.3.1.1 && <1.5
71 , generics-sop >=0.3.2.0 && <0.4
77 , generics-sop >=0.3.2.0 && <0.4
72 , hashable >=1.2.7.0 && <1.3
78 , hashable >=1.2.7.0 && <1.3
73 , http-media >=0.7.1.2 && <0.8
79 , http-media >=0.7.1.2 && <0.8
74− , insert-ordered-containers >=0.1.0.0 && <0.3
80+ , insert-ordered-containers >=0.2.1.0 && <0.3
75 , lens >=4.16.1 && <4.18
81 , lens >=4.16.1 && <4.18
76 , network >=2.6.3.5 && <2.8
82 , network >=2.6.3.5 && <2.8
77− , scientific >=0.3.5.3 && <0.4
83+ , scientific >=0.3.6.2 && <0.4
78 , transformers-compat >=0.3 && <0.7
84 , transformers-compat >=0.3 && <0.7
79 , unordered-containers >=0.2.9.0 && <0.3
85 , unordered-containers >=0.2.9.0 && <0.3
80− , uuid-types >=1.0.2 && <1.1
86+ , uuid-types >=1.0.3 && <1.1
81 , vector >=0.12.0.1 && <0.13
87 , vector >=0.12.0.1 && <0.13
82
88
83 default-language: Haskell2010
89 default-language: Haskell2010
@@ -100,6 +106,7 @@ test-suite spec
100 , insert-ordered-containers
106 , insert-ordered-containers
101 , lens
107 , lens
102 , mtl
108 , mtl
109+ , template-haskell
103 , text
110 , text
104 , time
111 , time
105 , unordered-containers
112 , unordered-containers
@@ -107,15 +114,15 @@ test-suite spec
107
114
108 -- test-suite only dependencies
115 -- test-suite only dependencies
109 build-depends:
116 build-depends:
110− aeson-qq >=0.8.2 && <0.9
111− , hspec >=2.4.8 && <2.6
117+ hspec >=2.5.5 && <2.6
112 , HUnit >=1.6.0.0 && <1.7
118 , HUnit >=1.6.0.0 && <1.7
113− , QuickCheck >=2.10.1 && <2.12
119+ , QuickCheck >=2.11.3 && <2.12
114− , quickcheck-instances >=0.3.18 && <0.14
120+ , quickcheck-instances >=0.3.19 && <0.14
121+ , utf8-string >=1.0.1.1 && <1.1
115
122
116 -- https://github.com/haskell/cabal/issues/3708
123 -- https://github.com/haskell/cabal/issues/3708
117 build-tool-depends:
124 build-tool-depends:
118− hspec-discover:hspec-discover >=2.4.8 && <2.6
125+ hspec-discover:hspec-discover >=2.5.5 && <2.6
119
126
120 other-modules:
127 other-modules:
121 SpecCommon
128 SpecCommon
@@ -124,6 +131,8 @@ test-suite spec
124 Data.Swagger.ParamSchemaSpec
131 Data.Swagger.ParamSchemaSpec
125 Data.Swagger.SchemaSpec
132 Data.Swagger.SchemaSpec
126 Data.Swagger.Schema.ValidationSpec
133 Data.Swagger.Schema.ValidationSpec
134+
135+ Data.Aeson.QQ.Simple
127 default-language: Haskell2010
136 default-language: Haskell2010
128
137
129test-suite doctests
138test-suite doctests
test/Data/Aeson/QQ/Simple.hsnew file+45
@@ -0,0 +1,45 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+-- | Like "Data.Aeson.QQ" but without interpolation.
3+module Data.Aeson.QQ.Simple where
4+
5+import Data.Aeson
6+import Data.ByteString.Lazy.UTF8 as UTF8
7+import qualified Data.HashMap.Strict as HM
8+import qualified Data.Text as T
9+import qualified Data.Vector as V
10+import Language.Haskell.TH
11+import Language.Haskell.TH.Quote
12+import Language.Haskell.TH.Syntax (Lift (..))
13+import Prelude ()
14+import Prelude.Compat
15+
16+aesonQQ :: QuasiQuoter
17+aesonQQ = QuasiQuoter
18+ { quoteExp = aesonExp
19+ , quotePat = const $ error "No quotePat defined for jsonQQ"
20+ , quoteType = const $ error "No quoteType defined for jsonQQ"
21+ , quoteDec = const $ error "No quoteDec defined for jsonQQ"
22+ }
23+
24+aesonExp :: String -> ExpQ
25+aesonExp txt =
26+ case eitherDecode $ UTF8.fromString txt of
27+ Left err -> error $ "Error in aesonExp: " ++ show err
28+ Right val -> liftValue val
29+
30+liftValue :: Value -> ExpQ
31+liftValue (String str) = [| String $(liftText str) |]
32+liftValue Null = [| Null |]
33+liftValue (Number n) = [| Number (fromRational $(return $ LitE $ RationalL (toRational n))) |]
34+liftValue (Bool b) = [| Bool b |]
35+liftValue (Array arr) = [| Array $ V.fromList $(ListE <$> traverse liftValue (V.toList arr)) |]
36+liftValue (Object obj) = [| object $jsList |]
37+ where
38+ jsList :: ExpQ
39+ jsList = ListE <$> traverse objs2list (HM.toList obj)
40+
41+ objs2list :: (T.Text, Value) -> ExpQ
42+ objs2list (key, value) = [| ($(liftText key), $(liftValue value)) |]
43+
44+liftText :: T.Text -> ExpQ
45+liftText t = [| T.pack $(lift $ T.unpack t) |]
test/Data/Swagger/CommonTestTypes.hs+1−1
@@ -8,7 +8,7 @@ import Prelude ()
8import Prelude.Compat
8import Prelude.Compat
9
9
10import Data.Aeson (ToJSON (..), ToJSONKey (..), Value)
10import Data.Aeson (ToJSON (..), ToJSONKey (..), Value)
11−import Data.Aeson.QQ
11+import Data.Aeson.QQ.Simple
12import Data.Aeson.Types (toJSONKeyText)
12import Data.Aeson.Types (toJSONKeyText)
13import Data.Char
13import Data.Char
14import Data.Map (Map)
14import Data.Map (Map)
test/Data/Swagger/ParamSchemaSpec.hs+1−1
@@ -6,7 +6,7 @@
6module Data.Swagger.ParamSchemaSpec where
6module Data.Swagger.ParamSchemaSpec where
7
7
8import Data.Aeson (Value)
8import Data.Aeson (Value)
9−import Data.Aeson.QQ
9+import Data.Aeson.QQ.Simple
10import Data.Char
10import Data.Char
11import Data.Proxy
11import Data.Proxy
12import GHC.Generics
12import GHC.Generics
test/Data/Swagger/SchemaSpec.hs+1−1
@@ -10,7 +10,7 @@ import Prelude.Compat
10import Control.Lens ((^.))
10import Control.Lens ((^.))
11import Data.Aeson (Value, ToJSON(..), ToJSONKey(..))
11import Data.Aeson (Value, ToJSON(..), ToJSONKey(..))
12import Data.Aeson.Types (toJSONKeyText)
12import Data.Aeson.Types (toJSONKeyText)
13−import Data.Aeson.QQ
13+import Data.Aeson.QQ.Simple
14import Data.Char
14import Data.Char
15import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
15import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
16import Data.Proxy
16import Data.Proxy
test/Data/SwaggerSpec.hs+1−1
@@ -10,7 +10,7 @@ import Prelude.Compat
10import Control.Lens
10import Control.Lens
11
11
12import Data.Aeson
12import Data.Aeson
13−import Data.Aeson.QQ
13+import Data.Aeson.QQ.Simple
14import Data.HashMap.Strict (HashMap)
14import Data.HashMap.Strict (HashMap)
15import qualified Data.Set as Set
15import qualified Data.Set as Set
16import Data.Text (Text)
16import Data.Text (Text)