git.iko.soy/typeable/swagger2
on master help sign in
Merge pull request #72 from phadej/issue-71
1d892fbOleg Grenrus
.travis.yml+10
@@ -22,10 +22,20 @@ matrix:
22 - env: CABALVER=1.24 GHCVER=8.0.1
22 - env: CABALVER=1.24 GHCVER=8.0.1
23 compiler: ": #GHC 8.0.1"
23 compiler: ": #GHC 8.0.1"
24 addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5], sources: [hvr-ghc]}}
24 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]}}
25
34
26before_install:
35before_install:
27 - unset CC
36 - unset CC
28 - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/1.19.5/bin:$PATH
37 - 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
29
39
30install:
40install:
31 - cabal --version
41 - cabal --version
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+2.1.2.1
2+-------
3+
4+* Bug fix previous release
5+
12.1.2
62.1.2
2---
7---
3
8
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
482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
483
483
484#if MIN_VERSION_aeson(1,0,0)
484#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
485
500
486instance ToSchema a => ToSchema (Map String a) where
501instance ToSchema a => ToSchema (Map String a) where
487 declareNamedSchema _ = do
502 declareNamedSchema _ = do
@@ -497,22 +512,6 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
497instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
512instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
498instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
513instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
499
514
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−
516#endif
515#endif
517
516
518instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
517instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
swagger2.cabal+1−1
@@ -1,5 +1,5 @@
1name: swagger2
1name: swagger2
2−version: 2.1.2
2+version: 2.1.2.1
3synopsis: Swagger 2.0 data model
3synopsis: Swagger 2.0 data model
4description: Please see README.md
4description: Please see README.md
5homepage: https://github.com/GetShopTV/swagger2
5homepage: https://github.com/GetShopTV/swagger2