git.iko.soy/typeable/swagger2
on master help sign in
Add ToSchema and ToParamSchema instances for Vector
bb39ab4Nickolay Kudasov
src/Data/Swagger/Internal/ParamSchema.hs+9
@@ -25,6 +25,10 @@ import Data.Scientific
25import qualified Data.Text as T
25import qualified Data.Text as T
26import qualified Data.Text.Lazy as TL
26import qualified Data.Text.Lazy as TL
27import Data.Time
27import 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
28import Data.Word
32import Data.Word
29
33
30import Data.Swagger.Internal
34import Data.Swagger.Internal
@@ -178,6 +182,11 @@ instance ToParamSchema a => ToParamSchema [a] where
178 & type_ .~ SwaggerArray
182 & type_ .~ SwaggerArray
179 & items ?~ SwaggerItemsPrimitive Nothing (toParamSchema (Proxy :: Proxy a))
183 & items ?~ SwaggerItemsPrimitive Nothing (toParamSchema (Proxy :: Proxy a))
180
184
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+
181instance ToParamSchema a => ToParamSchema (Set a) where
190instance ToParamSchema a => ToParamSchema (Set a) where
182 toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
191 toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
183 & uniqueItems ?~ True
192 & uniqueItems ?~ True
src/Data/Swagger/Internal/Schema.hs+9
@@ -40,6 +40,10 @@ import Data.Set (Set)
40import qualified Data.Text as T
40import qualified Data.Text as T
41import qualified Data.Text.Lazy as TL
41import qualified Data.Text.Lazy as TL
42import Data.Time
42import 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
43import Data.Word
47import Data.Word
44import GHC.Generics
48import GHC.Generics
45
49
@@ -358,6 +362,11 @@ instance ToSchema a => ToSchema (HashMap String a) where declareNamedSchema _ =
358instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
362instance ToSchema a => ToSchema (HashMap T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
359instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
363instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
360
364
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+
361instance ToSchema a => ToSchema (Set a) where
370instance ToSchema a => ToSchema (Set a) where
362 declareNamedSchema _ = do
371 declareNamedSchema _ = do
363 schema <- declareSchema (Proxy :: Proxy [a])
372 schema <- declareSchema (Proxy :: Proxy [a])