@@ -481,6 +481,8 @@ instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy
481instance ToSchema a => ToSchema (IntMap a) where
481instance ToSchema a => ToSchema (IntMap a) where
482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
484+#if MIN_VERSION_aeson(1,0,0)
484instance ToSchema a => ToSchema (Map String a) where
486instance ToSchema a => ToSchema (Map String a) where
485 declareNamedSchema _ = do
487 declareNamedSchema _ = do
486 schema <- declareSchemaRef (Proxy :: Proxy a)
488 schema <- declareSchemaRef (Proxy :: Proxy a)
@@ -495,6 +497,24 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
495instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
497instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
496instance ToSchema a => ToSchema (HashMap TL.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))
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)])
507+ declareObjectMapSchema = do
508+ schema <- declareSchemaRef (Proxy :: Proxy v)
509+ return $ unnamed $ mempty
510+ & type_ .~ SwaggerObject
511+ & additionalProperties ?~ schema
513+instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
514+ declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
498instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
518instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
499instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
519instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
500instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
520instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])