@@ -64,6 +64,7 @@ import Data.Swagger.Internal.ParamSchema (ToParamSchema(..))
64import Data.Swagger.Lens hiding (name, schema)
64import Data.Swagger.Lens hiding (name, schema)
65import qualified Data.Swagger.Lens as Swagger
65import qualified Data.Swagger.Lens as Swagger
66import Data.Swagger.SchemaOptions
66import Data.Swagger.SchemaOptions
67+import Data.Swagger.Internal.TypeShape
68#if __GLASGOW_HASKELL__ < 800
69#if __GLASGOW_HASKELL__ < 800
@@ -708,7 +709,12 @@ instance OVERLAPPING_ ToSchema c => GToSchema (K1 i (Maybe c)) where
708instance OVERLAPPABLE_ ToSchema c => GToSchema (K1 i c) where
709instance OVERLAPPABLE_ ToSchema c => GToSchema (K1 i c) where
709 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
710 gdeclareNamedSchema _ _ _ = declareNamedSchema (Proxy :: Proxy c)
711−instance (GSumToSchema f, GSumToSchema g) => GToSchema (f :+: g) where
712+instance ( GSumToSchema f
714+ , LegalShape (GenericShape (f :+: g))
716+ ) => GToSchema (f :+: g)
712 gdeclareNamedSchema = gdeclareNamedSumSchema
718 gdeclareNamedSchema = gdeclareNamedSumSchema
714gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
720gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema