git.iko.soy/typeable/swagger2
on master help sign in
Stop producing unused definitions for generic schemas (#37)
commit37525ce2fed984c7f4d361be64cd3d6a5f218693 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 18 Jan 2016, 15:28 (11 years ago) parentba83080
1 file changed+5−3
src/Data/Swagger/Internal/Schema.hs+5−3
src/Data/Swagger/Internal/Schema.hs+5−3
@@ -448,12 +448,14 @@ instance {-# OVERLAPPING #-} Constructor c => GToSchema (C1 c U1) where
448448instance (Selector s, GToSchema f) => GToSchema (C1 c (S1 s f)) where
449449 gdeclareNamedSchema opts _ s
450450 | unwrapUnaryRecords opts = fieldSchema
451− | otherwise = do
452− (_, schema) <- recordSchema
451+ | otherwise =
453452 case schema ^. schemaItems of
454453 Just (SwaggerItemsArray [_]) -> fieldSchema
455− _ -> pure (unnamed schema)
454+ _ -> do
455+ declare defs
456+ return (unnamed schema)
456457 where
458+ (defs, (_, schema)) = runDeclare recordSchema mempty
457459 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
458460 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
459461