git.iko.soy/typeable/openapi3
on master help sign in
Cleanup stuff after GHC-8.10
44ad73cOleg Grenrus
.ghcideleted−2
@@ -1,2 +0,0 @@
1−:set -itest -isrc -optP-include -optP.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/autogen/cabal_macros.h -optP-I -optPinclude
2−:set -hide-package base-compat-0.10.4
.travis.yml+55−62
@@ -2,11 +2,17 @@
2#
2#
3# haskell-ci '--branches' 'master' '--haddock-jobs=>=8.4' '--output' '.travis.yml' 'swagger2.cabal'
3# haskell-ci '--branches' 'master' '--haddock-jobs=>=8.4' '--output' '.travis.yml' 'swagger2.cabal'
4#
4#
5+# To regenerate the script (for example after adjusting tested-with) run
6+#
7+# haskell-ci regenerate
8+#
5# For more information, see https://github.com/haskell-CI/haskell-ci
9# For more information, see https://github.com/haskell-CI/haskell-ci
6#
10#
7−# version: 0.5.20191020
11+# version: 0.10
8#
12#
13+version: ~> 1.0
9language: c
14language: c
15+os: linux
10dist: xenial
16dist: xenial
11git:
17git:
12 # whether to recursively clone submodules
18 # whether to recursively clone submodules
@@ -18,6 +24,7 @@ cache:
18 directories:
24 directories:
19 - $HOME/.cabal/packages
25 - $HOME/.cabal/packages
20 - $HOME/.cabal/store
26 - $HOME/.cabal/store
27+ - $HOME/.hlint
21before_cache:
28before_cache:
22 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
29 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
23 # remove files that are regenerated by 'cabal update'
30 # remove files that are regenerated by 'cabal update'
@@ -27,18 +34,26 @@ before_cache:
27 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
34 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
28 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
35 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
29 - rm -rfv $CABALHOME/packages/head.hackage
36 - rm -rfv $CABALHOME/packages/head.hackage
30−matrix:
37+jobs:
31 include:
38 include:
39+ - compiler: ghc-8.10.1
40+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}
41+ os: linux
32 - compiler: ghc-8.8.1
42 - compiler: ghc-8.8.1
33− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
43+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.1","cabal-install-3.2"]}}
44+ os: linux
34 - compiler: ghc-8.6.5
45 - compiler: ghc-8.6.5
35− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
46+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}
47+ os: linux
36 - compiler: ghc-8.4.4
48 - compiler: ghc-8.4.4
37− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
49+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
50+ os: linux
38 - compiler: ghc-8.2.2
51 - compiler: ghc-8.2.2
39− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
52+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}
53+ os: linux
40 - compiler: ghc-8.0.2
54 - compiler: ghc-8.0.2
41− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
55+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}
56+ os: linux
42before_install:
57before_install:
43 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
58 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
44 - WITHCOMPILER="-w $HC"
59 - WITHCOMPILER="-w $HC"
@@ -51,57 +66,31 @@ before_install:
51 - TOP=$(pwd)
66 - TOP=$(pwd)
52 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
67 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
53 - echo $HCNUMVER
68 - echo $HCNUMVER
54− - CABAL="$CABAL -vnormal+nowrap+markoutput"
69+ - CABAL="$CABAL -vnormal+nowrap"
55 - set -o pipefail
70 - set -o pipefail
56− - |
57− echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
58− echo 'BEGIN { state = "output"; }' >> .colorful.awk
59− echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
60− echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
61− echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
62− echo ' if (state == "cabal") {' >> .colorful.awk
63− echo ' print blue($0)' >> .colorful.awk
64− echo ' } else {' >> .colorful.awk
65− echo ' print $0' >> .colorful.awk
66− echo ' }' >> .colorful.awk
67− echo '}' >> .colorful.awk
68− - cat .colorful.awk
69− - |
70− color_cabal_output () {
71− awk -f $TOP/.colorful.awk
72− }
73− - echo text | color_cabal_output
74−install:
75− - ${CABAL} --version
76− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
77 - TEST=--enable-tests
71 - TEST=--enable-tests
78 - BENCH=--enable-benchmarks
72 - BENCH=--enable-benchmarks
79 - HEADHACKAGE=false
73 - HEADHACKAGE=false
80 - rm -f $CABALHOME/config
74 - rm -f $CABALHOME/config
81 - |
75 - |
82− echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
76+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
83− echo "remote-build-reporting: anonymous" >> $CABALHOME/config
77+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
84− echo "write-ghc-environment-files: always" >> $CABALHOME/config
78+ echo "write-ghc-environment-files: always" >> $CABALHOME/config
85− echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
79+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
86− echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
80+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
87− echo "world-file: $CABALHOME/world" >> $CABALHOME/config
81+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
88− echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
82+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
89− echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
83+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
90− echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
84+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
91− echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
85+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
92− echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
86+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
93− echo "install-dirs user" >> $CABALHOME/config
87+ echo "install-dirs user" >> $CABALHOME/config
94− echo " prefix: $CABALHOME" >> $CABALHOME/config
88+ echo " prefix: $CABALHOME" >> $CABALHOME/config
95− echo "repository hackage.haskell.org" >> $CABALHOME/config
89+ echo "repository hackage.haskell.org" >> $CABALHOME/config
96− echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
90+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
97− echo " secure: True" >> $CABALHOME/config
91+install:
98− echo " key-threshold: 3" >> $CABALHOME/config
92+ - ${CABAL} --version
99− echo " root-keys:" >> $CABALHOME/config
93+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
100− echo " fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0" >> $CABALHOME/config
101− echo " 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42" >> $CABALHOME/config
102− echo " 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3" >> $CABALHOME/config
103− echo " 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d" >> $CABALHOME/config
104− echo " 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921" >> $CABALHOME/config
105 - |
94 - |
106 echo "program-default-options" >> $CABALHOME/config
95 echo "program-default-options" >> $CABALHOME/config
107 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
96 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
@@ -113,20 +102,22 @@ install:
113 - touch cabal.project
102 - touch cabal.project
114 - |
103 - |
115 echo "packages: ." >> cabal.project
104 echo "packages: ." >> cabal.project
105+ - if [ $HCNUMVER -ge 80200 ] ; then echo 'package swagger2' >> cabal.project ; fi
106+ - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
116 - |
107 - |
117 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(swagger2)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
108 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(swagger2)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
118 - cat cabal.project || true
109 - cat cabal.project || true
119 - cat cabal.project.local || true
110 - cat cabal.project.local || true
120 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
111 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
121− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
112+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
122 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
113 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
123 - rm cabal.project.freeze
114 - rm cabal.project.freeze
124− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
115+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
125− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
116+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
126script:
117script:
127 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
118 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
128 # Packaging...
119 # Packaging...
129− - ${CABAL} v2-sdist all | color_cabal_output
120+ - ${CABAL} v2-sdist all
130 # Unpacking...
121 # Unpacking...
131 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
122 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
132 - cd ${DISTDIR} || false
123 - cd ${DISTDIR} || false
@@ -138,25 +129,27 @@ script:
138 - touch cabal.project
129 - touch cabal.project
139 - |
130 - |
140 echo "packages: ${PKGDIR_swagger2}" >> cabal.project
131 echo "packages: ${PKGDIR_swagger2}" >> cabal.project
132+ - if [ $HCNUMVER -ge 80200 ] ; then echo 'package swagger2' >> cabal.project ; fi
133+ - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
141 - |
134 - |
142 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(swagger2)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
135 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(swagger2)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
143 - cat cabal.project || true
136 - cat cabal.project || true
144 - cat cabal.project.local || true
137 - cat cabal.project.local || true
145 # Building...
138 # Building...
146 # this builds all libraries and executables (without tests/benchmarks)
139 # this builds all libraries and executables (without tests/benchmarks)
147− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
140+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
148 # Building with tests and benchmarks...
141 # Building with tests and benchmarks...
149 # build & run tests, build benchmarks
142 # build & run tests, build benchmarks
150− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
151 # Testing...
144 # Testing...
152− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
153 # cabal check...
146 # cabal check...
154 - (cd ${PKGDIR_swagger2} && ${CABAL} -vnormal check)
147 - (cd ${PKGDIR_swagger2} && ${CABAL} -vnormal check)
155 # haddock...
148 # haddock...
156− - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output ; fi
149+ - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi
157 # Building without installed constraints for packages in global-db...
150 # Building without installed constraints for packages in global-db...
158 - rm -f cabal.project.local
151 - rm -f cabal.project.local
159− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
152+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
160
153
161−# REGENDATA ("0.5.20191020",["--branches","master","--haddock-jobs=>=8.4","--output",".travis.yml","swagger2.cabal"])
154+# REGENDATA ("0.10",["--branches","master","--haddock-jobs=>=8.4","--output",".travis.yml","swagger2.cabal"])
162# EOF
155# EOF
CHANGELOG.md+8
@@ -1,3 +1,11 @@
1+2.6.1
2+-----
3+
4+- More GHC-8.10 related cleanup, tighten lower bound on some dependencies.
5+ (see [#216]( https://github.com/GetShopTV/swagger2/pull/216 ));
6+- Add "format" field for uint32 and uint64
7+ (see [#215]( https://github.com/GetShopTV/swagger2/pull/215 ));
8+
12.6
92.6
2---
10---
3
11
include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
src/Data/Swagger.hs+2−23
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2-- |
1-- |
3-- Module: Data.Swagger
2-- Module: Data.Swagger
4-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
3-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
@@ -295,21 +294,6 @@ import Data.Swagger.Internal
295--
294--
296-- we can not derive a valid schema for a mix of the above. The following will result in a type error
295-- we can not derive a valid schema for a mix of the above. The following will result in a type error
297--
296--
298−#if __GLASGOW_HASKELL__ < 800
299−-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
300−-- >>> instance ToSchema BadMixedType
301−-- ...
302−-- ... error:
303−-- ... • No instance for (Data.Swagger.Internal.TypeShape.CannotDeriveSchemaForMixedSumType
304−-- ... BadMixedType)
305−-- ... arising from a use of ‘Data.Swagger.Internal.Schema.$dmdeclareNamedSchema’
306−-- ... • In the expression:
307−-- ... Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
308−-- ... In an equation for ‘declareNamedSchema’:
309−-- ... declareNamedSchema
310−-- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
311−-- ... In the instance declaration for ‘ToSchema BadMixedType’
312−#else
313-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
297-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
314-- >>> instance ToSchema BadMixedType
298-- >>> instance ToSchema BadMixedType
315-- ...
299-- ...
@@ -320,13 +304,8 @@ import Data.Swagger.Internal
320-- ... Use genericDeclareNamedSchemaUnrestricted if you want to derive schema
304-- ... Use genericDeclareNamedSchemaUnrestricted if you want to derive schema
321-- ... that matches aeson's Generic-based toJSON,
305-- ... that matches aeson's Generic-based toJSON,
322-- ... but that's not supported by some Swagger tools.
306-- ... but that's not supported by some Swagger tools.
323−-- ... • In the expression:
307+-- ...
324−-- ... Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
325−-- ... In an equation for ‘declareNamedSchema’:
326−-- ... declareNamedSchema
327−-- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
328−-- ... In the instance declaration for ‘ToSchema BadMixedType’
308+-- ... In the instance declaration for ‘ToSchema BadMixedType’
329−#endif
330--
309--
331-- We can use 'genericDeclareNamedSchemaUnrestricted' to try our best to represent this type as a Swagger Schema and match 'ToJSON':
310-- We can use 'genericDeclareNamedSchemaUnrestricted' to try our best to represent this type as a Swagger Schema and match 'ToJSON':
332--
311--
src/Data/Swagger/Declare.hs+3−3
@@ -60,7 +60,7 @@ instance (Applicative m, Monad m, Monoid d) => Monad (DeclareT d m) where
60 return (mappend d' d'', y)
60 return (mappend d' d'', y)
61
61
62instance Monoid d => MonadTrans (DeclareT d) where
62instance Monoid d => MonadTrans (DeclareT d) where
63− lift m = DeclareT (\_ -> (,) mempty `liftM` m)
63+ lift m = DeclareT (\_ -> (,) mempty <$> m)
64
64
65-- |
65-- |
66-- Definitions of @declare@ and @look@ must satisfy the following laws:
66-- Definitions of @declare@ and @look@ must satisfy the following laws:
@@ -103,12 +103,12 @@ looks f = f <$> look
103-- | Evaluate @'DeclareT' d m a@ computation,
103-- | Evaluate @'DeclareT' d m a@ computation,
104-- ignoring new output @d@.
104-- ignoring new output @d@.
105evalDeclareT :: Monad m => DeclareT d m a -> d -> m a
105evalDeclareT :: Monad m => DeclareT d m a -> d -> m a
106−evalDeclareT (DeclareT f) d = snd `liftM` f d
106+evalDeclareT (DeclareT f) d = snd <$> f d
107
107
108-- | Execute @'DeclateT' d m a@ computation,
108-- | Execute @'DeclateT' d m a@ computation,
109-- ignoring result and only producing new output @d@.
109-- ignoring result and only producing new output @d@.
110execDeclareT :: Monad m => DeclareT d m a -> d -> m d
110execDeclareT :: Monad m => DeclareT d m a -> d -> m d
111−execDeclareT (DeclareT f) d = fst `liftM` f d
111+execDeclareT (DeclareT f) d = fst <$> f d
112
112
113-- | Evaluate @'DeclareT' d m a@ computation,
113-- | Evaluate @'DeclareT' d m a@ computation,
114-- starting with empty output history.
114-- starting with empty output history.
src/Data/Swagger/Internal.hs+31−42
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
4{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE DeriveFunctor #-}
@@ -15,10 +14,6 @@
15{-# LANGUAGE TemplateHaskell #-}
14{-# LANGUAGE TemplateHaskell #-}
16{-# LANGUAGE TypeFamilies #-}
15{-# LANGUAGE TypeFamilies #-}
17{-# LANGUAGE UndecidableInstances #-}
16{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ <710
19−{-# LANGUAGE PolyKinds #-}
20−#endif
21−#include "overlapping-compat.h"
22module Data.Swagger.Internal where
17module Data.Swagger.Internal where
23
18
24import Prelude ()
19import Prelude ()
@@ -58,13 +53,7 @@ import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToJSON
58 ,saoAdditionalPairs
53 ,saoAdditionalPairs
59 ,saoSubObject)
54 ,saoSubObject)
60import Data.Swagger.Internal.Utils
55import Data.Swagger.Internal.Utils
61−
62−#if MIN_VERSION_aeson(0,10,0)
63import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToEncoding)
56import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToEncoding)
64−#define DEFINE_TOENCODING toEncoding = sopSwaggerGenericToEncoding
65−#else
66−#define DEFINE_TOENCODING
67−#endif
68
57
69-- $setup
58-- $setup
70-- >>> :seti -XDataKinds
59-- >>> :seti -XDataKinds
@@ -416,7 +405,7 @@ instance Data (SwaggerItems 'SwaggerKindParamOtherSchema) where
416 dataTypeOf _ = swaggerItemsDataType
405 dataTypeOf _ = swaggerItemsDataType
417
406
418instance Data (SwaggerItems 'SwaggerKindSchema) where
407instance Data (SwaggerItems 'SwaggerKindSchema) where
419− gfoldl _ _ (SwaggerItemsPrimitive _ _) = error $ " Data.Data.gfoldl: Constructor SwaggerItemsPrimitive used to construct SwaggerItems SwaggerKindSchema"
408+ gfoldl _ _ (SwaggerItemsPrimitive _ _) = error " Data.Data.gfoldl: Constructor SwaggerItemsPrimitive used to construct SwaggerItems SwaggerKindSchema"
420 gfoldl k z (SwaggerItemsObject ref) = z SwaggerItemsObject `k` ref
409 gfoldl k z (SwaggerItemsObject ref) = z SwaggerItemsObject `k` ref
421 gfoldl k z (SwaggerItemsArray ref) = z SwaggerItemsArray `k` ref
410 gfoldl k z (SwaggerItemsArray ref) = z SwaggerItemsArray `k` ref
422
411
@@ -832,6 +821,23 @@ data AdditionalProperties
832 | AdditionalPropertiesSchema (Referenced Schema)
821 | AdditionalPropertiesSchema (Referenced Schema)
833 deriving (Eq, Show, Data, Typeable)
822 deriving (Eq, Show, Data, Typeable)
834
823
824+-------------------------------------------------------------------------------
825+-- Generic instances
826+-------------------------------------------------------------------------------
827+
828+deriveGeneric ''Header
829+deriveGeneric ''OAuth2Params
830+deriveGeneric ''Operation
831+deriveGeneric ''Param
832+deriveGeneric ''ParamOtherSchema
833+deriveGeneric ''PathItem
834+deriveGeneric ''Response
835+deriveGeneric ''Responses
836+deriveGeneric ''SecurityScheme
837+deriveGeneric ''Schema
838+deriveGeneric ''ParamSchema
839+deriveGeneric ''Swagger
840+
835-- =======================================================================
841-- =======================================================================
836-- Monoid instances
842-- Monoid instances
837-- =======================================================================
843-- =======================================================================
@@ -928,7 +934,7 @@ instance Semigroup SecurityDefinitions where
928 SecurityDefinitions $ InsOrdHashMap.unionWith (<>) sd1 sd2
934 SecurityDefinitions $ InsOrdHashMap.unionWith (<>) sd1 sd2
929
935
930instance Monoid SecurityDefinitions where
936instance Monoid SecurityDefinitions where
931− mempty = SecurityDefinitions $ InsOrdHashMap.empty
937+ mempty = SecurityDefinitions InsOrdHashMap.empty
932 mappend = (<>)
938 mappend = (<>)
933
939
934-- =======================================================================
940-- =======================================================================
@@ -959,7 +965,7 @@ instance SwaggerMonoid ParamLocation where
959 swaggerMempty = ParamQuery
965 swaggerMempty = ParamQuery
960 swaggerMappend _ y = y
966 swaggerMappend _ y = y
961
967
962−instance OVERLAPPING_ SwaggerMonoid (InsOrdHashMap FilePath PathItem) where
968+instance {-# OVERLAPPING #-} SwaggerMonoid (InsOrdHashMap FilePath PathItem) where
963 swaggerMempty = InsOrdHashMap.empty
969 swaggerMempty = InsOrdHashMap.empty
964 swaggerMappend = InsOrdHashMap.unionWith mappend
970 swaggerMappend = InsOrdHashMap.unionWith mappend
965
971
@@ -1060,7 +1066,7 @@ instance ToJSON OAuth2Flow where
1060
1066
1061instance ToJSON OAuth2Params where
1067instance ToJSON OAuth2Params where
1062 toJSON = sopSwaggerGenericToJSON
1068 toJSON = sopSwaggerGenericToJSON
1063− DEFINE_TOENCODING
1069+ toEncoding = sopSwaggerGenericToEncoding
1064
1070
1065instance ToJSON SecuritySchemeType where
1071instance ToJSON SecuritySchemeType where
1066 toJSON SecuritySchemeBasic
1072 toJSON SecuritySchemeBasic
@@ -1074,19 +1080,19 @@ instance ToJSON SecuritySchemeType where
1074
1080
1075instance ToJSON Swagger where
1081instance ToJSON Swagger where
1076 toJSON = sopSwaggerGenericToJSON
1082 toJSON = sopSwaggerGenericToJSON
1077− DEFINE_TOENCODING
1083+ toEncoding = sopSwaggerGenericToEncoding
1078
1084
1079instance ToJSON SecurityScheme where
1085instance ToJSON SecurityScheme where
1080 toJSON = sopSwaggerGenericToJSON
1086 toJSON = sopSwaggerGenericToJSON
1081− DEFINE_TOENCODING
1087+ toEncoding = sopSwaggerGenericToEncoding
1082
1088
1083instance ToJSON Schema where
1089instance ToJSON Schema where
1084 toJSON = sopSwaggerGenericToJSON
1090 toJSON = sopSwaggerGenericToJSON
1085− DEFINE_TOENCODING
1091+ toEncoding = sopSwaggerGenericToEncoding
1086
1092
1087instance ToJSON Header where
1093instance ToJSON Header where
1088 toJSON = sopSwaggerGenericToJSON
1094 toJSON = sopSwaggerGenericToJSON
1089− DEFINE_TOENCODING
1095+ toEncoding = sopSwaggerGenericToEncoding
1090
1096
1091-- | As for nullary schema for 0-arity type constructors, see
1097-- | As for nullary schema for 0-arity type constructors, see
1092-- <https://github.com/GetShopTV/swagger2/issues/167>.
1098-- <https://github.com/GetShopTV/swagger2/issues/167>.
@@ -1117,7 +1123,7 @@ instance ToJSON MimeList where
1117
1123
1118instance ToJSON Param where
1124instance ToJSON Param where
1119 toJSON = sopSwaggerGenericToJSON
1125 toJSON = sopSwaggerGenericToJSON
1120− DEFINE_TOENCODING
1126+ toEncoding = sopSwaggerGenericToEncoding
1121
1127
1122instance ToJSON ParamAnySchema where
1128instance ToJSON ParamAnySchema where
1123 toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
1129 toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
@@ -1125,23 +1131,23 @@ instance ToJSON ParamAnySchema where
1125
1131
1126instance ToJSON ParamOtherSchema where
1132instance ToJSON ParamOtherSchema where
1127 toJSON = sopSwaggerGenericToJSON
1133 toJSON = sopSwaggerGenericToJSON
1128− DEFINE_TOENCODING
1134+ toEncoding = sopSwaggerGenericToEncoding
1129
1135
1130instance ToJSON Responses where
1136instance ToJSON Responses where
1131 toJSON = sopSwaggerGenericToJSON
1137 toJSON = sopSwaggerGenericToJSON
1132− DEFINE_TOENCODING
1138+ toEncoding = sopSwaggerGenericToEncoding
1133
1139
1134instance ToJSON Response where
1140instance ToJSON Response where
1135 toJSON = sopSwaggerGenericToJSON
1141 toJSON = sopSwaggerGenericToJSON
1136− DEFINE_TOENCODING
1142+ toEncoding = sopSwaggerGenericToEncoding
1137
1143
1138instance ToJSON Operation where
1144instance ToJSON Operation where
1139 toJSON = sopSwaggerGenericToJSON
1145 toJSON = sopSwaggerGenericToJSON
1140− DEFINE_TOENCODING
1146+ toEncoding = sopSwaggerGenericToEncoding
1141
1147
1142instance ToJSON PathItem where
1148instance ToJSON PathItem where
1143 toJSON = sopSwaggerGenericToJSON
1149 toJSON = sopSwaggerGenericToJSON
1144− DEFINE_TOENCODING
1150+ toEncoding = sopSwaggerGenericToEncoding
1145
1151
1146instance ToJSON Example where
1152instance ToJSON Example where
1147 toJSON = toJSON . Map.mapKeys show . getExample
1153 toJSON = toJSON . Map.mapKeys show . getExample
@@ -1367,23 +1373,6 @@ instance FromJSON AdditionalProperties where
1367 parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b
1373 parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b
1368 parseJSON js = AdditionalPropertiesSchema <$> parseJSON js
1374 parseJSON js = AdditionalPropertiesSchema <$> parseJSON js
1369
1375
1370−-------------------------------------------------------------------------------
1371−-- TH splices
1372−-------------------------------------------------------------------------------
1373−
1374−deriveGeneric ''Header
1375−deriveGeneric ''OAuth2Params
1376−deriveGeneric ''Operation
1377−deriveGeneric ''Param
1378−deriveGeneric ''ParamOtherSchema
1379−deriveGeneric ''PathItem
1380−deriveGeneric ''Response
1381−deriveGeneric ''Responses
1382−deriveGeneric ''SecurityScheme
1383−deriveGeneric ''Schema
1384−deriveGeneric ''ParamSchema
1385−deriveGeneric ''Swagger
1386−
1387instance HasSwaggerAesonOptions Header where
1376instance HasSwaggerAesonOptions Header where
1388 swaggerAesonOptions _ = mkSwaggerAesonOptions "header" & saoSubObject ?~ "paramSchema"
1377 swaggerAesonOptions _ = mkSwaggerAesonOptions "header" & saoSubObject ?~ "paramSchema"
1389instance HasSwaggerAesonOptions OAuth2Params where
1378instance HasSwaggerAesonOptions OAuth2Params where
src/Data/Swagger/Internal/AesonUtils.hs−32
@@ -1,20 +1,15 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE GADTs #-}
3{-# LANGUAGE GADTs #-}
5{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE ScopedTypeVariables #-}
6{-# LANGUAGE ExplicitForAll #-}
5{-# LANGUAGE ExplicitForAll #-}
7{-# LANGUAGE TemplateHaskell #-}
6{-# LANGUAGE TemplateHaskell #-}
8−#if __GLASGOW_HASKELL__ >= 800
9{-# LANGUAGE UndecidableSuperClasses #-}
7{-# LANGUAGE UndecidableSuperClasses #-}
10−#endif
11module Data.Swagger.Internal.AesonUtils (
8module Data.Swagger.Internal.AesonUtils (
12 -- * Generic functions
9 -- * Generic functions
13 AesonDefaultValue(..),
10 AesonDefaultValue(..),
14 sopSwaggerGenericToJSON,
11 sopSwaggerGenericToJSON,
15−#if MIN_VERSION_aeson(0,10,0)
16 sopSwaggerGenericToEncoding,
12 sopSwaggerGenericToEncoding,
17−#endif
18 sopSwaggerGenericToJSONWithOpts,
13 sopSwaggerGenericToJSONWithOpts,
19 sopSwaggerGenericParseJSON,
14 sopSwaggerGenericParseJSON,
20 -- * Options
15 -- * Options
@@ -46,9 +41,7 @@ import qualified Data.Set as Set
46import qualified Data.HashMap.Strict.InsOrd as InsOrd
41import qualified Data.HashMap.Strict.InsOrd as InsOrd
47import qualified Data.HashSet.InsOrd as InsOrdHS
42import qualified Data.HashSet.InsOrd as InsOrdHS
48
43
49−#if MIN_VERSION_aeson(0,10,0)
50import Data.Aeson (Encoding, pairs, (.=), Series)
44import Data.Aeson (Encoding, pairs, (.=), Series)
51−#endif
52
45
53-------------------------------------------------------------------------------
46-------------------------------------------------------------------------------
54-- SwaggerAesonOptions
47-- SwaggerAesonOptions
@@ -146,11 +139,7 @@ sopSwaggerGenericToJSON'
146 -> DatatypeInfo '[xs]
139 -> DatatypeInfo '[xs]
147 -> POP Maybe '[xs]
140 -> POP Maybe '[xs]
148 -> [Pair]
141 -> [Pair]
149−#if MIN_VERSION_generics_sop(0,5,0)
150sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
142sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
151−#else
152−sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
153−#endif
154 sopSwaggerGenericToJSON'' opts fields fieldsInfo defs
143 sopSwaggerGenericToJSON'' opts fields fieldsInfo defs
155sopSwaggerGenericToJSON' _ _ _ _ = error "sopSwaggerGenericToJSON: unsupported type"
144sopSwaggerGenericToJSON' _ _ _ _ = error "sopSwaggerGenericToJSON: unsupported type"
156
145
@@ -179,9 +168,6 @@ sopSwaggerGenericToJSON'' (SwaggerAesonOptions prefix _ sub) = go
179 json = toJSON x
168 json = toJSON x
180 name' = fieldNameModifier name
169 name' = fieldNameModifier name
181 rest = go xs names defs
170 rest = go xs names defs
182−#if __GLASGOW_HASKELL__ < 800
183− go _ _ _ = error "not empty"
184−#endif
185
171
186 fieldNameModifier = modifier . drop 1
172 fieldNameModifier = modifier . drop 1
187 modifier = lowerFirstUppers . drop (length prefix)
173 modifier = lowerFirstUppers . drop (length prefix)
@@ -226,11 +212,7 @@ sopSwaggerGenericParseJSON'
226 -> DatatypeInfo '[xs]
212 -> DatatypeInfo '[xs]
227 -> POP Maybe '[xs]
213 -> POP Maybe '[xs]
228 -> Parser (SOP I '[xs])
214 -> Parser (SOP I '[xs])
229−#if MIN_VERSION_generics_sop(0,5,0)
230sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
215sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
231−#else
232−sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
233−#endif
234 SOP . Z <$> sopSwaggerGenericParseJSON'' opts obj fieldsInfo defs
216 SOP . Z <$> sopSwaggerGenericParseJSON'' opts obj fieldsInfo defs
235sopSwaggerGenericParseJSON' _ _ _ _ = error "sopSwaggerGenericParseJSON: unsupported type"
217sopSwaggerGenericParseJSON' _ _ _ _ = error "sopSwaggerGenericParseJSON: unsupported type"
236
218
@@ -260,9 +242,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go
260 withDef = case def of
242 withDef = case def of
261 Just def' -> (<|> pure def')
243 Just def' -> (<|> pure def')
262 Nothing -> id
244 Nothing -> id
263−#if __GLASGOW_HASKELL__ < 800
264− go _ _ = error "not empty"
265−#endif
266
245
267 fieldNameModifier = modifier . drop 1
246 fieldNameModifier = modifier . drop 1
268 modifier = lowerFirstUppers . drop (length prefix)
247 modifier = lowerFirstUppers . drop (length prefix)
@@ -273,8 +252,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go
273-- ToEncoding
252-- ToEncoding
274-------------------------------------------------------------------------------
253-------------------------------------------------------------------------------
275
254
276−#if MIN_VERSION_aeson(0,10,0)
277−
278sopSwaggerGenericToEncoding
255sopSwaggerGenericToEncoding
279 :: forall a xs.
256 :: forall a xs.
280 ( HasDatatypeInfo a
257 ( HasDatatypeInfo a
@@ -302,11 +279,7 @@ sopSwaggerGenericToEncoding'
302 -> DatatypeInfo '[xs]
279 -> DatatypeInfo '[xs]
303 -> POP Maybe '[xs]
280 -> POP Maybe '[xs]
304 -> Series
281 -> Series
305−#if MIN_VERSION_generics_sop(0,5,0)
306sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
282sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
307−#else
308−sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
309−#endif
310 sopSwaggerGenericToEncoding'' opts fields fieldsInfo defs
283 sopSwaggerGenericToEncoding'' opts fields fieldsInfo defs
311sopSwaggerGenericToEncoding' _ _ _ _ = error "sopSwaggerGenericToEncoding: unsupported type"
284sopSwaggerGenericToEncoding' _ _ _ _ = error "sopSwaggerGenericToEncoding: unsupported type"
312
285
@@ -334,13 +307,8 @@ sopSwaggerGenericToEncoding'' (SwaggerAesonOptions prefix _ sub) = go
334 where
307 where
335 name' = fieldNameModifier name
308 name' = fieldNameModifier name
336 rest = go xs names defs
309 rest = go xs names defs
337−#if __GLASGOW_HASKELL__ < 800
338− go _ _ _ = error "not empty"
339−#endif
340
310
341 fieldNameModifier = modifier . drop 1
311 fieldNameModifier = modifier . drop 1
342 modifier = lowerFirstUppers . drop (length prefix)
312 modifier = lowerFirstUppers . drop (length prefix)
343 lowerFirstUppers s = map toLower x ++ y
313 lowerFirstUppers s = map toLower x ++ y
344 where (x, y) = span isUpper s
314 where (x, y) = span isUpper s
345−
346−#endif
src/Data/Swagger/Internal/ParamSchema.hs+1−12
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DefaultSignatures #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -12,13 +11,10 @@
12{-# LANGUAGE TypeOperators #-}
11{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE TypeSynonymInstances #-}
12{-# LANGUAGE TypeSynonymInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
13{-# LANGUAGE UndecidableInstances #-}
15−#if __GLASGOW_HASKELL__ >= 800
16-- Generic a is redundant in ToParamSchema a default imple
14-- Generic a is redundant in ToParamSchema a default imple
17{-# OPTIONS_GHC -Wno-redundant-constraints #-}
15{-# OPTIONS_GHC -Wno-redundant-constraints #-}
18-- For TypeErrors
16-- For TypeErrors
19{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
17{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
20−#endif
21−#include "overlapping-compat.h"
22module Data.Swagger.Internal.ParamSchema where
18module Data.Swagger.Internal.ParamSchema where
23
19
24import Control.Lens
20import Control.Lens
@@ -49,12 +45,9 @@ import Data.Swagger.Internal
49import Data.Swagger.Lens
45import Data.Swagger.Lens
50import Data.Swagger.SchemaOptions
46import Data.Swagger.SchemaOptions
51
47
52−#if __GLASGOW_HASKELL__ < 800
53−#else
54import qualified Data.ByteString as BS
48import qualified Data.ByteString as BS
55import qualified Data.ByteString.Lazy as BSL
49import qualified Data.ByteString.Lazy as BSL
56import GHC.TypeLits (TypeError, ErrorMessage(..))
50import GHC.TypeLits (TypeError, ErrorMessage(..))
57−#endif
58
51
59-- | Default schema for binary data (any sequence of octets).
52-- | Default schema for binary data (any sequence of octets).
60binaryParamSchema :: ParamSchema t
53binaryParamSchema :: ParamSchema t
@@ -119,7 +112,7 @@ class ToParamSchema a where
119 default toParamSchema :: (Generic a, GToParamSchema (Rep a)) => Proxy a -> ParamSchema t
112 default toParamSchema :: (Generic a, GToParamSchema (Rep a)) => Proxy a -> ParamSchema t
120 toParamSchema = genericToParamSchema defaultSchemaOptions
113 toParamSchema = genericToParamSchema defaultSchemaOptions
121
114
122−instance OVERLAPPING_ ToParamSchema String where
115+instance {-# OVERLAPPING #-} ToParamSchema String where
123 toParamSchema _ = mempty & type_ ?~ SwaggerString
116 toParamSchema _ = mempty & type_ ?~ SwaggerString
124
117
125instance ToParamSchema Bool where
118instance ToParamSchema Bool where
@@ -239,9 +232,6 @@ instance ToParamSchema SetCookie where
239 toParamSchema _ = mempty
232 toParamSchema _ = mempty
240 & type_ ?~ SwaggerString
233 & type_ ?~ SwaggerString
241
234
242−
243−#if __GLASGOW_HASKELL__ < 800
244−#else
245type family ToParamSchemaByteStringError bs where
235type family ToParamSchemaByteStringError bs where
246 ToParamSchemaByteStringError bs = TypeError
236 ToParamSchemaByteStringError bs = TypeError
247 ( 'Text "Impossible to have an instance " :<>: ShowType (ToParamSchema bs) :<>: Text "."
237 ( 'Text "Impossible to have an instance " :<>: ShowType (ToParamSchema bs) :<>: Text "."
@@ -250,7 +240,6 @@ type family ToParamSchemaByteStringError bs where
250
240
251instance ToParamSchemaByteStringError BS.ByteString => ToParamSchema BS.ByteString where toParamSchema = error "impossible"
241instance ToParamSchemaByteStringError BS.ByteString => ToParamSchema BS.ByteString where toParamSchema = error "impossible"
252instance ToParamSchemaByteStringError BSL.ByteString => ToParamSchema BSL.ByteString where toParamSchema = error "impossible"
242instance ToParamSchemaByteStringError BSL.ByteString => ToParamSchema BSL.ByteString where toParamSchema = error "impossible"
253−#endif
254
243
255instance ToParamSchema All where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
244instance ToParamSchema All where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
256instance ToParamSchema Any where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
245instance ToParamSchema Any where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
src/Data/Swagger/Internal/Schema.hs+10−40
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DefaultSignatures #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -15,13 +14,9 @@
15{-# LANGUAGE TypeOperators #-}
14{-# LANGUAGE TypeOperators #-}
16{-# LANGUAGE TypeSynonymInstances #-}
15{-# LANGUAGE TypeSynonymInstances #-}
17{-# LANGUAGE UndecidableInstances #-}
16{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
19−-- Few generics related redundant constraints
20{-# OPTIONS_GHC -Wno-redundant-constraints #-}
17{-# OPTIONS_GHC -Wno-redundant-constraints #-}
21-- For TypeErrors
18-- For TypeErrors
22{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
19{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
23−#endif
24−#include "overlapping-compat.h"
25module Data.Swagger.Internal.Schema where
20module Data.Swagger.Internal.Schema where
26
21
27import Prelude ()
22import Prelude ()
@@ -71,12 +66,9 @@ import qualified Data.Swagger.Lens as Swagger
71import Data.Swagger.SchemaOptions
66import Data.Swagger.SchemaOptions
72import Data.Swagger.Internal.TypeShape
67import Data.Swagger.Internal.TypeShape
73
68
74−#if __GLASGOW_HASKELL__ < 800
75−#else
76import qualified Data.ByteString as BS
69import qualified Data.ByteString as BS
77import qualified Data.ByteString.Lazy as BSL
70import qualified Data.ByteString.Lazy as BSL
78import GHC.TypeLits (TypeError, ErrorMessage(..))
71import GHC.TypeLits (TypeError, ErrorMessage(..))
79−#endif
80
72
81unnamed :: Schema -> NamedSchema
73unnamed :: Schema -> NamedSchema
82unnamed schema = NamedSchema Nothing schema
74unnamed schema = NamedSchema Nothing schema
@@ -416,14 +408,14 @@ sketchStrictSchema = go . toJSON
416class GToSchema (f :: * -> *) where
408class GToSchema (f :: * -> *) where
417 gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
409 gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
418
410
419−instance OVERLAPPABLE_ ToSchema a => ToSchema [a] where
411+instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where
420 declareNamedSchema _ = do
412 declareNamedSchema _ = do
421 ref <- declareSchemaRef (Proxy :: Proxy a)
413 ref <- declareSchemaRef (Proxy :: Proxy a)
422 return $ unnamed $ mempty
414 return $ unnamed $ mempty
423 & type_ ?~ SwaggerArray
415 & type_ ?~ SwaggerArray
424 & items ?~ SwaggerItemsObject ref
416 & items ?~ SwaggerItemsObject ref
425
417
426−instance OVERLAPPING_ ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
418+instance {-# OVERLAPPING #-} ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
427instance ToSchema Bool where declareNamedSchema = plain . paramSchemaToSchema
419instance ToSchema Bool where declareNamedSchema = plain . paramSchemaToSchema
428instance ToSchema Integer where declareNamedSchema = plain . paramSchemaToSchema
420instance ToSchema Integer where declareNamedSchema = plain . paramSchemaToSchema
429instance ToSchema Natural where declareNamedSchema = plain . paramSchemaToSchema
421instance ToSchema Natural where declareNamedSchema = plain . paramSchemaToSchema
@@ -505,8 +497,6 @@ instance ToSchema TL.Text where declareNamedSchema = plain . paramSchemaToSchema
505
497
506instance ToSchema Version where declareNamedSchema = plain . paramSchemaToSchema
498instance ToSchema Version where declareNamedSchema = plain . paramSchemaToSchema
507
499
508−#if __GLASGOW_HASKELL__ < 800
509−#else
510type family ToSchemaByteStringError bs where
500type family ToSchemaByteStringError bs where
511 ToSchemaByteStringError bs = TypeError
501 ToSchemaByteStringError bs = TypeError
512 ( Text "Impossible to have an instance " :<>: ShowType (ToSchema bs) :<>: Text "."
502 ( Text "Impossible to have an instance " :<>: ShowType (ToSchema bs) :<>: Text "."
@@ -515,7 +505,6 @@ type family ToSchemaByteStringError bs where
515
505
516instance ToSchemaByteStringError BS.ByteString => ToSchema BS.ByteString where declareNamedSchema = error "impossible"
506instance ToSchemaByteStringError BS.ByteString => ToSchema BS.ByteString where declareNamedSchema = error "impossible"
517instance ToSchemaByteStringError BSL.ByteString => ToSchema BSL.ByteString where declareNamedSchema = error "impossible"
507instance ToSchemaByteStringError BSL.ByteString => ToSchema BSL.ByteString where declareNamedSchema = error "impossible"
518−#endif
519
508
520instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Set Int))
509instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Set Int))
521
510
@@ -523,7 +512,6 @@ instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy
523instance ToSchema a => ToSchema (IntMap a) where
512instance ToSchema a => ToSchema (IntMap a) where
524 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
513 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
525
514
526−#if MIN_VERSION_aeson(1,0,0)
527instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
515instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
528 declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction k of
516 declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction k of
529 ToJSONKeyText _ _ -> declareObjectMapSchema
517 ToJSONKeyText _ _ -> declareObjectMapSchema
@@ -538,25 +526,7 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
538instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
526instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
539 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
527 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
540
528
541−#else
542−
543−instance ToSchema a => ToSchema (Map String a) where
544− declareNamedSchema _ = do
545− schema <- declareSchemaRef (Proxy :: Proxy a)
546− return $ unnamed $ mempty
547− & type_ ?~ SwaggerObject
548− & additionalProperties ?~ schema
549−
550−instance ToSchema a => ToSchema (Map T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
551−instance ToSchema a => ToSchema (Map TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
552−
553−instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
554−instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
555−instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
556−
557−#endif
558−
559−instance OVERLAPPING_ ToSchema Object where
529+instance {-# OVERLAPPING #-} ToSchema Object where
560 declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty
530 declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty
561 & type_ ?~ SwaggerObject
531 & type_ ?~ SwaggerObject
562 & description ?~ "Arbitrary JSON object."
532 & description ?~ "Arbitrary JSON object."
@@ -738,10 +708,10 @@ instance (Datatype d, GToSchema f) => GToSchema (D1 d f) where
738 where
708 where
739 name = gdatatypeSchemaName opts (Proxy :: Proxy d)
709 name = gdatatypeSchemaName opts (Proxy :: Proxy d)
740
710
741−instance OVERLAPPABLE_ GToSchema f => GToSchema (C1 c f) where
711+instance {-# OVERLAPPABLE #-} GToSchema f => GToSchema (C1 c f) where
742 gdeclareNamedSchema opts _ = gdeclareNamedSchema opts (Proxy :: Proxy f)
712 gdeclareNamedSchema opts _ = gdeclareNamedSchema opts (Proxy :: Proxy f)
743
713
744−instance OVERLAPPING_ Constructor c => GToSchema (C1 c U1) where
714+instance {-# OVERLAPPING #-} Constructor c => GToSchema (C1 c U1) where
745 gdeclareNamedSchema = gdeclareNamedSumSchema
715 gdeclareNamedSchema = gdeclareNamedSumSchema
746
716
747-- | Single field constructor.
717-- | Single field constructor.
@@ -804,17 +774,17 @@ withFieldSchema opts _ isRequiredField schema = do
804 fname = T.pack (fieldLabelModifier opts (selName (Proxy3 :: Proxy3 s f p)))
774 fname = T.pack (fieldLabelModifier opts (selName (Proxy3 :: Proxy3 s f p)))
805
775
806-- | Optional record fields.
776-- | Optional record fields.
807−instance OVERLAPPING_ (Selector s, ToSchema c) => GToSchema (S1 s (K1 i (Maybe c))) where
777+instance {-# OVERLAPPING #-} (Selector s, ToSchema c) => GToSchema (S1 s (K1 i (Maybe c))) where
808 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s (K1 i (Maybe c))) False
778 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s (K1 i (Maybe c))) False
809
779
810-- | Record fields.
780-- | Record fields.
811−instance OVERLAPPABLE_ (Selector s, GToSchema f) => GToSchema (S1 s f) where
781+instance {-# OVERLAPPABLE #-} (Selector s, GToSchema f) => GToSchema (S1 s f) where
812 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s f) True
782 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s f) True
813
783
814−instance OVERLAPPING_ ToSchema c => GToSchema (K1 i (Maybe c)) where
784+instance {-# OVERLAPPING #-} ToSchema c => GToSchema (K1 i (Maybe c)) where
815 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
785 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
816
786
817−instance OVERLAPPABLE_ ToSchema c => GToSchema (K1 i c) where
787+instance {-# OVERLAPPABLE #-} ToSchema c => GToSchema (K1 i c) where
818 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
788 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
819
789
820instance ( GSumToSchema f
790instance ( GSumToSchema f
@@ -859,7 +829,7 @@ gsumConToSchema opts proxy schema = do
859 ref <- gdeclareSchemaRef opts proxy
829 ref <- gdeclareSchemaRef opts proxy
860 return $ gsumConToSchemaWith ref opts proxy schema
830 return $ gsumConToSchemaWith ref opts proxy schema
861
831
862−instance OVERLAPPABLE_ (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where
832+instance {-# OVERLAPPABLE #-} (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where
863 gsumToSchema opts proxy schema = do
833 gsumToSchema opts proxy schema = do
864 tell (All False)
834 tell (All False)
865 lift $ gsumConToSchema opts proxy schema
835 lift $ gsumConToSchema opts proxy schema
src/Data/Swagger/Internal/TypeShape.hs−10
@@ -1,7 +1,5 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
4−{-# LANGUAGE KindSignatures #-}
5{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE TypeOperators #-}
7{-# LANGUAGE UndecidableInstances #-}
5{-# LANGUAGE UndecidableInstances #-}
@@ -37,11 +35,6 @@ type family TypeHasSimpleShape t (f :: Symbol) :: Constraint where
37type family GenericHasSimpleShape t (f :: Symbol) (s :: TypeShape) :: Constraint where
35type family GenericHasSimpleShape t (f :: Symbol) (s :: TypeShape) :: Constraint where
38 GenericHasSimpleShape t f Enumeration = ()
36 GenericHasSimpleShape t f Enumeration = ()
39 GenericHasSimpleShape t f SumOfProducts = ()
37 GenericHasSimpleShape t f SumOfProducts = ()
40−#if __GLASGOW_HASKELL__ < 800
41− GenericHasSimpleShape t f Mixed = CannotDeriveSchemaForMixedSumType t
42−
43−class CannotDeriveSchemaForMixedSumType t where
44−#else
45 GenericHasSimpleShape t f Mixed =
38 GenericHasSimpleShape t f Mixed =
46 TypeError
39 TypeError
47 ( Text "Cannot derive Generic-based Swagger Schema for " :<>: ShowType t
40 ( Text "Cannot derive Generic-based Swagger Schema for " :<>: ShowType t
@@ -51,7 +44,6 @@ class CannotDeriveSchemaForMixedSumType t where
51 :$$: Text "that matches aeson's Generic-based toJSON,"
44 :$$: Text "that matches aeson's Generic-based toJSON,"
52 :$$: Text "but that's not supported by some Swagger tools."
45 :$$: Text "but that's not supported by some Swagger tools."
53 )
46 )
54−#endif
55
47
56-- | Infer a 'TypeShape' for a generic representation of a type.
48-- | Infer a 'TypeShape' for a generic representation of a type.
57type family GenericShape (g :: * -> *) :: TypeShape
49type family GenericShape (g :: * -> *) :: TypeShape
@@ -62,5 +54,3 @@ type instance GenericShape (D1 d f) = GenericShape f
62type instance GenericShape (C1 c U1) = Enumeration
54type instance GenericShape (C1 c U1) = Enumeration
63type instance GenericShape (C1 c (S1 s f)) = SumOfProducts
55type instance GenericShape (C1 c (S1 s f)) = SumOfProducts
64type instance GenericShape (C1 c (f :*: g)) = SumOfProducts
56type instance GenericShape (C1 c (f :*: g)) = SumOfProducts
65−
66−
src/Data/Swagger/Lens.hs+14−22
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE FlexibleContexts #-}
1{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FunctionalDependencies #-}
3{-# LANGUAGE FunctionalDependencies #-}
@@ -10,7 +9,6 @@
10{-# LANGUAGE DataKinds #-}
9{-# LANGUAGE DataKinds #-}
11{-# LANGUAGE UndecidableInstances #-}
10{-# LANGUAGE UndecidableInstances #-}
12{-# OPTIONS_GHC -fno-warn-orphans #-}
11{-# OPTIONS_GHC -fno-warn-orphans #-}
13−#include "overlapping-compat.h"
14-- |
12-- |
15-- Module: Data.Swagger.Lens
13-- Module: Data.Swagger.Lens
16-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
14-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
@@ -118,69 +116,63 @@ instance HasDefault ParamOtherSchema (Maybe Value) where default_ = paramSchema.
118-- OVERLAPPABLE instances
116-- OVERLAPPABLE instances
119
117
120instance
118instance
121−#if __GLASGOW_HASKELL__ >= 710
119+ {-# OVERLAPPABLE #-}
122− OVERLAPPABLE_
123−#endif
124 HasParamSchema s (ParamSchema t)
120 HasParamSchema s (ParamSchema t)
125 => HasFormat s (Maybe Format) where
121 => HasFormat s (Maybe Format) where
126 format = paramSchema.format
122 format = paramSchema.format
127
123
128instance
124instance
129−#if __GLASGOW_HASKELL__ >= 710
125+ {-# OVERLAPPABLE #-}
130− OVERLAPPABLE_
131−#endif
132 HasParamSchema s (ParamSchema t)
126 HasParamSchema s (ParamSchema t)
133 => HasItems s (Maybe (SwaggerItems t)) where
127 => HasItems s (Maybe (SwaggerItems t)) where
134 items = paramSchema.items
128 items = paramSchema.items
135
129
136instance
130instance
137−#if __GLASGOW_HASKELL__ >= 710
131+ {-# OVERLAPPABLE #-}
138− OVERLAPPABLE_
139−#endif
140 HasParamSchema s (ParamSchema t)
132 HasParamSchema s (ParamSchema t)
141 => HasMaximum s (Maybe Scientific) where
133 => HasMaximum s (Maybe Scientific) where
142 maximum_ = paramSchema.maximum_
134 maximum_ = paramSchema.maximum_
143
135
144−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
136+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
145 => HasExclusiveMaximum s (Maybe Bool) where
137 => HasExclusiveMaximum s (Maybe Bool) where
146 exclusiveMaximum = paramSchema.exclusiveMaximum
138 exclusiveMaximum = paramSchema.exclusiveMaximum
147
139
148−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
140+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
149 => HasMinimum s (Maybe Scientific) where
141 => HasMinimum s (Maybe Scientific) where
150 minimum_ = paramSchema.minimum_
142 minimum_ = paramSchema.minimum_
151
143
152−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
144+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
153 => HasExclusiveMinimum s (Maybe Bool) where
145 => HasExclusiveMinimum s (Maybe Bool) where
154 exclusiveMinimum = paramSchema.exclusiveMinimum
146 exclusiveMinimum = paramSchema.exclusiveMinimum
155
147
156−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
148+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
157 => HasMaxLength s (Maybe Integer) where
149 => HasMaxLength s (Maybe Integer) where
158 maxLength = paramSchema.maxLength
150 maxLength = paramSchema.maxLength
159
151
160−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
152+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
161 => HasMinLength s (Maybe Integer) where
153 => HasMinLength s (Maybe Integer) where
162 minLength = paramSchema.minLength
154 minLength = paramSchema.minLength
163
155
164−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
156+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
165 => HasPattern s (Maybe Text) where
157 => HasPattern s (Maybe Text) where
166 pattern = paramSchema.pattern
158 pattern = paramSchema.pattern
167
159
168−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
160+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
169 => HasMaxItems s (Maybe Integer) where
161 => HasMaxItems s (Maybe Integer) where
170 maxItems = paramSchema.maxItems
162 maxItems = paramSchema.maxItems
171
163
172−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
164+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
173 => HasMinItems s (Maybe Integer) where
165 => HasMinItems s (Maybe Integer) where
174 minItems = paramSchema.minItems
166 minItems = paramSchema.minItems
175
167
176−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
168+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
177 => HasUniqueItems s (Maybe Bool) where
169 => HasUniqueItems s (Maybe Bool) where
178 uniqueItems = paramSchema.uniqueItems
170 uniqueItems = paramSchema.uniqueItems
179
171
180−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
172+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
181 => HasEnum s (Maybe [Value]) where
173 => HasEnum s (Maybe [Value]) where
182 enum_ = paramSchema.enum_
174 enum_ = paramSchema.enum_
183
175
184−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
176+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
185 => HasMultipleOf s (Maybe Scientific) where
177 => HasMultipleOf s (Maybe Scientific) where
186 multipleOf = paramSchema.multipleOf
178 multipleOf = paramSchema.multipleOf
src/Data/Swagger/Schema/Generator.hs−1
@@ -13,7 +13,6 @@ import Data.Aeson
13import Data.Aeson.Types
13import Data.Aeson.Types
14import qualified Data.HashMap.Strict.InsOrd as M
14import qualified Data.HashMap.Strict.InsOrd as M
15import Data.Maybe
15import Data.Maybe
16−import Data.Maybe
17import Data.Proxy
16import Data.Proxy
18import Data.Scientific
17import Data.Scientific
19import qualified Data.Set as S
18import qualified Data.Set as S
swagger2.cabal+12−15
@@ -1,6 +1,6 @@
1cabal-version: >=1.10
1cabal-version: >=1.10
2name: swagger2
2name: swagger2
3−version: 2.6
3+version: 2.6.1
4
4
5synopsis: Swagger 2.0 data model
5synopsis: Swagger 2.0 data model
6category: Web, Swagger
6category: Web, Swagger
@@ -22,7 +22,6 @@ extra-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
26tested-with:
25tested-with:
27 GHC ==8.0.2
26 GHC ==8.0.2
28 || ==8.2.2
27 || ==8.2.2
@@ -37,7 +36,6 @@ custom-setup
37
36
38library
37library
39 hs-source-dirs: src
38 hs-source-dirs: src
40− include-dirs: include
41 exposed-modules:
39 exposed-modules:
42 Data.Swagger
40 Data.Swagger
43 Data.Swagger.Declare
41 Data.Swagger.Declare
@@ -61,38 +59,37 @@ library
61
59
62 -- GHC boot libraries
60 -- GHC boot libraries
63 build-depends:
61 build-depends:
64− base >=4.9 && <4.15
62+ base >=4.9 && <4.15
65− , bytestring >=0.10.4.0 && <0.11
63+ , bytestring >=0.10.8.1 && <0.11
66− , containers >=0.5.5.1 && <0.7
64+ , containers >=0.5.7.1 && <0.7
67− , template-haskell >=2.9.0.0 && <2.17
65+ , template-haskell >=2.11.1.0 && <2.17
68− , time >=1.4.2 && <1.10
66+ , time >=1.6.0.1 && <1.10
69− , transformers >=0.3.0.0 && <0.6
67+ , transformers >=0.5.2.0 && <0.6
70
68
71 build-depends:
69 build-depends:
72− mtl >=2.1 && <2.3
70+ mtl >=2.2.2 && <2.3
73 , text >=1.2.3.0 && <1.3
71 , text >=1.2.3.0 && <1.3
74
72
75 -- other dependencies
73 -- other dependencies
76 build-depends:
74 build-depends:
77− base-compat-batteries >=0.10.4 && <0.12
75+ base-compat-batteries >=0.11.1 && <0.12
78 , aeson >=1.4.2.0 && <1.5
76 , aeson >=1.4.2.0 && <1.5
79 , aeson-pretty >=0.8.7 && <0.9
77 , aeson-pretty >=0.8.7 && <0.9
80 -- cookie 0.4.3 is needed by GHC 7.8 due to time>=1.4 constraint
78 -- cookie 0.4.3 is needed by GHC 7.8 due to time>=1.4 constraint
81 , cookie >=0.4.3 && <0.5
79 , cookie >=0.4.3 && <0.5
82− , generics-sop >=0.3.2.0 && <0.6
80+ , generics-sop >=0.5.1.0 && <0.6
83 , hashable >=1.2.7.0 && <1.4
81 , hashable >=1.2.7.0 && <1.4
84− , http-media >=0.7.1.2 && <0.9
82+ , http-media >=0.8.0.0 && <0.9
85 , insert-ordered-containers >=0.2.3 && <0.3
83 , insert-ordered-containers >=0.2.3 && <0.3
86 , lens >=4.16.1 && <4.20
84 , lens >=4.16.1 && <4.20
87 , network >=2.6.3.5 && <3.2
85 , network >=2.6.3.5 && <3.2
88 , optics-core >=0.2 && <0.4
86 , optics-core >=0.2 && <0.4
89 , optics-th >=0.2 && <0.4
87 , optics-th >=0.2 && <0.4
90 , scientific >=0.3.6.2 && <0.4
88 , scientific >=0.3.6.2 && <0.4
91− , transformers-compat >=0.3 && <0.7
92 , unordered-containers >=0.2.9.0 && <0.3
89 , unordered-containers >=0.2.9.0 && <0.3
93 , uuid-types >=1.0.3 && <1.1
90 , uuid-types >=1.0.3 && <1.1
94 , vector >=0.12.0.1 && <0.13
91 , vector >=0.12.0.1 && <0.13
95− , QuickCheck >=2.10.1 && <2.15
92+ , QuickCheck >=2.10.1 && <2.15
96
93
97 default-language: Haskell2010
94 default-language: Haskell2010
98
95
test/Data/Swagger/Schema/ValidationSpec.hs−1
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DeriveGeneric #-}
1{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE PackageImports #-}
2{-# LANGUAGE PackageImports #-}
4{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE RecordWildCards #-}