@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12-- |
23-- Module: Data.Swagger
34-- Maintainer: Nickolay Kudasov <nickolay@getshoptv.com>
@@ -288,6 +289,21 @@ import Data.Swagger.Internal
288289--
289290-- we can not derive a valid schema for a mix of the above. The following will result in a type error
290291--
292+#if __GLASGOW_HASKELL__ < 800
293+-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
294+-- >>> instance ToSchema BadMixedType
295+-- ...
296+-- ... error:
297+-- ... • No instance for (Data.Swagger.Internal.TypeShape.CannotDeriveSchemaForMixedSumType
298+-- ... BadMixedType)
299+-- ... arising from a use of ‘Data.Swagger.Internal.Schema.$dmdeclareNamedSchema’
300+-- ... • In the expression:
301+-- ... Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
302+-- ... In an equation for ‘declareNamedSchema’:
303+-- ... declareNamedSchema
304+-- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
305+-- ... In the instance declaration for ‘ToSchema BadMixedType’
306+#else
291307-- >>> data BadMixedType = ChoiceBool Bool | JustTag deriving Generic
292308-- >>> instance ToSchema BadMixedType
293309-- ...
@@ -304,6 +320,7 @@ import Data.Swagger.Internal
304320-- ... declareNamedSchema
305321-- ... = Data.Swagger.Internal.Schema.$dmdeclareNamedSchema @BadMixedType
306322-- ... In the instance declaration for ‘ToSchema BadMixedType’
323+#endif
307324--
308325-- We can use 'genericDeclareNamedSchemaUnrestricted' to try our best to represent this type as a Swagger Schema and match 'ToJSON':
309326--