Fork me on GitHub
#malli
<
2021-09-16
>
Yehonathan Sharvit20:09:19

Are there some tools out there that generate a data model diagram (in a format like DOT or PlantUML) from a JSON Schema?

emccue12:09:15

malli can make uml from its own schema

Yehonathan Sharvit20:09:19

I know. But my question is about JSON schema

Yehonathan Sharvit20:09:40

Is there a way to transform a JSON schema into a Malli schema?

emccue20:09:34

Maybe an equivalent question is "are all things representable in JSON schema representable in malli"?

emccue20:09:49

Because i don't think anyone has done that transformation yet

nivekuil21:09:18

could you infer a malli schema from the corresponding json object?

ikitommi16:09:19

I noticed you got already some answer on Twitter @U0L91U7A8, could you share those here too?

Yehonathan Sharvit17:09:32

Unfortunately, none of the answers were satisfactory.

Yehonathan Sharvit17:09:07

The best I could do is to manually convert the JSON schema into Malli and use Malli to generate a plantuml diagram

ikitommi17:09:43

Ok. The new map-syntax is quite close to JSON Schema, which should make the JSON Schema -> Malli streightworward.

Yehonathan Sharvit08:09:31

Indeed. @U055NJ5CC What was the motivation for adding the new map-syntax?

ikitommi10:09:04

1. order of magnitude faster way to instantiate schemas (e.g. ast IS the parsed results, no need to parse hiccup) -> matters on js & mobile 2. the old map-syntax was too generic to be useful 3. creating schemas programmatically behind the scenes is easier with maps (e.g. when inferring schemas from data) 4. itโ€™s good to have options ๐Ÿ˜Ž

๐Ÿ˜Ž 2
Yehonathan Sharvit15:09:05

Makes sense. Thanks

ikitommi10:09:04

1. order of magnitude faster way to instantiate schemas (e.g. ast IS the parsed results, no need to parse hiccup) -> matters on js & mobile 2. the old map-syntax was too generic to be useful 3. creating schemas programmatically behind the scenes is easier with maps (e.g. when inferring schemas from data) 4. itโ€™s good to have options ๐Ÿ˜Ž

๐Ÿ˜Ž 2