git.iko.soy/typeable/swagger2
on master help sign in
Merge pull request #72 from phadej/issue-71

Add travis entries with aeson-0.11

commit1d892fba879c2a8c8cb2a7404cd7c287af991872 authorOleg Grenrus <oleg.grenrus@iki.fi> dateTue 9 Aug 2016, 16:55 (10 years ago) parentaf164c1b6eeea0
5 files changed+32−17
.travis.yml+10 CHANGELOG.md+5 aeson-0.11.cabal.config+1 src/Data/Swagger/Internal/Schema.hs+15−16 swagger2.cabal+1−1
.travis.yml+10
@@ -22,10 +22,20 @@ matrix:
2222 - env: CABALVER=1.24 GHCVER=8.0.1
2323 compiler: ": #GHC 8.0.1"
2424 addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5], sources: [hvr-ghc]}}
25+ - env: CABALVER=1.18 GHCVER=7.8.4 CABALCONFIG=aeson-0.11.cabal.config
26+ compiler: ": #GHC 7.8.4 aeson-0.11"
27+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5], sources: [hvr-ghc]}}
28+ - env: CABALVER=1.22 GHCVER=7.10.3 CABALCONFIG=aeson-0.11.cabal.config
29+ compiler: ": #GHC 7.10.3 aeson-0.11"
30+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5], sources: [hvr-ghc]}}
31+ - env: CABALVER=1.24 GHCVER=8.0.1 CABALCONFIG=aeson-0.11.cabal.config
32+ compiler: ": #GHC 8.0.1 aeson-0.11"
33+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5], sources: [hvr-ghc]}}
2534
2635before_install:
2736 - unset CC
2837 - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/1.19.5/bin:$PATH
38+ - if [ -f "$CABALCONFIG" ]; then cp $CABALCONFIG cabal.config; fi
2939
3040install:
3141 - cabal --version
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+2.1.2.1
2+-------
3+
4+* Bug fix previous release
5+
162.1.2
27---
38
aeson-0.11.cabal.confignew file+1
@@ -0,0 +1 @@
1+constraints: aeson ==0.11.*
src/Data/Swagger/Internal/Schema.hs+15−16
@@ -482,6 +482,21 @@ instance ToSchema a => ToSchema (IntMap a) where
482482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
483483
484484#if MIN_VERSION_aeson(1,0,0)
485+instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
486+ declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction k of
487+ ToJSONKeyText _ _ -> declareObjectMapSchema
488+ ToJSONKeyValue _ _ -> declareNamedSchema (Proxy :: Proxy [(k, v)])
489+ where
490+ declareObjectMapSchema = do
491+ schema <- declareSchemaRef (Proxy :: Proxy v)
492+ return $ unnamed $ mempty
493+ & type_ .~ SwaggerObject
494+ & additionalProperties ?~ schema
495+
496+instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
497+ declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
498+
499+#else
485500
486501instance ToSchema a => ToSchema (Map String a) where
487502 declareNamedSchema _ = do
@@ -497,22 +512,6 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
497512instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
498513instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
499514
500−#else
501−
502−instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
503− declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction v of
504− ToJSONKeyText _ _ -> declareObjectMapSchema
505− ToJSONKeyValue _ _ -> declareNamedSchema (Proxy :: Proxy [(k, v)])
506− where
507− declareObjectMapSchema = do
508− schema <- declareSchemaRef (Proxy :: Proxy v)
509− return $ unnamed $ mempty
510− & type_ .~ SwaggerObject
511− & additionalProperties ?~ schema
512−
513−instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
514− declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
515−
516515#endif
517516
518517instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
swagger2.cabal+1−1
@@ -1,5 +1,5 @@
11name: swagger2
2−version: 2.1.2
2+version: 2.1.2.1
33synopsis: Swagger 2.0 data model
44description: Please see README.md
55homepage: https://github.com/GetShopTV/swagger2