diff --git a/.ghci b/.ghci deleted file mode 100644 index e70145e..0000000 --- a/.ghci +++ /dev/null @@ -1,2 +0,0 @@ -: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 -:set -hide-package base-compat-0.10.4 diff --git a/.travis.yml b/.travis.yml index b6586f8..cf3170f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,17 @@ # # haskell-ci '--branches' 'master' '--haddock-jobs=>=8.4' '--output' '.travis.yml' 'swagger2.cabal' # +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.5.20191020 +# version: 0.10 # +version: ~> 1.0 language: c +os: linux dist: xenial git: # whether to recursively clone submodules @@ -18,6 +24,7 @@ cache: directories: - $HOME/.cabal/packages - $HOME/.cabal/store + - $HOME/.hlint before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log # remove files that are regenerated by 'cabal update' @@ -27,18 +34,26 @@ before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - rm -rfv $CABALHOME/packages/head.hackage -matrix: +jobs: include: + - compiler: ghc-8.10.1 + 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"]}} + os: linux - compiler: ghc-8.8.1 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} + 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"]}} + os: linux - compiler: ghc-8.6.5 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}} + 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"]}} + os: linux - compiler: ghc-8.4.4 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}} + 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"]}} + os: linux - compiler: ghc-8.2.2 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}} + 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"]}} + os: linux - compiler: ghc-8.0.2 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}} + 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"]}} + os: linux before_install: - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - WITHCOMPILER="-w $HC" @@ -51,57 +66,31 @@ before_install: - TOP=$(pwd) - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" - echo $HCNUMVER - - CABAL="$CABAL -vnormal+nowrap+markoutput" + - CABAL="$CABAL -vnormal+nowrap" - set -o pipefail - - | - echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk - echo 'BEGIN { state = "output"; }' >> .colorful.awk - echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk - echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk - echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk - echo ' if (state == "cabal") {' >> .colorful.awk - echo ' print blue($0)' >> .colorful.awk - echo ' } else {' >> .colorful.awk - echo ' print $0' >> .colorful.awk - echo ' }' >> .colorful.awk - echo '}' >> .colorful.awk - - cat .colorful.awk - - | - color_cabal_output () { - awk -f $TOP/.colorful.awk - } - - echo text | color_cabal_output -install: - - ${CABAL} --version - - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - TEST=--enable-tests - BENCH=--enable-benchmarks - HEADHACKAGE=false - rm -f $CABALHOME/config - | - echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config - echo "remote-build-reporting: anonymous" >> $CABALHOME/config - echo "write-ghc-environment-files: always" >> $CABALHOME/config - echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config - echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config - echo "world-file: $CABALHOME/world" >> $CABALHOME/config - echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config - echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config - echo "installdir: $CABALHOME/bin" >> $CABALHOME/config - echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config - echo "store-dir: $CABALHOME/store" >> $CABALHOME/config - echo "install-dirs user" >> $CABALHOME/config - echo " prefix: $CABALHOME" >> $CABALHOME/config - echo "repository hackage.haskell.org" >> $CABALHOME/config - echo " url: http://hackage.haskell.org/" >> $CABALHOME/config - echo " secure: True" >> $CABALHOME/config - echo " key-threshold: 3" >> $CABALHOME/config - echo " root-keys:" >> $CABALHOME/config - echo " fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0" >> $CABALHOME/config - echo " 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42" >> $CABALHOME/config - echo " 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3" >> $CABALHOME/config - echo " 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d" >> $CABALHOME/config - echo " 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921" >> $CABALHOME/config + echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config + echo "remote-build-reporting: anonymous" >> $CABALHOME/config + echo "write-ghc-environment-files: always" >> $CABALHOME/config + echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config + echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config + echo "world-file: $CABALHOME/world" >> $CABALHOME/config + echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config + echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config + echo "installdir: $CABALHOME/bin" >> $CABALHOME/config + echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config + echo "store-dir: $CABALHOME/store" >> $CABALHOME/config + echo "install-dirs user" >> $CABALHOME/config + echo " prefix: $CABALHOME" >> $CABALHOME/config + echo "repository hackage.haskell.org" >> $CABALHOME/config + echo " url: http://hackage.haskell.org/" >> $CABALHOME/config +install: + - ${CABAL} --version + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - | echo "program-default-options" >> $CABALHOME/config echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config @@ -113,20 +102,22 @@ install: - touch cabal.project - | echo "packages: ." >> cabal.project + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package swagger2' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - | - "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" - cat cabal.project || true - cat cabal.project.local || true - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output + - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - rm cabal.project.freeze - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all script: - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Packaging... - - ${CABAL} v2-sdist all | color_cabal_output + - ${CABAL} v2-sdist all # Unpacking... - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false @@ -138,25 +129,27 @@ script: - touch cabal.project - | echo "packages: ${PKGDIR_swagger2}" >> cabal.project + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package swagger2' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - | - "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" - cat cabal.project || true - cat cabal.project.local || true # Building... # this builds all libraries and executables (without tests/benchmarks) - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all # Building with tests and benchmarks... # build & run tests, build benchmarks - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all # Testing... - - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all # cabal check... - (cd ${PKGDIR_swagger2} && ${CABAL} -vnormal check) # haddock... - - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output ; fi + - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi # Building without installed constraints for packages in global-db... - rm -f cabal.project.local - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all -# REGENDATA ("0.5.20191020",["--branches","master","--haddock-jobs=>=8.4","--output",".travis.yml","swagger2.cabal"]) +# REGENDATA ("0.10",["--branches","master","--haddock-jobs=>=8.4","--output",".travis.yml","swagger2.cabal"]) # EOF diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fbfb9e..0e709ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +2.6.1 +----- + +- More GHC-8.10 related cleanup, tighten lower bound on some dependencies. + (see [#216]( https://github.com/GetShopTV/swagger2/pull/216 )); +- Add "format" field for uint32 and uint64 + (see [#215]( https://github.com/GetShopTV/swagger2/pull/215 )); + 2.6 --- diff --git a/include/overlapping-compat.h b/include/overlapping-compat.h deleted file mode 100644 index eef9d4e..0000000 --- a/include/overlapping-compat.h +++ /dev/null @@ -1,8 +0,0 @@ -#if __GLASGOW_HASKELL__ >= 710 -#define OVERLAPPABLE_ {-# OVERLAPPABLE #-} -#define OVERLAPPING_ {-# OVERLAPPING #-} -#else -{-# LANGUAGE OverlappingInstances #-} -#define OVERLAPPABLE_ -#define OVERLAPPING_ -#endif diff --git a/src/Data/Swagger.hs b/src/Data/Swagger.hs index aced43c..2ea7fac 100644 --- a/src/Data/Swagger.hs +++ b/src/Data/Swagger.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} -- | -- Module: Data.Swagger -- Maintainer: Nickolay Kudasov @@ -295,21 +294,6 @@ import Data.Swagger.Internal -- -- we can not derive a valid schema for a mix of the above. The following will result in a type error -- -#if __GLASGOW_HASKELL__ < 800 --- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic --- >>> instance ToSchema BadMixedType --- ... --- ... error: --- ... • No instance for (Data.Swagger.Internal.TypeShape.CannotDeriveSchemaForMixedSumType --- ... BadMixedType) --- ... arising from a use of ‘Data.Swagger.Internal.Schema.$dmdeclareNamedSchema’ --- ... • In the expression: --- ... Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType --- ... In an equation for ‘declareNamedSchema’: --- ... declareNamedSchema --- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType --- ... In the instance declaration for ‘ToSchema BadMixedType’ -#else -- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic -- >>> instance ToSchema BadMixedType -- ... @@ -320,13 +304,8 @@ import Data.Swagger.Internal -- ... Use genericDeclareNamedSchemaUnrestricted if you want to derive schema -- ... that matches aeson's Generic-based toJSON, -- ... but that's not supported by some Swagger tools. --- ... • In the expression: --- ... Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType --- ... In an equation for ‘declareNamedSchema’: --- ... declareNamedSchema --- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType --- ... In the instance declaration for ‘ToSchema BadMixedType’ -#endif +-- ... +-- ... In the instance declaration for ‘ToSchema BadMixedType’ -- -- We can use 'genericDeclareNamedSchemaUnrestricted' to try our best to represent this type as a Swagger Schema and match 'ToJSON': -- diff --git a/src/Data/Swagger/Declare.hs b/src/Data/Swagger/Declare.hs index bab2c2f..152c6e3 100644 --- a/src/Data/Swagger/Declare.hs +++ b/src/Data/Swagger/Declare.hs @@ -60,7 +60,7 @@ instance (Applicative m, Monad m, Monoid d) => Monad (DeclareT d m) where return (mappend d' d'', y) instance Monoid d => MonadTrans (DeclareT d) where - lift m = DeclareT (\_ -> (,) mempty `liftM` m) + lift m = DeclareT (\_ -> (,) mempty <$> m) -- | -- Definitions of @declare@ and @look@ must satisfy the following laws: @@ -103,12 +103,12 @@ looks f = f <$> look -- | Evaluate @'DeclareT' d m a@ computation, -- ignoring new output @d@. evalDeclareT :: Monad m => DeclareT d m a -> d -> m a -evalDeclareT (DeclareT f) d = snd `liftM` f d +evalDeclareT (DeclareT f) d = snd <$> f d -- | Execute @'DeclateT' d m a@ computation, -- ignoring result and only producing new output @d@. execDeclareT :: Monad m => DeclareT d m a -> d -> m d -execDeclareT (DeclareT f) d = fst `liftM` f d +execDeclareT (DeclareT f) d = fst <$> f d -- | Evaluate @'DeclareT' d m a@ computation, -- starting with empty output history. diff --git a/src/Data/Swagger/Internal.hs b/src/Data/Swagger/Internal.hs index d7b1a5b..00b35a1 100644 --- a/src/Data/Swagger/Internal.hs +++ b/src/Data/Swagger/Internal.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} @@ -15,10 +14,6 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -#if __GLASGOW_HASKELL__ <710 -{-# LANGUAGE PolyKinds #-} -#endif -#include "overlapping-compat.h" module Data.Swagger.Internal where import Prelude () @@ -58,13 +53,7 @@ import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToJSON ,saoAdditionalPairs ,saoSubObject) import Data.Swagger.Internal.Utils - -#if MIN_VERSION_aeson(0,10,0) import Data.Swagger.Internal.AesonUtils (sopSwaggerGenericToEncoding) -#define DEFINE_TOENCODING toEncoding = sopSwaggerGenericToEncoding -#else -#define DEFINE_TOENCODING -#endif -- $setup -- >>> :seti -XDataKinds @@ -416,7 +405,7 @@ instance Data (SwaggerItems 'SwaggerKindParamOtherSchema) where dataTypeOf _ = swaggerItemsDataType instance Data (SwaggerItems 'SwaggerKindSchema) where - gfoldl _ _ (SwaggerItemsPrimitive _ _) = error $ " Data.Data.gfoldl: Constructor SwaggerItemsPrimitive used to construct SwaggerItems SwaggerKindSchema" + gfoldl _ _ (SwaggerItemsPrimitive _ _) = error " Data.Data.gfoldl: Constructor SwaggerItemsPrimitive used to construct SwaggerItems SwaggerKindSchema" gfoldl k z (SwaggerItemsObject ref) = z SwaggerItemsObject `k` ref gfoldl k z (SwaggerItemsArray ref) = z SwaggerItemsArray `k` ref @@ -832,6 +821,23 @@ data AdditionalProperties | AdditionalPropertiesSchema (Referenced Schema) deriving (Eq, Show, Data, Typeable) +------------------------------------------------------------------------------- +-- Generic instances +------------------------------------------------------------------------------- + +deriveGeneric ''Header +deriveGeneric ''OAuth2Params +deriveGeneric ''Operation +deriveGeneric ''Param +deriveGeneric ''ParamOtherSchema +deriveGeneric ''PathItem +deriveGeneric ''Response +deriveGeneric ''Responses +deriveGeneric ''SecurityScheme +deriveGeneric ''Schema +deriveGeneric ''ParamSchema +deriveGeneric ''Swagger + -- ======================================================================= -- Monoid instances -- ======================================================================= @@ -928,7 +934,7 @@ instance Semigroup SecurityDefinitions where SecurityDefinitions $ InsOrdHashMap.unionWith (<>) sd1 sd2 instance Monoid SecurityDefinitions where - mempty = SecurityDefinitions $ InsOrdHashMap.empty + mempty = SecurityDefinitions InsOrdHashMap.empty mappend = (<>) -- ======================================================================= @@ -959,7 +965,7 @@ instance SwaggerMonoid ParamLocation where swaggerMempty = ParamQuery swaggerMappend _ y = y -instance OVERLAPPING_ SwaggerMonoid (InsOrdHashMap FilePath PathItem) where +instance {-# OVERLAPPING #-} SwaggerMonoid (InsOrdHashMap FilePath PathItem) where swaggerMempty = InsOrdHashMap.empty swaggerMappend = InsOrdHashMap.unionWith mappend @@ -1060,7 +1066,7 @@ instance ToJSON OAuth2Flow where instance ToJSON OAuth2Params where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON SecuritySchemeType where toJSON SecuritySchemeBasic @@ -1074,19 +1080,19 @@ instance ToJSON SecuritySchemeType where instance ToJSON Swagger where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON SecurityScheme where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Schema where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Header where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding -- | As for nullary schema for 0-arity type constructors, see -- . @@ -1117,7 +1123,7 @@ instance ToJSON MimeList where instance ToJSON Param where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON ParamAnySchema where toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ] @@ -1125,23 +1131,23 @@ instance ToJSON ParamAnySchema where instance ToJSON ParamOtherSchema where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Responses where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Response where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Operation where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON PathItem where toJSON = sopSwaggerGenericToJSON - DEFINE_TOENCODING + toEncoding = sopSwaggerGenericToEncoding instance ToJSON Example where toJSON = toJSON . Map.mapKeys show . getExample @@ -1367,23 +1373,6 @@ instance FromJSON AdditionalProperties where parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b parseJSON js = AdditionalPropertiesSchema <$> parseJSON js -------------------------------------------------------------------------------- --- TH splices -------------------------------------------------------------------------------- - -deriveGeneric ''Header -deriveGeneric ''OAuth2Params -deriveGeneric ''Operation -deriveGeneric ''Param -deriveGeneric ''ParamOtherSchema -deriveGeneric ''PathItem -deriveGeneric ''Response -deriveGeneric ''Responses -deriveGeneric ''SecurityScheme -deriveGeneric ''Schema -deriveGeneric ''ParamSchema -deriveGeneric ''Swagger - instance HasSwaggerAesonOptions Header where swaggerAesonOptions _ = mkSwaggerAesonOptions "header" & saoSubObject ?~ "paramSchema" instance HasSwaggerAesonOptions OAuth2Params where diff --git a/src/Data/Swagger/Internal/AesonUtils.hs b/src/Data/Swagger/Internal/AesonUtils.hs index 3193670..984da77 100644 --- a/src/Data/Swagger/Internal/AesonUtils.hs +++ b/src/Data/Swagger/Internal/AesonUtils.hs @@ -1,20 +1,15 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE TemplateHaskell #-} -#if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE UndecidableSuperClasses #-} -#endif module Data.Swagger.Internal.AesonUtils ( -- * Generic functions AesonDefaultValue(..), sopSwaggerGenericToJSON, -#if MIN_VERSION_aeson(0,10,0) sopSwaggerGenericToEncoding, -#endif sopSwaggerGenericToJSONWithOpts, sopSwaggerGenericParseJSON, -- * Options @@ -46,9 +41,7 @@ import qualified Data.Set as Set import qualified Data.HashMap.Strict.InsOrd as InsOrd import qualified Data.HashSet.InsOrd as InsOrdHS -#if MIN_VERSION_aeson(0,10,0) import Data.Aeson (Encoding, pairs, (.=), Series) -#endif ------------------------------------------------------------------------------- -- SwaggerAesonOptions @@ -146,11 +139,7 @@ sopSwaggerGenericToJSON' -> DatatypeInfo '[xs] -> POP Maybe '[xs] -> [Pair] -#if MIN_VERSION_generics_sop(0,5,0) sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) = -#else -sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) = -#endif sopSwaggerGenericToJSON'' opts fields fieldsInfo defs sopSwaggerGenericToJSON' _ _ _ _ = error "sopSwaggerGenericToJSON: unsupported type" @@ -179,9 +168,6 @@ sopSwaggerGenericToJSON'' (SwaggerAesonOptions prefix _ sub) = go json = toJSON x name' = fieldNameModifier name rest = go xs names defs -#if __GLASGOW_HASKELL__ < 800 - go _ _ _ = error "not empty" -#endif fieldNameModifier = modifier . drop 1 modifier = lowerFirstUppers . drop (length prefix) @@ -226,11 +212,7 @@ sopSwaggerGenericParseJSON' -> DatatypeInfo '[xs] -> POP Maybe '[xs] -> Parser (SOP I '[xs]) -#if MIN_VERSION_generics_sop(0,5,0) sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) = -#else -sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) = -#endif SOP . Z <$> sopSwaggerGenericParseJSON'' opts obj fieldsInfo defs sopSwaggerGenericParseJSON' _ _ _ _ = error "sopSwaggerGenericParseJSON: unsupported type" @@ -260,9 +242,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go withDef = case def of Just def' -> (<|> pure def') Nothing -> id -#if __GLASGOW_HASKELL__ < 800 - go _ _ = error "not empty" -#endif fieldNameModifier = modifier . drop 1 modifier = lowerFirstUppers . drop (length prefix) @@ -273,8 +252,6 @@ sopSwaggerGenericParseJSON'' (SwaggerAesonOptions prefix _ sub) obj = go -- ToEncoding ------------------------------------------------------------------------------- -#if MIN_VERSION_aeson(0,10,0) - sopSwaggerGenericToEncoding :: forall a xs. ( HasDatatypeInfo a @@ -302,11 +279,7 @@ sopSwaggerGenericToEncoding' -> DatatypeInfo '[xs] -> POP Maybe '[xs] -> Series -#if MIN_VERSION_generics_sop(0,5,0) sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) = -#else -sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) = -#endif sopSwaggerGenericToEncoding'' opts fields fieldsInfo defs sopSwaggerGenericToEncoding' _ _ _ _ = error "sopSwaggerGenericToEncoding: unsupported type" @@ -334,13 +307,8 @@ sopSwaggerGenericToEncoding'' (SwaggerAesonOptions prefix _ sub) = go where name' = fieldNameModifier name rest = go xs names defs -#if __GLASGOW_HASKELL__ < 800 - go _ _ _ = error "not empty" -#endif fieldNameModifier = modifier . drop 1 modifier = lowerFirstUppers . drop (length prefix) lowerFirstUppers s = map toLower x ++ y where (x, y) = span isUpper s - -#endif diff --git a/src/Data/Swagger/Internal/ParamSchema.hs b/src/Data/Swagger/Internal/ParamSchema.hs index 28c55b6..b927fb6 100644 --- a/src/Data/Swagger/Internal/ParamSchema.hs +++ b/src/Data/Swagger/Internal/ParamSchema.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} @@ -12,13 +11,10 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} -#if __GLASGOW_HASKELL__ >= 800 -- Generic a is redundant in ToParamSchema a default imple {-# OPTIONS_GHC -Wno-redundant-constraints #-} -- For TypeErrors {-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} -#endif -#include "overlapping-compat.h" module Data.Swagger.Internal.ParamSchema where import Control.Lens @@ -49,12 +45,9 @@ import Data.Swagger.Internal import Data.Swagger.Lens import Data.Swagger.SchemaOptions -#if __GLASGOW_HASKELL__ < 800 -#else import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import GHC.TypeLits (TypeError, ErrorMessage(..)) -#endif -- | Default schema for binary data (any sequence of octets). binaryParamSchema :: ParamSchema t @@ -119,7 +112,7 @@ class ToParamSchema a where default toParamSchema :: (Generic a, GToParamSchema (Rep a)) => Proxy a -> ParamSchema t toParamSchema = genericToParamSchema defaultSchemaOptions -instance OVERLAPPING_ ToParamSchema String where +instance {-# OVERLAPPING #-} ToParamSchema String where toParamSchema _ = mempty & type_ ?~ SwaggerString instance ToParamSchema Bool where @@ -239,9 +232,6 @@ instance ToParamSchema SetCookie where toParamSchema _ = mempty & type_ ?~ SwaggerString - -#if __GLASGOW_HASKELL__ < 800 -#else type family ToParamSchemaByteStringError bs where ToParamSchemaByteStringError bs = TypeError ( 'Text "Impossible to have an instance " :<>: ShowType (ToParamSchema bs) :<>: Text "." @@ -250,7 +240,6 @@ type family ToParamSchemaByteStringError bs where instance ToParamSchemaByteStringError BS.ByteString => ToParamSchema BS.ByteString where toParamSchema = error "impossible" instance ToParamSchemaByteStringError BSL.ByteString => ToParamSchema BSL.ByteString where toParamSchema = error "impossible" -#endif instance ToParamSchema All where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool) instance ToParamSchema Any where toParamSchema _ = toParamSchema (Proxy :: Proxy Bool) diff --git a/src/Data/Swagger/Internal/Schema.hs b/src/Data/Swagger/Internal/Schema.hs index ade084c..210cc85 100644 --- a/src/Data/Swagger/Internal/Schema.hs +++ b/src/Data/Swagger/Internal/Schema.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} @@ -15,13 +14,9 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} -#if __GLASGOW_HASKELL__ >= 800 --- Few generics related redundant constraints {-# OPTIONS_GHC -Wno-redundant-constraints #-} -- For TypeErrors {-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} -#endif -#include "overlapping-compat.h" module Data.Swagger.Internal.Schema where import Prelude () @@ -71,12 +66,9 @@ import qualified Data.Swagger.Lens as Swagger import Data.Swagger.SchemaOptions import Data.Swagger.Internal.TypeShape -#if __GLASGOW_HASKELL__ < 800 -#else import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import GHC.TypeLits (TypeError, ErrorMessage(..)) -#endif unnamed :: Schema -> NamedSchema unnamed schema = NamedSchema Nothing schema @@ -416,14 +408,14 @@ sketchStrictSchema = go . toJSON class GToSchema (f :: * -> *) where gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema -instance OVERLAPPABLE_ ToSchema a => ToSchema [a] where +instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where declareNamedSchema _ = do ref <- declareSchemaRef (Proxy :: Proxy a) return $ unnamed $ mempty & type_ ?~ SwaggerArray & items ?~ SwaggerItemsObject ref -instance OVERLAPPING_ ToSchema String where declareNamedSchema = plain . paramSchemaToSchema +instance {-# OVERLAPPING #-} ToSchema String where declareNamedSchema = plain . paramSchemaToSchema instance ToSchema Bool where declareNamedSchema = plain . paramSchemaToSchema instance ToSchema Integer where declareNamedSchema = plain . paramSchemaToSchema instance ToSchema Natural where declareNamedSchema = plain . paramSchemaToSchema @@ -505,8 +497,6 @@ instance ToSchema TL.Text where declareNamedSchema = plain . paramSchemaToSchema instance ToSchema Version where declareNamedSchema = plain . paramSchemaToSchema -#if __GLASGOW_HASKELL__ < 800 -#else type family ToSchemaByteStringError bs where ToSchemaByteStringError bs = TypeError ( Text "Impossible to have an instance " :<>: ShowType (ToSchema bs) :<>: Text "." @@ -515,7 +505,6 @@ type family ToSchemaByteStringError bs where instance ToSchemaByteStringError BS.ByteString => ToSchema BS.ByteString where declareNamedSchema = error "impossible" instance ToSchemaByteStringError BSL.ByteString => ToSchema BSL.ByteString where declareNamedSchema = error "impossible" -#endif instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Set Int)) @@ -523,7 +512,6 @@ instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy instance ToSchema a => ToSchema (IntMap a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)]) -#if MIN_VERSION_aeson(1,0,0) instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction k of ToJSONKeyText _ _ -> declareObjectMapSchema @@ -538,25 +526,7 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v)) -#else - -instance ToSchema a => ToSchema (Map String a) where - declareNamedSchema _ = do - schema <- declareSchemaRef (Proxy :: Proxy a) - return $ unnamed $ mempty - & type_ ?~ SwaggerObject - & additionalProperties ?~ schema - -instance ToSchema a => ToSchema (Map T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a)) -instance ToSchema a => ToSchema (Map TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a)) - -instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a)) -instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a)) -instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a)) - -#endif - -instance OVERLAPPING_ ToSchema Object where +instance {-# OVERLAPPING #-} ToSchema Object where declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty & type_ ?~ SwaggerObject & description ?~ "Arbitrary JSON object." @@ -738,10 +708,10 @@ instance (Datatype d, GToSchema f) => GToSchema (D1 d f) where where name = gdatatypeSchemaName opts (Proxy :: Proxy d) -instance OVERLAPPABLE_ GToSchema f => GToSchema (C1 c f) where +instance {-# OVERLAPPABLE #-} GToSchema f => GToSchema (C1 c f) where gdeclareNamedSchema opts _ = gdeclareNamedSchema opts (Proxy :: Proxy f) -instance OVERLAPPING_ Constructor c => GToSchema (C1 c U1) where +instance {-# OVERLAPPING #-} Constructor c => GToSchema (C1 c U1) where gdeclareNamedSchema = gdeclareNamedSumSchema -- | Single field constructor. @@ -804,17 +774,17 @@ withFieldSchema opts _ isRequiredField schema = do fname = T.pack (fieldLabelModifier opts (selName (Proxy3 :: Proxy3 s f p))) -- | Optional record fields. -instance OVERLAPPING_ (Selector s, ToSchema c) => GToSchema (S1 s (K1 i (Maybe c))) where +instance {-# OVERLAPPING #-} (Selector s, ToSchema c) => GToSchema (S1 s (K1 i (Maybe c))) where gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s (K1 i (Maybe c))) False -- | Record fields. -instance OVERLAPPABLE_ (Selector s, GToSchema f) => GToSchema (S1 s f) where +instance {-# OVERLAPPABLE #-} (Selector s, GToSchema f) => GToSchema (S1 s f) where gdeclareNamedSchema opts _ = fmap unnamed . withFieldSchema opts (Proxy2 :: Proxy2 s f) True -instance OVERLAPPING_ ToSchema c => GToSchema (K1 i (Maybe c)) where +instance {-# OVERLAPPING #-} ToSchema c => GToSchema (K1 i (Maybe c)) where gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c) -instance OVERLAPPABLE_ ToSchema c => GToSchema (K1 i c) where +instance {-# OVERLAPPABLE #-} ToSchema c => GToSchema (K1 i c) where gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c) instance ( GSumToSchema f @@ -859,7 +829,7 @@ gsumConToSchema opts proxy schema = do ref <- gdeclareSchemaRef opts proxy return $ gsumConToSchemaWith ref opts proxy schema -instance OVERLAPPABLE_ (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where +instance {-# OVERLAPPABLE #-} (Constructor c, GToSchema f) => GSumToSchema (C1 c f) where gsumToSchema opts proxy schema = do tell (All False) lift $ gsumConToSchema opts proxy schema diff --git a/src/Data/Swagger/Internal/TypeShape.hs b/src/Data/Swagger/Internal/TypeShape.hs index 64e8283..cda418b 100644 --- a/src/Data/Swagger/Internal/TypeShape.hs +++ b/src/Data/Swagger/Internal/TypeShape.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} @@ -37,11 +35,6 @@ type family TypeHasSimpleShape t (f :: Symbol) :: Constraint where type family GenericHasSimpleShape t (f :: Symbol) (s :: TypeShape) :: Constraint where GenericHasSimpleShape t f Enumeration = () GenericHasSimpleShape t f SumOfProducts = () -#if __GLASGOW_HASKELL__ < 800 - GenericHasSimpleShape t f Mixed = CannotDeriveSchemaForMixedSumType t - -class CannotDeriveSchemaForMixedSumType t where -#else GenericHasSimpleShape t f Mixed = TypeError ( Text "Cannot derive Generic-based Swagger Schema for " :<>: ShowType t @@ -51,7 +44,6 @@ class CannotDeriveSchemaForMixedSumType t where :$$: Text "that matches aeson's Generic-based toJSON," :$$: Text "but that's not supported by some Swagger tools." ) -#endif -- | Infer a 'TypeShape' for a generic representation of a type. type family GenericShape (g :: * -> *) :: TypeShape @@ -62,5 +54,3 @@ type instance GenericShape (D1 d f) = GenericShape f type instance GenericShape (C1 c U1) = Enumeration type instance GenericShape (C1 c (S1 s f)) = SumOfProducts type instance GenericShape (C1 c (f :*: g)) = SumOfProducts - - diff --git a/src/Data/Swagger/Lens.hs b/src/Data/Swagger/Lens.hs index cbebebb..6e859e8 100644 --- a/src/Data/Swagger/Lens.hs +++ b/src/Data/Swagger/Lens.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} @@ -10,7 +9,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -#include "overlapping-compat.h" -- | -- Module: Data.Swagger.Lens -- Maintainer: Nickolay Kudasov @@ -118,69 +116,63 @@ instance HasDefault ParamOtherSchema (Maybe Value) where default_ = paramSchema. -- OVERLAPPABLE instances instance -#if __GLASGOW_HASKELL__ >= 710 - OVERLAPPABLE_ -#endif + {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasFormat s (Maybe Format) where format = paramSchema.format instance -#if __GLASGOW_HASKELL__ >= 710 - OVERLAPPABLE_ -#endif + {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasItems s (Maybe (SwaggerItems t)) where items = paramSchema.items instance -#if __GLASGOW_HASKELL__ >= 710 - OVERLAPPABLE_ -#endif + {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMaximum s (Maybe Scientific) where maximum_ = paramSchema.maximum_ -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasExclusiveMaximum s (Maybe Bool) where exclusiveMaximum = paramSchema.exclusiveMaximum -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMinimum s (Maybe Scientific) where minimum_ = paramSchema.minimum_ -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasExclusiveMinimum s (Maybe Bool) where exclusiveMinimum = paramSchema.exclusiveMinimum -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMaxLength s (Maybe Integer) where maxLength = paramSchema.maxLength -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMinLength s (Maybe Integer) where minLength = paramSchema.minLength -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasPattern s (Maybe Text) where pattern = paramSchema.pattern -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMaxItems s (Maybe Integer) where maxItems = paramSchema.maxItems -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMinItems s (Maybe Integer) where minItems = paramSchema.minItems -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasUniqueItems s (Maybe Bool) where uniqueItems = paramSchema.uniqueItems -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasEnum s (Maybe [Value]) where enum_ = paramSchema.enum_ -instance OVERLAPPABLE_ HasParamSchema s (ParamSchema t) +instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t) => HasMultipleOf s (Maybe Scientific) where multipleOf = paramSchema.multipleOf diff --git a/src/Data/Swagger/Schema/Generator.hs b/src/Data/Swagger/Schema/Generator.hs index 1848ca0..a5cca57 100644 --- a/src/Data/Swagger/Schema/Generator.hs +++ b/src/Data/Swagger/Schema/Generator.hs @@ -13,7 +13,6 @@ import Data.Aeson import Data.Aeson.Types import qualified Data.HashMap.Strict.InsOrd as M import Data.Maybe -import Data.Maybe import Data.Proxy import Data.Scientific import qualified Data.Set as S diff --git a/swagger2.cabal b/swagger2.cabal index d979cf3..f84fff5 100644 --- a/swagger2.cabal +++ b/swagger2.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: swagger2 -version: 2.6 +version: 2.6.1 synopsis: Swagger 2.0 data model category: Web, Swagger @@ -22,7 +22,6 @@ extra-source-files: README.md , CHANGELOG.md , examples/*.hs - , include/overlapping-compat.h tested-with: GHC ==8.0.2 || ==8.2.2 @@ -37,7 +36,6 @@ custom-setup library hs-source-dirs: src - include-dirs: include exposed-modules: Data.Swagger Data.Swagger.Declare @@ -61,34 +59,33 @@ library -- GHC boot libraries build-depends: - base >=4.9 && <4.15 - , bytestring >=0.10.4.0 && <0.11 - , containers >=0.5.5.1 && <0.7 - , template-haskell >=2.9.0.0 && <2.17 - , time >=1.4.2 && <1.10 - , transformers >=0.3.0.0 && <0.6 + base >=4.9 && <4.15 + , bytestring >=0.10.8.1 && <0.11 + , containers >=0.5.7.1 && <0.7 + , template-haskell >=2.11.1.0 && <2.17 + , time >=1.6.0.1 && <1.10 + , transformers >=0.5.2.0 && <0.6 build-depends: - mtl >=2.1 && <2.3 + mtl >=2.2.2 && <2.3 , text >=1.2.3.0 && <1.3 -- other dependencies build-depends: - base-compat-batteries >=0.10.4 && <0.12 + base-compat-batteries >=0.11.1 && <0.12 , aeson >=1.4.2.0 && <1.5 , aeson-pretty >=0.8.7 && <0.9 -- cookie 0.4.3 is needed by GHC 7.8 due to time>=1.4 constraint , cookie >=0.4.3 && <0.5 - , generics-sop >=0.3.2.0 && <0.6 + , generics-sop >=0.5.1.0 && <0.6 , hashable >=1.2.7.0 && <1.4 - , http-media >=0.7.1.2 && <0.9 + , http-media >=0.8.0.0 && <0.9 , insert-ordered-containers >=0.2.3 && <0.3 , lens >=4.16.1 && <4.20 , network >=2.6.3.5 && <3.2 , optics-core >=0.2 && <0.4 , optics-th >=0.2 && <0.4 , scientific >=0.3.6.2 && <0.4 - , transformers-compat >=0.3 && <0.7 , unordered-containers >=0.2.9.0 && <0.3 , uuid-types >=1.0.3 && <1.1 , vector >=0.12.0.1 && <0.13 diff --git a/test/Data/Swagger/Schema/ValidationSpec.hs b/test/Data/Swagger/Schema/ValidationSpec.hs index 6d43c99..beade4b 100644 --- a/test/Data/Swagger/Schema/ValidationSpec.hs +++ b/test/Data/Swagger/Schema/ValidationSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE RecordWildCards #-}