malli

https://github.com/metosin/malli :malli:
ikitommi 2021-01-12T16:52:52.362200Z

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.

ikitommi 2021-01-12T17:08:45.374600Z

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?}

ikitommi 2021-01-12T17:12:42.377Z

the schema for :=> children would be something like: [:cat* [:input "SequenceSchema"] [:output "AnySchema"]], where "SequenceSchema" would be a description of sequence schema form

ikitommi 2021-01-12T17:14:31.378300Z

having the :properties in a separate map is simpler, pushing the properties into top-level… looks better.

ikitommi 2021-01-12T17:15:40.379300Z

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?}}

ikitommi 2021-01-12T17:17:19.380700Z

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?}

ikitommi 2021-01-12T17:20:02.382200Z

current with named children:

{:type :=>
 :properties {:doc "title"}
 :children {:input {:type :cat
                    :children [{:type int?}
                               {:type int?}]}
            :output {:type int?}}}