about the sequence schemas, expecially @borkdude, comments most welcome (https://github.com/metosin/malli/pull/317#issuecomment-758559373): > I would say either disallow non-regular grammars or use GLL and take the first valid parse (in basic APIs). Ambiguous grammars are typical in natural language processing but probably bugs in API definitions and despite Instaparse most people know regexes far better than context-free parsing. So I think general parsing would be overkill and possibly even harmful. On the other hand I don’t know what is expected when Malli is used to build linters and stuff.
What if the map-syntax was changed to more compact (cljfx-style) form? the vector syntax:
[:=> {:doc "title"} [:cat int? int?] int?]
can currently be presented as:
{:type :=>
:properties {:doc "title"}
:children [{:type :cat
:children [{:type int?}
{:type int?}]}
{:type int?}]}
with compact map notation (e.g. use tags from schema child definitions as keys):
{:malli/type :=>
:doc "title"
:input {:malli/type :cat
:elements [{:malli/type int?}
{:malli/type int?}]}
:output {:malli/type int?}
the schema for :=>
children would be something like: [:cat* [:input "SequenceSchema"] [:output "AnySchema"]]
, where "SequenceSchema"
would be a description of sequence schema form
having the :properties
in a separate map is simpler, pushing the properties into top-level… looks better.
keeping the props under own key:
{:malli/type :=>
:properties {:doc "title"}
:input {:malli/type :cat
:elements [{:malli/type int?}
{:malli/type int?}]}
:output {:malli/type int?}}
using a spesific namespace for named chidren (does not support qualified names of childs, bad):
{:malli/type :=>
:doc "title"
:schema/input {:malli/type :cat
:schema/elements [{:malli/type int?}
{:malli/type int?}]}
:schema/output {:malli/type int?}
current with named children:
{:type :=>
:properties {:doc "title"}
:children {:input {:type :cat
:children [{:type int?}
{:type int?}]}
:output {:type int?}}}