@@ -6,6 +6,7 @@
6{-# LANGUAGE PolyKinds #-}
6{-# LANGUAGE PolyKinds #-}
7{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE ScopedTypeVariables #-}
8{-# LANGUAGE TupleSections #-}
8{-# LANGUAGE TupleSections #-}
9+{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeOperators #-}
10{-# LANGUAGE TypeOperators #-}
10{-# LANGUAGE TypeSynonymInstances #-}
11{-# LANGUAGE TypeSynonymInstances #-}
11module Data.Swagger.Schema.Internal where
12module Data.Swagger.Schema.Internal where
@@ -158,8 +159,11 @@ toSchemaBoundedEnum _ = mempty
158 & schemaType .~ SchemaString
159 & schemaType .~ SchemaString
159 & schemaEnum ?~ map toJSON [minBound..maxBound :: a]
160 & schemaEnum ?~ map toJSON [minBound..maxBound :: a]
161−genericToNamedSchemaBoundedEnum :: (ToJSON a, Bounded a, Enum a, Generic a) => proxy a -> NamedSchema
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
162−genericToNamedSchemaBoundedEnum = unnamed . toSchemaBoundedEnum
166+genericToNamedSchemaBoundedEnum opts proxy = (gdatatypeSchemaName opts (Proxy :: Proxy d), toSchemaBoundedEnum proxy)
164genericToSchema :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> proxy a -> Schema
168genericToSchema :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> proxy a -> Schema
165genericToSchema opts = snd . genericToNamedSchema opts
169genericToSchema opts = snd . genericToNamedSchema opts