git.iko.soy/typeable/openapi3
on master help sign in
Add comment for GToSchema fix
commitbe57718b5a4a76238ea0127d3d7ea57cda7a6148 authorMaxim Koltsov <kolmax94@gmail.com> dateSun 13 Mar 2022, 16:59 (5 years ago) parent8050047
1 file changed+6−3
src/Data/OpenApi/Internal/Schema.hs+6−3
src/Data/OpenApi/Internal/Schema.hs+6−3
@@ -945,10 +945,13 @@ instance (Selector s, GToSchema f, GToSchema (S1 s f)) => GToSchema (C1 c (S1 s
945945 case schema ^. items of
946946 Just (OpenApiItemsArray [_]) -> fieldSchema
947947 _ -> do
948− NamedSchema _ schema <- recordSchema
949− return (unnamed schema)
948+ -- We have to run recordSchema instead of just using its defs,
949+ -- since those can be recursive and will lead to infinite loop,
950+ -- see https://github.com/biocad/openapi3/pull/37
951+ NamedSchema _ schema' <- recordSchema
952+ return (unnamed schema')
950953 where
951− (defs, NamedSchema _ schema) = runDeclare recordSchema mempty
954+ (_, NamedSchema _ schema) = runDeclare recordSchema mempty
952955 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
953956 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
954957