git.iko.soy/typeable/swagger2
on master help sign in
Name schema in genericToNamedSchemaBoundedEnum
commit3a4aee2c145f3ff4112f5678853f2c680f38fc97 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateTue 24 Nov 2015, 15:26 (11 years ago) parentc831923
1 file changed+6−2
src/Data/Swagger/Schema/Internal.hs+6−2
src/Data/Swagger/Schema/Internal.hs+6−2
@@ -6,6 +6,7 @@
66{-# LANGUAGE PolyKinds #-}
77{-# LANGUAGE ScopedTypeVariables #-}
88{-# LANGUAGE TupleSections #-}
9+{-# LANGUAGE TypeFamilies #-}
910{-# LANGUAGE TypeOperators #-}
1011{-# LANGUAGE TypeSynonymInstances #-}
1112module Data.Swagger.Schema.Internal where
@@ -158,8 +159,11 @@ toSchemaBoundedEnum _ = mempty
158159 & schemaType .~ SchemaString
159160 & schemaEnum ?~ map toJSON [minBound..maxBound :: a]
160161
161−genericToNamedSchemaBoundedEnum :: (ToJSON a, Bounded a, Enum a, Generic a) => proxy a -> NamedSchema
162−genericToNamedSchemaBoundedEnum = unnamed . toSchemaBoundedEnum
162+genericToNamedSchemaBoundedEnum :: forall a d f proxy.
163+ ( ToJSON a, Bounded a, Enum a
164+ , Generic a, Rep a ~ D1 d f, Datatype d)
165+ => SchemaOptions -> proxy a -> NamedSchema
166+genericToNamedSchemaBoundedEnum opts proxy = (gdatatypeSchemaName opts (Proxy :: Proxy d), toSchemaBoundedEnum proxy)
163167
164168genericToSchema :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> proxy a -> Schema
165169genericToSchema opts = snd . genericToNamedSchema opts