swagger2 2.1.1 → 2.1.2
raw patch · 3 files changed
+28/−2 lines, 3 filesdep ~aesondep ~insert-ordered-containers
Dependency ranges changed: aeson, insert-ordered-containers
Files
- CHANGELOG.md +6/−0
- src/Data/Swagger/Internal/Schema.hs +20/−0
- swagger2.cabal +2/−2
CHANGELOG.md view
@@ -1,3 +1,9 @@+2.1.2+---++* Minor changes:+ * Support `aeson-1.0.0.0` (see [#70](https://github.com/GetShopTV/swagger2/pull/70)).+ 2.1.1 ---
src/Data/Swagger/Internal/Schema.hs view
@@ -481,6 +481,8 @@ instance ToSchema a => ToSchema (IntMap a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)]) +#if MIN_VERSION_aeson(1,0,0)+ instance ToSchema a => ToSchema (Map String a) where declareNamedSchema _ = do schema <- declareSchemaRef (Proxy :: Proxy a)@@ -494,6 +496,24 @@ 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))++#else++instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where+ declareNamedSchema _ = case toJSONKey :: ToJSONKeyFunction v of+ ToJSONKeyText _ _ -> declareObjectMapSchema+ ToJSONKeyValue _ _ -> declareNamedSchema (Proxy :: Proxy [(k, v)])+ where+ declareObjectMapSchema = do+ schema <- declareSchemaRef (Proxy :: Proxy v)+ return $ unnamed $ mempty+ & type_ .~ SwaggerObject+ & additionalProperties ?~ schema++instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where+ declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))++#endif instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a]) instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
swagger2.cabal view
@@ -1,5 +1,5 @@ name: swagger2-version: 2.1.1+version: 2.1.2 synopsis: Swagger 2.0 data model description: Please see README.md homepage: https://github.com/GetShopTV/swagger2@@ -46,7 +46,7 @@ , hashable , generics-sop >=0.2 && <0.3 , http-media- , insert-ordered-containers >=0.1.0.0 && <0.2+ , insert-ordered-containers >=0.1.0.0 && <0.3 , lens , mtl , network