git.iko.soy/typeable/openapi3
on master help sign in
Cleanup stuff after GHC-8.10

- Bump lower bounds of boot libraries - Remove (all!) of CPP, including overlapping-compat.h - Make few small cleanups elsewhere - Remove .ghci, use `stack repl` or `cabal repl` - Regenerate .travis.yml

commit44ad73cd0f49c0cd17ad9f9ec4a9fdb3d4e7e776 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSat 16 May 2020, 13:50 (6 years ago) parent023e2ac
15 files changed+136−273
.ghci−2 .travis.yml+55−62 CHANGELOG.md+8 include/overlapping-compat.h−8 src/Data/Swagger.hs+2−23 src/Data/Swagger/Declare.hs+3−3 src/Data/Swagger/Internal.hs+31−42 src/Data/Swagger/Internal/AesonUtils.hs−32 src/Data/Swagger/Internal/ParamSchema.hs+1−12 src/Data/Swagger/Internal/Schema.hs+10−40 src/Data/Swagger/Internal/TypeShape.hs−10 src/Data/Swagger/Lens.hs+14−22 src/Data/Swagger/Schema/Generator.hs−1 swagger2.cabal+12−15 test/Data/Swagger/Schema/ValidationSpec.hs−1
.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 @@
22#
33# haskell-ci '--branches' 'master' '--haddock-jobs=>=8.4' '--output' '.travis.yml' 'swagger2.cabal'
44#
5+# To regenerate the script (for example after adjusting tested-with) run
6+#
7+# haskell-ci regenerate
8+#
59# For more information, see https://github.com/haskell-CI/haskell-ci
610#
7−# version: 0.5.20191020
11+# version: 0.10
812#
13+version: ~> 1.0
914language: c
15+os: linux
1016dist: xenial
1117git:
1218 # whether to recursively clone submodules
@@ -18,6 +24,7 @@ cache:
1824 directories:
1925 - $HOME/.cabal/packages
2026 - $HOME/.cabal/store
27+ - $HOME/.hlint
2128before_cache:
2229 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2330 # remove files that are regenerated by 'cabal update'
@@ -27,18 +34,26 @@ before_cache:
2734 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2835 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
2936 - rm -rfv $CABALHOME/packages/head.hackage
30−matrix:
37+jobs:
3138 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
3242 - 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
3445 - 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
3648 - 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
3851 - 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
4054 - 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
4257before_install:
4358 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
4459 - WITHCOMPILER="-w $HC"
@@ -51,57 +66,31 @@ before_install:
5166 - TOP=$(pwd)
5267 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
5368 - echo $HCNUMVER
54− - CABAL="$CABAL -vnormal+nowrap+markoutput"
69+ - CABAL="$CABAL -vnormal+nowrap"
5570 - 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 '?')]"
7771 - TEST=--enable-tests
7872 - BENCH=--enable-benchmarks
7973 - HEADHACKAGE=false
8074 - rm -f $CABALHOME/config
8175 - |
82− echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
83− echo "remote-build-reporting: anonymous" >> $CABALHOME/config
84− echo "write-ghc-environment-files: always" >> $CABALHOME/config
85− echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
86− echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
87− echo "world-file: $CABALHOME/world" >> $CABALHOME/config
88− echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
89− echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
90− echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
91− echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
92− echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
93− echo "install-dirs user" >> $CABALHOME/config
94− echo " prefix: $CABALHOME" >> $CABALHOME/config
95− echo "repository hackage.haskell.org" >> $CABALHOME/config
96− echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
97− echo " secure: True" >> $CABALHOME/config
98− echo " key-threshold: 3" >> $CABALHOME/config
99− echo " root-keys:" >> $CABALHOME/config
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
76+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
77+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
78+ echo "write-ghc-environment-files: always" >> $CABALHOME/config
79+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
80+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
81+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
82+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
83+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
84+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
85+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
86+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
87+ echo "install-dirs user" >> $CABALHOME/config
88+ echo " prefix: $CABALHOME" >> $CABALHOME/config
89+ echo "repository hackage.haskell.org" >> $CABALHOME/config
90+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
91+install:
92+ - ${CABAL} --version
93+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
10594 - |
10695 echo "program-default-options" >> $CABALHOME/config
10796 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
@@ -113,20 +102,22 @@ install:
113102 - touch cabal.project
114103 - |
115104 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"
116107 - |
117108 - "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"
118109 - cat cabal.project || true
119110 - cat cabal.project.local || true
120111 - 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}
122113 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
123114 - rm cabal.project.freeze
124− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
125− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
115+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
116+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
126117script:
127118 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
128119 # Packaging...
129− - ${CABAL} v2-sdist all | color_cabal_output
120+ - ${CABAL} v2-sdist all
130121 # Unpacking...
131122 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
132123 - cd ${DISTDIR} || false
@@ -138,25 +129,27 @@ script:
138129 - touch cabal.project
139130 - |
140131 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"
141134 - |
142135 - "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"
143136 - cat cabal.project || true
144137 - cat cabal.project.local || true
145138 # Building...
146139 # 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
148141 # Building with tests and benchmarks...
149142 # build & run tests, build benchmarks
150− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
151144 # Testing...
152− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
153146 # cabal check...
154147 - (cd ${PKGDIR_swagger2} && ${CABAL} -vnormal check)
155148 # 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
157150 # Building without installed constraints for packages in global-db...
158151 - 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
160153
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"])
162155# 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+
192.6
210---
311
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 #-}
21-- |
32-- Module: Data.Swagger
43-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
@@ -295,21 +294,6 @@ import Data.Swagger.Internal
295294--
296295-- we can not derive a valid schema for a mix of the above. The following will result in a type error
297296--
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
313297-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
314298-- >>> instance ToSchema BadMixedType
315299-- ...
@@ -320,13 +304,8 @@ import Data.Swagger.Internal
320304-- ... Use genericDeclareNamedSchemaUnrestricted if you want to derive schema
321305-- ... that matches aeson's Generic-based toJSON,
322306-- ... but that's not supported by some Swagger tools.
323−-- ... • In the expression:
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’
329−#endif
307+-- ...
308+-- ... In the instance declaration for ‘ToSchema BadMixedType’
330309--
331310-- We can use 'genericDeclareNamedSchemaUnrestricted' to try our best to represent this type as a Swagger Schema and match 'ToJSON':
332311--
src/Data/Swagger/Declare.hs+3−3
@@ -60,7 +60,7 @@ instance (Applicative m, Monad m, Monoid d) => Monad (DeclareT d m) where
6060 return (mappend d' d'', y)
6161
6262instance Monoid d => MonadTrans (DeclareT d) where
63− lift m = DeclareT (\_ -> (,) mempty `liftM` m)
63+ lift m = DeclareT (\_ -> (,) mempty <$> m)
6464
6565-- |
6666-- Definitions of @declare@ and @look@ must satisfy the following laws:
@@ -103,12 +103,12 @@ looks f = f <$> look
103103-- | Evaluate @'DeclareT' d m a@ computation,
104104-- ignoring new output @d@.
105105evalDeclareT :: 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
107107
108108-- | Execute @'DeclateT' d m a@ computation,
109109-- ignoring result and only producing new output @d@.
110110execDeclareT :: 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
112112
113113-- | Evaluate @'DeclareT' d m a@ computation,
114114-- starting with empty output history.
src/Data/Swagger/Internal.hs+31−42
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DeriveDataTypeable #-}
43{-# LANGUAGE DeriveFunctor #-}
@@ -15,10 +14,6 @@
1514{-# LANGUAGE TemplateHaskell #-}
1615{-# LANGUAGE TypeFamilies #-}
1716{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ <710
19−{-# LANGUAGE PolyKinds #-}
20−#endif
21−#include "overlapping-compat.h"
2217module Data.Swagger.Internal where
2318
2419import Prelude ()
@@ -58,13 +53,7 @@ import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToJSON
5853 ,saoAdditionalPairs
5954 ,saoSubObject)
6055import Data.Swagger.Internal.Utils
61−
62−#if MIN_VERSION_aeson(0,10,0)
6356import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToEncoding)
64−#define DEFINE_TOENCODING toEncoding = sopSwaggerGenericToEncoding
65−#else
66−#define DEFINE_TOENCODING
67−#endif
6857
6958-- $setup
7059-- >>> :seti -XDataKinds
@@ -416,7 +405,7 @@ instance Data (SwaggerItems 'SwaggerKindParamOtherSchema) where
416405 dataTypeOf _ = swaggerItemsDataType
417406
418407instance 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"
420409 gfoldl k z (SwaggerItemsObject ref) = z SwaggerItemsObject `k` ref
421410 gfoldl k z (SwaggerItemsArray ref) = z SwaggerItemsArray `k` ref
422411
@@ -832,6 +821,23 @@ data AdditionalProperties
832821 | AdditionalPropertiesSchema (Referenced Schema)
833822 deriving (Eq, Show, Data, Typeable)
834823
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+
835841-- =======================================================================
836842-- Monoid instances
837843-- =======================================================================
@@ -928,7 +934,7 @@ instance Semigroup SecurityDefinitions where
928934 SecurityDefinitions $ InsOrdHashMap.unionWith (<>) sd1 sd2
929935
930936instance Monoid SecurityDefinitions where
931− mempty = SecurityDefinitions $ InsOrdHashMap.empty
937+ mempty = SecurityDefinitions InsOrdHashMap.empty
932938 mappend = (<>)
933939
934940-- =======================================================================
@@ -959,7 +965,7 @@ instance SwaggerMonoid ParamLocation where
959965 swaggerMempty = ParamQuery
960966 swaggerMappend _ y = y
961967
962−instance OVERLAPPING_ SwaggerMonoid (InsOrdHashMap FilePath PathItem) where
968+instance {-# OVERLAPPING #-} SwaggerMonoid (InsOrdHashMap FilePath PathItem) where
963969 swaggerMempty = InsOrdHashMap.empty
964970 swaggerMappend = InsOrdHashMap.unionWith mappend
965971
@@ -1060,7 +1066,7 @@ instance ToJSON OAuth2Flow where
10601066
10611067instance ToJSON OAuth2Params where
10621068 toJSON = sopSwaggerGenericToJSON
1063− DEFINE_TOENCODING
1069+ toEncoding = sopSwaggerGenericToEncoding
10641070
10651071instance ToJSON SecuritySchemeType where
10661072 toJSON SecuritySchemeBasic
@@ -1074,19 +1080,19 @@ instance ToJSON SecuritySchemeType where
10741080
10751081instance ToJSON Swagger where
10761082 toJSON = sopSwaggerGenericToJSON
1077− DEFINE_TOENCODING
1083+ toEncoding = sopSwaggerGenericToEncoding
10781084
10791085instance ToJSON SecurityScheme where
10801086 toJSON = sopSwaggerGenericToJSON
1081− DEFINE_TOENCODING
1087+ toEncoding = sopSwaggerGenericToEncoding
10821088
10831089instance ToJSON Schema where
10841090 toJSON = sopSwaggerGenericToJSON
1085− DEFINE_TOENCODING
1091+ toEncoding = sopSwaggerGenericToEncoding
10861092
10871093instance ToJSON Header where
10881094 toJSON = sopSwaggerGenericToJSON
1089− DEFINE_TOENCODING
1095+ toEncoding = sopSwaggerGenericToEncoding
10901096
10911097-- | As for nullary schema for 0-arity type constructors, see
10921098-- <https://github.com/GetShopTV/swagger2/issues/167>.
@@ -1117,7 +1123,7 @@ instance ToJSON MimeList where
11171123
11181124instance ToJSON Param where
11191125 toJSON = sopSwaggerGenericToJSON
1120− DEFINE_TOENCODING
1126+ toEncoding = sopSwaggerGenericToEncoding
11211127
11221128instance ToJSON ParamAnySchema where
11231129 toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
@@ -1125,23 +1131,23 @@ instance ToJSON ParamAnySchema where
11251131
11261132instance ToJSON ParamOtherSchema where
11271133 toJSON = sopSwaggerGenericToJSON
1128− DEFINE_TOENCODING
1134+ toEncoding = sopSwaggerGenericToEncoding
11291135
11301136instance ToJSON Responses where
11311137 toJSON = sopSwaggerGenericToJSON
1132− DEFINE_TOENCODING
1138+ toEncoding = sopSwaggerGenericToEncoding
11331139
11341140instance ToJSON Response where
11351141 toJSON = sopSwaggerGenericToJSON
1136− DEFINE_TOENCODING
1142+ toEncoding = sopSwaggerGenericToEncoding
11371143
11381144instance ToJSON Operation where
11391145 toJSON = sopSwaggerGenericToJSON
1140− DEFINE_TOENCODING
1146+ toEncoding = sopSwaggerGenericToEncoding
11411147
11421148instance ToJSON PathItem where
11431149 toJSON = sopSwaggerGenericToJSON
1144− DEFINE_TOENCODING
1150+ toEncoding = sopSwaggerGenericToEncoding
11451151
11461152instance ToJSON Example where
11471153 toJSON = toJSON . Map.mapKeys show . getExample
@@ -1367,23 +1373,6 @@ instance FromJSON AdditionalProperties where
13671373 parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b
13681374 parseJSON js = AdditionalPropertiesSchema <$> parseJSON js
13691375
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−
13871376instance HasSwaggerAesonOptions Header where
13881377 swaggerAesonOptions _ = mkSwaggerAesonOptions "header" & saoSubObject ?~ "paramSchema"
13891378instance HasSwaggerAesonOptions OAuth2Params where
src/Data/Swagger/Internal/AesonUtils.hs−32
@@ -1,20 +1,15 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE FlexibleContexts #-}
43{-# LANGUAGE GADTs #-}
54{-# LANGUAGE ScopedTypeVariables #-}
65{-# LANGUAGE ExplicitForAll #-}
76{-# LANGUAGE TemplateHaskell #-}
8−#if __GLASGOW_HASKELL__ >= 800
97{-# LANGUAGE UndecidableSuperClasses #-}
10−#endif
118module Data.Swagger.Internal.AesonUtils (
129 -- * Generic functions
1310 AesonDefaultValue(..),
1411 sopSwaggerGenericToJSON,
15−#if MIN_VERSION_aeson(0,10,0)
1612 sopSwaggerGenericToEncoding,
17−#endif
1813 sopSwaggerGenericToJSONWithOpts,
1914 sopSwaggerGenericParseJSON,
2015 -- * Options
@@ -46,9 +41,7 @@ import qualified Data.Set as Set
4641import qualified Data.HashMap.Strict.InsOrd as InsOrd
4742import qualified Data.HashSet.InsOrd as InsOrdHS
4843
49−#if MIN_VERSION_aeson(0,10,0)
5044import Data.Aeson (Encoding, pairs, (.=), Series)
51−#endif
5245
5346-------------------------------------------------------------------------------
5447-- SwaggerAesonOptions
@@ -146,11 +139,7 @@ sopSwaggerGenericToJSON'
146139 -> DatatypeInfo '[xs]
147140 -> POP Maybe '[xs]
148141 -> [Pair]
149−#if MIN_VERSION_generics_sop(0,5,0)
150142sopSwaggerGenericToJSON' 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
154143 sopSwaggerGenericToJSON'' opts fields fieldsInfo defs
155144sopSwaggerGenericToJSON' _ _ _ _ = error "sopSwaggerGenericToJSON: unsupported type"
156145
@@ -179,9 +168,6 @@ sopSwaggerGenericToJSON'' (SwaggerAesonOptions prefix _ sub) = go
179168 json = toJSON x
180169 name' = fieldNameModifier name
181170 rest = go xs names defs
182−#if __GLASGOW_HASKELL__ < 800
183− go _ _ _ = error "not empty"
184−#endif
185171
186172 fieldNameModifier = modifier . drop 1
187173 modifier = lowerFirstUppers . drop (length prefix)
@@ -226,11 +212,7 @@ sopSwaggerGenericParseJSON'
226212 -> DatatypeInfo '[xs]
227213 -> POP Maybe '[xs]
228214 -> Parser (SOP I '[xs])
229−#if MIN_VERSION_generics_sop(0,5,0)
230215sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
231−#else
232−sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
233−#endif
234216 SOP . Z <$> sopSwaggerGenericParseJSON'' opts obj fieldsInfo defs
235217sopSwaggerGenericParseJSON' _ _ _ _ = error "sopSwaggerGenericParseJSON: unsupported type"
236218
@@ -260,9 +242,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go
260242 withDef = case def of
261243 Just def' -> (<|> pure def')
262244 Nothing -> id
263−#if __GLASGOW_HASKELL__ < 800
264− go _ _ = error "not empty"
265−#endif
266245
267246 fieldNameModifier = modifier . drop 1
268247 modifier = lowerFirstUppers . drop (length prefix)
@@ -273,8 +252,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go
273252-- ToEncoding
274253-------------------------------------------------------------------------------
275254
276−#if MIN_VERSION_aeson(0,10,0)
277−
278255sopSwaggerGenericToEncoding
279256 :: forall a xs.
280257 ( HasDatatypeInfo a
@@ -302,11 +279,7 @@ sopSwaggerGenericToEncoding'
302279 -> DatatypeInfo '[xs]
303280 -> POP Maybe '[xs]
304281 -> Series
305−#if MIN_VERSION_generics_sop(0,5,0)
306282sopSwaggerGenericToEncoding' 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
310283 sopSwaggerGenericToEncoding'' opts fields fieldsInfo defs
311284sopSwaggerGenericToEncoding' _ _ _ _ = error "sopSwaggerGenericToEncoding: unsupported type"
312285
@@ -334,13 +307,8 @@ sopSwaggerGenericToEncoding'' (SwaggerAesonOptions prefix _ sub) = go
334307 where
335308 name' = fieldNameModifier name
336309 rest = go xs names defs
337−#if __GLASGOW_HASKELL__ < 800
338− go _ _ _ = error "not empty"
339−#endif
340310
341311 fieldNameModifier = modifier . drop 1
342312 modifier = lowerFirstUppers . drop (length prefix)
343313 lowerFirstUppers s = map toLower x ++ y
344314 where (x, y) = span isUpper s
345−
346−#endif
src/Data/Swagger/Internal/ParamSchema.hs+1−12
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DefaultSignatures #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -12,13 +11,10 @@
1211{-# LANGUAGE TypeOperators #-}
1312{-# LANGUAGE TypeSynonymInstances #-}
1413{-# LANGUAGE UndecidableInstances #-}
15−#if __GLASGOW_HASKELL__ >= 800
1614-- Generic a is redundant in ToParamSchema a default imple
1715{-# OPTIONS_GHC -Wno-redundant-constraints #-}
1816-- For TypeErrors
1917{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
20−#endif
21−#include "overlapping-compat.h"
2218module Data.Swagger.Internal.ParamSchema where
2319
2420import Control.Lens
@@ -49,12 +45,9 @@ import Data.Swagger.Internal
4945import Data.Swagger.Lens
5046import Data.Swagger.SchemaOptions
5147
52−#if __GLASGOW_HASKELL__ < 800
53−#else
5448import qualified Data.ByteString as BS
5549import qualified Data.ByteString.Lazy as BSL
5650import GHC.TypeLits (TypeError, ErrorMessage(..))
57−#endif
5851
5952-- | Default schema for binary data (any sequence of octets).
6053binaryParamSchema :: ParamSchema t
@@ -119,7 +112,7 @@ class ToParamSchema a where
119112 default toParamSchema :: (Generic a, GToParamSchema (Rep a)) => Proxy a -> ParamSchema t
120113 toParamSchema = genericToParamSchema defaultSchemaOptions
121114
122−instance OVERLAPPING_ ToParamSchema String where
115+instance {-# OVERLAPPING #-} ToParamSchema String where
123116 toParamSchema _ = mempty & type_ ?~ SwaggerString
124117
125118instance ToParamSchema Bool where
@@ -239,9 +232,6 @@ instance ToParamSchema SetCookie where
239232 toParamSchema _ = mempty
240233 & type_ ?~ SwaggerString
241234
242−
243−#if __GLASGOW_HASKELL__ < 800
244−#else
245235type family ToParamSchemaByteStringError bs where
246236 ToParamSchemaByteStringError bs = TypeError
247237 ( 'Text "Impossible to have an instance " :<>: ShowType (ToParamSchema bs) :<>: Text "."
@@ -250,7 +240,6 @@ type family ToParamSchemaByteStringError bs where
250240
251241instance ToParamSchemaByteStringError BS.ByteString => ToParamSchema BS.ByteString where toParamSchema = error "impossible"
252242instance ToParamSchemaByteStringError BSL.ByteString => ToParamSchema BSL.ByteString where toParamSchema = error "impossible"
253−#endif
254243
255244instance ToParamSchema All where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
256245instance ToParamSchema Any where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool)
src/Data/Swagger/Internal/Schema.hs+10−40
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DefaultSignatures #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -15,13 +14,9 @@
1514{-# LANGUAGE TypeOperators #-}
1615{-# LANGUAGE TypeSynonymInstances #-}
1716{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
19−-- Few generics related redundant constraints
2017{-# OPTIONS_GHC -Wno-redundant-constraints #-}
2118-- For TypeErrors
2219{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
23−#endif
24−#include "overlapping-compat.h"
2520module Data.Swagger.Internal.Schema where
2621
2722import Prelude ()
@@ -71,12 +66,9 @@ import qualified Data.Swagger.Lens as Swagger
7166import Data.Swagger.SchemaOptions
7267import Data.Swagger.Internal.TypeShape
7368
74−#if __GLASGOW_HASKELL__ < 800
75−#else
7669import qualified Data.ByteString as BS
7770import qualified Data.ByteString.Lazy as BSL
7871import GHC.TypeLits (TypeError, ErrorMessage(..))
79−#endif
8072
8173unnamed :: Schema -> NamedSchema
8274unnamed schema = NamedSchema Nothing schema
@@ -416,14 +408,14 @@ sketchStrictSchema = go . toJSON
416408class GToSchema (f :: * -> *) where
417409 gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
418410
419−instance OVERLAPPABLE_ ToSchema a => ToSchema [a] where
411+instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where
420412 declareNamedSchema _ = do
421413 ref <- declareSchemaRef (Proxy :: Proxy a)
422414 return $ unnamed $ mempty
423415 & type_ ?~ SwaggerArray
424416 & items ?~ SwaggerItemsObject ref
425417
426−instance OVERLAPPING_ ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
418+instance {-# OVERLAPPING #-} ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
427419instance ToSchema Bool where declareNamedSchema = plain . paramSchemaToSchema
428420instance ToSchema Integer where declareNamedSchema = plain . paramSchemaToSchema
429421instance ToSchema Natural where declareNamedSchema = plain . paramSchemaToSchema
@@ -505,8 +497,6 @@ instance ToSchema TL.Text where declareNamedSchema = plain . paramSchemaToSchema
505497
506498instance ToSchema Version where declareNamedSchema = plain . paramSchemaToSchema
507499
508−#if __GLASGOW_HASKELL__ < 800
509−#else
510500type family ToSchemaByteStringError bs where
511501 ToSchemaByteStringError bs = TypeError
512502 ( Text "Impossible to have an instance " :<>: ShowType (ToSchema bs) :<>: Text "."
@@ -515,7 +505,6 @@ type family ToSchemaByteStringError bs where
515505
516506instance ToSchemaByteStringError BS.ByteString => ToSchema BS.ByteString where declareNamedSchema = error "impossible"
517507instance ToSchemaByteStringError BSL.ByteString => ToSchema BSL.ByteString where declareNamedSchema = error "impossible"
518−#endif
519508
520509instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Set Int))
521510
@@ -523,7 +512,6 @@ instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy
523512instance ToSchema a => ToSchema (IntMap a) where
524513 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
525514
526−#if MIN_VERSION_aeson(1,0,0)
527515instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
528516 declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction k of
529517 ToJSONKeyText _ _ -> declareObjectMapSchema
@@ -538,25 +526,7 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
538526instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
539527 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
540528
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
560530 declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty
561531 & type_ ?~ SwaggerObject
562532 & description ?~ "Arbitrary JSON object."
@@ -738,10 +708,10 @@ instance (Datatype d, GToSchema f) => GToSchema (D1 d f) where
738708 where
739709 name = gdatatypeSchemaName opts (Proxy :: Proxy d)
740710
741−instance OVERLAPPABLE_ GToSchema f => GToSchema (C1 c f) where
711+instance {-# OVERLAPPABLE #-} GToSchema f => GToSchema (C1 c f) where
742712 gdeclareNamedSchema opts _ = gdeclareNamedSchema opts (Proxy :: Proxy f)
743713
744−instance OVERLAPPING_ Constructor c => GToSchema (C1 c U1) where
714+instance {-# OVERLAPPING #-} Constructor c => GToSchema (C1 c U1) where
745715 gdeclareNamedSchema = gdeclareNamedSumSchema
746716
747717-- | Single field constructor.
@@ -804,17 +774,17 @@ withFieldSchema opts _ isRequiredField schema = do
804774 fname = T.pack (fieldLabelModifier opts (selName (Proxy3 :: Proxy3 s f p)))
805775
806776-- | 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
808778 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s (K1 i (Maybe c))) False
809779
810780-- | 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
812782 gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s f) True
813783
814−instance OVERLAPPING_ ToSchema c => GToSchema (K1 i (Maybe c)) where
784+instance {-# OVERLAPPING #-} ToSchema c => GToSchema (K1 i (Maybe c)) where
815785 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
816786
817−instance OVERLAPPABLE_ ToSchema c => GToSchema (K1 i c) where
787+instance {-# OVERLAPPABLE #-} ToSchema c => GToSchema (K1 i c) where
818788 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
819789
820790instance ( GSumToSchema f
@@ -859,7 +829,7 @@ gsumConToSchema opts proxy schema = do
859829 ref <- gdeclareSchemaRef opts proxy
860830 return $ gsumConToSchemaWith ref opts proxy schema
861831
862−instance OVERLAPPABLE_ (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where
832+instance {-# OVERLAPPABLE #-} (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where
863833 gsumToSchema opts proxy schema = do
864834 tell (All False)
865835 lift $ gsumConToSchema opts proxy schema
src/Data/Swagger/Internal/TypeShape.hs−10
@@ -1,7 +1,5 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DataKinds #-}
4−{-# LANGUAGE KindSignatures #-}
53{-# LANGUAGE TypeFamilies #-}
64{-# LANGUAGE TypeOperators #-}
75{-# LANGUAGE UndecidableInstances #-}
@@ -37,11 +35,6 @@ type family TypeHasSimpleShape t (f :: Symbol) :: Constraint where
3735type family GenericHasSimpleShape t (f :: Symbol) (s :: TypeShape) :: Constraint where
3836 GenericHasSimpleShape t f Enumeration = ()
3937 GenericHasSimpleShape t f SumOfProducts = ()
40−#if __GLASGOW_HASKELL__ < 800
41− GenericHasSimpleShape t f Mixed = CannotDeriveSchemaForMixedSumType t
42−
43−class CannotDeriveSchemaForMixedSumType t where
44−#else
4538 GenericHasSimpleShape t f Mixed =
4639 TypeError
4740 ( Text "Cannot derive Generic-based Swagger Schema for " :<>: ShowType t
@@ -51,7 +44,6 @@ class CannotDeriveSchemaForMixedSumType t where
5144 :$$: Text "that matches aeson's Generic-based toJSON,"
5245 :$$: Text "but that's not supported by some Swagger tools."
5346 )
54−#endif
5547
5648-- | Infer a 'TypeShape' for a generic representation of a type.
5749type family GenericShape (g :: * -> *) :: TypeShape
@@ -62,5 +54,3 @@ type instance GenericShape (D1 d f) = GenericShape f
6254type instance GenericShape (C1 c U1) = Enumeration
6355type instance GenericShape (C1 c (S1 s f)) = SumOfProducts
6456type instance GenericShape (C1 c (f :*: g)) = SumOfProducts
65−
66−
src/Data/Swagger/Lens.hs+14−22
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE FlexibleContexts #-}
32{-# LANGUAGE FlexibleInstances #-}
43{-# LANGUAGE FunctionalDependencies #-}
@@ -10,7 +9,6 @@
109{-# LANGUAGE DataKinds #-}
1110{-# LANGUAGE UndecidableInstances #-}
1211{-# OPTIONS_GHC -fno-warn-orphans #-}
13−#include "overlapping-compat.h"
1412-- |
1513-- Module: Data.Swagger.Lens
1614-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
@@ -118,69 +116,63 @@ instance HasDefault ParamOtherSchema (Maybe Value) where default_ = paramSchema.
118116-- OVERLAPPABLE instances
119117
120118instance
121−#if __GLASGOW_HASKELL__ >= 710
122− OVERLAPPABLE_
123−#endif
119+ {-# OVERLAPPABLE #-}
124120 HasParamSchema s (ParamSchema t)
125121 => HasFormat s (Maybe Format) where
126122 format = paramSchema.format
127123
128124instance
129−#if __GLASGOW_HASKELL__ >= 710
130− OVERLAPPABLE_
131−#endif
125+ {-# OVERLAPPABLE #-}
132126 HasParamSchema s (ParamSchema t)
133127 => HasItems s (Maybe (SwaggerItems t)) where
134128 items = paramSchema.items
135129
136130instance
137−#if __GLASGOW_HASKELL__ >= 710
138− OVERLAPPABLE_
139−#endif
131+ {-# OVERLAPPABLE #-}
140132 HasParamSchema s (ParamSchema t)
141133 => HasMaximum s (Maybe Scientific) where
142134 maximum_ = paramSchema.maximum_
143135
144−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
136+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
145137 => HasExclusiveMaximum s (Maybe Bool) where
146138 exclusiveMaximum = paramSchema.exclusiveMaximum
147139
148−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
140+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
149141 => HasMinimum s (Maybe Scientific) where
150142 minimum_ = paramSchema.minimum_
151143
152−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
144+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
153145 => HasExclusiveMinimum s (Maybe Bool) where
154146 exclusiveMinimum = paramSchema.exclusiveMinimum
155147
156−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
148+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
157149 => HasMaxLength s (Maybe Integer) where
158150 maxLength = paramSchema.maxLength
159151
160−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
152+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
161153 => HasMinLength s (Maybe Integer) where
162154 minLength = paramSchema.minLength
163155
164−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
156+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
165157 => HasPattern s (Maybe Text) where
166158 pattern = paramSchema.pattern
167159
168−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
160+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
169161 => HasMaxItems s (Maybe Integer) where
170162 maxItems = paramSchema.maxItems
171163
172−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
164+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
173165 => HasMinItems s (Maybe Integer) where
174166 minItems = paramSchema.minItems
175167
176−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
168+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
177169 => HasUniqueItems s (Maybe Bool) where
178170 uniqueItems = paramSchema.uniqueItems
179171
180−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
172+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
181173 => HasEnum s (Maybe [Value]) where
182174 enum_ = paramSchema.enum_
183175
184−instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t)
176+instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
185177 => HasMultipleOf s (Maybe Scientific) where
186178 multipleOf = paramSchema.multipleOf
src/Data/Swagger/Schema/Generator.hs−1
@@ -13,7 +13,6 @@ import Data.Aeson
1313import Data.Aeson.Types
1414import qualified Data.HashMap.Strict.InsOrd as M
1515import Data.Maybe
16−import Data.Maybe
1716import Data.Proxy
1817import Data.Scientific
1918import qualified Data.Set as S
swagger2.cabal+12−15
@@ -1,6 +1,6 @@
11cabal-version: >=1.10
22name: swagger2
3−version: 2.6
3+version: 2.6.1
44
55synopsis: Swagger 2.0 data model
66category: Web, Swagger
@@ -22,7 +22,6 @@ extra-source-files:
2222 README.md
2323 , CHANGELOG.md
2424 , examples/*.hs
25− , include/overlapping-compat.h
2625tested-with:
2726 GHC ==8.0.2
2827 || ==8.2.2
@@ -37,7 +36,6 @@ custom-setup
3736
3837library
3938 hs-source-dirs: src
40− include-dirs: include
4139 exposed-modules:
4240 Data.Swagger
4341 Data.Swagger.Declare
@@ -61,38 +59,37 @@ library
6159
6260 -- GHC boot libraries
6361 build-depends:
64− base >=4.9 && <4.15
65− , bytestring >=0.10.4.0 && <0.11
66− , containers >=0.5.5.1 && <0.7
67− , template-haskell >=2.9.0.0 && <2.17
68− , time >=1.4.2 && <1.10
69− , transformers >=0.3.0.0 && <0.6
62+ base >=4.9 && <4.15
63+ , bytestring >=0.10.8.1 && <0.11
64+ , containers >=0.5.7.1 && <0.7
65+ , template-haskell >=2.11.1.0 && <2.17
66+ , time >=1.6.0.1 && <1.10
67+ , transformers >=0.5.2.0 && <0.6
7068
7169 build-depends:
72− mtl >=2.1 && <2.3
70+ mtl >=2.2.2 && <2.3
7371 , text >=1.2.3.0 && <1.3
7472
7573 -- other dependencies
7674 build-depends:
77− base-compat-batteries >=0.10.4 && <0.12
75+ base-compat-batteries >=0.11.1 && <0.12
7876 , aeson >=1.4.2.0 && <1.5
7977 , aeson-pretty >=0.8.7 && <0.9
8078 -- cookie 0.4.3 is needed by GHC 7.8 due to time>=1.4 constraint
8179 , cookie >=0.4.3 && <0.5
82− , generics-sop >=0.3.2.0 && <0.6
80+ , generics-sop >=0.5.1.0 && <0.6
8381 , 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
8583 , insert-ordered-containers >=0.2.3 && <0.3
8684 , lens >=4.16.1 && <4.20
8785 , network >=2.6.3.5 && <3.2
8886 , optics-core >=0.2 && <0.4
8987 , optics-th >=0.2 && <0.4
9088 , scientific >=0.3.6.2 && <0.4
91− , transformers-compat >=0.3 && <0.7
9289 , unordered-containers >=0.2.9.0 && <0.3
9390 , uuid-types >=1.0.3 && <1.1
9491 , vector >=0.12.0.1 && <0.13
95− , QuickCheck >=2.10.1 && <2.15
92+ , QuickCheck >=2.10.1 && <2.15
9693
9794 default-language: Haskell2010
9895
test/Data/Swagger/Schema/ValidationSpec.hs−1
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DeriveGeneric #-}
32{-# LANGUAGE PackageImports #-}
43{-# LANGUAGE RecordWildCards #-}