git.iko.soy/typeable/swagger2
on master help sign in
Add ToSchema instances for Ints and Words
07005e2Nickolay Kudasov
src/Data/Swagger/Schema/Internal.hs+13−1
@@ -9,9 +9,11 @@ module Data.Swagger.Schema.Internal where
9
9
10import Control.Lens
10import Control.Lens
11import Data.Aeson
11import Data.Aeson
12+import Data.Int
12import Data.Monoid
13import Data.Monoid
13import Data.Proxy
14import Data.Proxy
14import qualified Data.Text as Text
15import qualified Data.Text as Text
16+import Data.Word
15import GHC.Generics
17import GHC.Generics
16
18
17import Data.Swagger.Internal
19import Data.Swagger.Internal
@@ -40,7 +42,17 @@ instance ToSchema Bool where
40instance ToSchema Integer where
42instance ToSchema Integer where
41 toSchema _ = mempty { _schemaType = SchemaInteger }
43 toSchema _ = mempty { _schemaType = SchemaInteger }
42
44
45+instance ToSchema Int where toSchema = toSchemaBoundedIntegral
46+instance ToSchema Int8 where toSchema = toSchemaBoundedIntegral
47+instance ToSchema Int16 where toSchema = toSchemaBoundedIntegral
48+instance ToSchema Int32 where toSchema = toSchemaBoundedIntegral
49+instance ToSchema Int64 where toSchema = toSchemaBoundedIntegral
50+
51+instance ToSchema Word where toSchema = toSchemaBoundedIntegral
52+instance ToSchema Word8 where toSchema = toSchemaBoundedIntegral
53+instance ToSchema Word16 where toSchema = toSchemaBoundedIntegral
54+instance ToSchema Word32 where toSchema = toSchemaBoundedIntegral
43−instance ToSchema Int where toSchema = toSchemaBoundedIntegral
55+instance ToSchema Word64 where toSchema = toSchemaBoundedIntegral
44
56
45instance ToSchema Double where
57instance ToSchema Double where
46 toSchema _ = mempty { _schemaType = SchemaNumber }
58 toSchema _ = mempty { _schemaType = SchemaNumber }