@@ -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