malli
malli copied to clipboard
nested :repeat sequence schema's doesn't seem to work
using 0.8.9,
if I evaluate (m/validate [:repeat [:repeat :int]] [[1 2 3] [4 5]])
I'm getting
Execution error (OutOfMemoryError) at malli.impl.regex/repeat-validator$optionals (regex.cljc:348).
Java heap space
Maybe this is not the right way to create a schema for multi-dimensional seqs, but that is not obvious, and there is nothing about it in the docs...
This little experiment does not work either
(m/validate [:schema {:registry {"line" [:repeat :int]}} [:repeat "line"]] [[1 2] [3 4]])
I'm marking this a bug and leaving open, should not blow up.
For your case, multi-dimensional seq can be presented either using normal :sequential
(best fit for homogenous sequences) or with sequential schemas:
(m/validate [:sequential [:sequential :int]] [[1 2 3] [4 5]])
; => true
(m/validate [:repeat [:schema [:repeat :int]]] [[1 2 3] [4 5]])
; => true
Ok thanks for the tips