git.iko.soy/typeable/swagger2
on master help sign in
Add ToSchema and ToParamSchema instances for Vector
commitbb39ab4675e235aa881e8b7da6a63cb740a70b99 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateTue 2 Feb 2016, 02:34 (11 years ago) parent104bce6
2 files changed+18
src/Data/Swagger/Internal/ParamSchema.hs+9 src/Data/Swagger/Internal/Schema.hs+9
src/Data/Swagger/Internal/ParamSchema.hs+9
@@ -25,6 +25,10 @@ import Data.Scientific
2525import qualified Data.Text as T
2626import qualified Data.Text.Lazy as TL
2727import Data.Time
28+import qualified Data.Vector as V
29+import qualified Data.Vector.Primitive as VP
30+import qualified Data.Vector.Storable as VS
31+import qualified Data.Vector.Unboxed as VU
2832import Data.Word
2933
3034import Data.Swagger.Internal
@@ -178,6 +182,11 @@ instance ToParamSchema a => ToParamSchema [a] where
178182 & type_ .~ SwaggerArray
179183 & items ?~ SwaggerItemsPrimitive Nothing (toParamSchema (Proxy :: Proxy a))
180184
185+instance ToParamSchema a => ToParamSchema (V.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
186+instance ToParamSchema a => ToParamSchema (VP.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
187+instance ToParamSchema a => ToParamSchema (VS.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
188+instance ToParamSchema a => ToParamSchema (VU.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
189+
181190instance ToParamSchema a => ToParamSchema (Set a) where
182191 toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
183192 & uniqueItems ?~ True
src/Data/Swagger/Internal/Schema.hs+9
@@ -40,6 +40,10 @@ import Data.Set (Set)
4040import qualified Data.Text as T
4141import qualified Data.Text.Lazy as TL
4242import Data.Time
43+import qualified Data.Vector as V
44+import qualified Data.Vector.Primitive as VP
45+import qualified Data.Vector.Storable as VS
46+import qualified Data.Vector.Unboxed as VU
4347import Data.Word
4448import GHC.Generics
4549
@@ -358,6 +362,11 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
358362instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
359363instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
360364
365+instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
366+instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
367+instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
368+instance ToSchema a => ToSchema (VP.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
369+
361370instance ToSchema a => ToSchema (Set a) where
362371 declareNamedSchema _ = do
363372 schema <- declareSchema (Proxy :: Proxy [a])