Fork me on GitHub
#malli
<
2020-03-04
>
plexus15:03:34

I vaguely remember talk at ClojuTRE about generating forms / UI based on Malli. Has anyone tried something like that? Any interesting pointers?

zilti16:03:09

Yea that is something I am highly interested in finding out

4
ikitommi18:03:18

generating UIs - there are many ways to do that: 1. walk the malli schema and emit an ui-application out of that, did a quick hack of that in a project, reagent + antd 2. walk the malli schema and emit an ui-schema out of that, to be rendered somehow 3. have both malli schema (“the model”) and an ui-schema (“the layout”) and use them together to generate the ui

👍 8
👀 4
ikitommi18:03:49

in 1 & 2, the malli.visitor needs 1-2 extra args to be usefull: all walked schemas should know their place in the schema (e.g. the :in in explain) and in the data (the :path). This enables the ui-elements to be standalone, the ui-component knows where in the app-state the data needs to be stored.

ikitommi18:03:22

I used formik-style custom helper to get the usability-stuff done right, dirty form state etc.

ikitommi18:03:04

but, nothing Ready now, if someone has time and skills at making awesome forms, happy to help with that.

ikitommi18:03:43

there is https://domino-clj.github.io/, idea was that it’s own model could be swapped with malli (just need a protocol to abstract the model and make malli-domino wrapper). It has also a graph-engine to calculate values & other cool features.

ikitommi18:03:56

checked the js-side form generators last year, some good things to learn from there, e.g. https://github.com/rjsf-team/react-jsonschema-form & https://jsonforms.io/

ikitommi18:03:49

in my ad-hoc generator, had ui-hints as properties like this: [:and {:ui/label "arvostelu", :ui/type :rate} int?]