git.iko.soy/typeable/openapi3
on master help sign in
Force legal types on derived ToSchema instances
28bf349Alejandro D. P
src/Data/Swagger/Internal/Schema.hs+7−1
@@ -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
67
68
68#if __GLASGOW_HASKELL__ < 800
69#if __GLASGOW_HASKELL__ < 800
69#else
70#else
@@ -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)
710
711
711−instance (GSumToSchema f, GSumToSchema g) => GToSchema (f :+: g) where
712+instance ( GSumToSchema f
713+ , GSumToSchema g
714+ , LegalShape (GenericShape (f :+: g))
715+
716+ ) => GToSchema (f :+: g)
717+ where
712 gdeclareNamedSchema = gdeclareNamedSumSchema
718 gdeclareNamedSchema = gdeclareNamedSumSchema
713
719
714gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
720gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema