malli
malli copied to clipboard
Generator generation diverges
While I was trying to describe Malli forms with Malli I noticed that recursive generator generation can diverge:
(mg/generator
[:schema {:registry {::schema [:or
[:= :int] [:= :string]
[:cat [:= :and] [:* [:schema [:ref ::schema]]]]
[:cat [:= :or] [:* [:schema [:ref ::schema]]]]
[:tuple [:= :vector] [:ref ::schema]]]}}
::schema])
; Execution error (OutOfMemoryError) at malli.generator/-create (generator.cljc:219).
; GC overhead limit exceeded
Perhaps malli.generator should use clojure.test.check.generators/recursive-gen instead of the current ad hoc recursion depth limiting? I don't really get the current limits, so can't really say whether they can be made to work for all schemas.
There is such a thing? Please.