@@ -481,6 +481,8 @@ instance ToSchema IntSet where declareNamedSchema _ = declareNamedSchema (Proxy
481481instance ToSchema a => ToSchema (IntMap a) where
482482 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [(Int, a)])
483483
484+#if MIN_VERSION_aeson(1,0,0)
485+
484486instance ToSchema a => ToSchema (Map String a) where
485487 declareNamedSchema _ = do
486488 schema <- declareSchemaRef (Proxy :: Proxy a)
@@ -495,6 +497,24 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
495497instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
496498instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
497499
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
517+
498518instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
499519instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
500520instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])