Fork me on GitHub
#malli
<
2021-08-06
>
richiardiandrea15:08:20

Hello there, I know this is not the right channel but I have a question about spec-tools Is there out there a library for creating graphviz svg from a spec by any chance?

ikitommi17:08:52

I recall there is. Haven't used thou.

richiardiandrea22:08:01

ok thanks I'll google it better, could not find it

richiardiandrea15:08:15

Ah yeah I tried that one, no dice, I thought I saw a spec-tools specific one...however Malli looks super cool and I should try it out 😄 Thanks for the link anyways!

ikitommi20:08:02

Humanized errors might finally work as expected. Fixes all known issues and is much simpler implementation. If someone can still crash it with some input, I’m all 👂s. Maybe we can now remove the safe-humanize from projects 🙂 https://github.com/metosin/malli/pull/502

ikitommi20:08:19

big change is that the humanized form is taken from the first failure. e.g.

(-> [:map [:x [:and [:map [:y :any]] seq?]]]
    (m/explain {:x {}})
    (me/humanize))
;{:x {:y ["missing required key"]
;     :malli/error ["should be a seq"]}}

(-> [:map [:x [:and seq? [:map [:y :any]]]]]
    (m/explain {:x {}})
    (me/humanize))
; {:x ["should be a seq"]}

naomarik20:08:24

that's awesome, really needed that!

ikitommi20:08:41

same with sequences & sets.

Noah Bogart20:08:26

does humanize work with records now?

Noah Bogart20:08:58

well, i guess i should say that that’s part of explain, not humanize so nvm lol

ikitommi20:08:46

records, good question, will test

ikitommi20:08:23

nope:

actual: java.lang.UnsupportedOperationException: Can't create empty: malli.error_test.Horror
 at malli.error_test.Horror.empty (error_test.cljc:549)
    clojure.core$empty.invokeStatic (core.clj:5236)
    malli.error$_assoc_in.invokeStatic (error.cljc:147)

Noah Bogart20:08:40

a simple (into {} rec) works for me right now

ikitommi20:08:41

idea how to create empty records?

Noah Bogart20:08:02

i don’t believe you can, lol

Noah Bogart20:08:54

that’s for spec but discusses the issue

ikitommi20:08:58

the humanized for doesn’t preserve the Records, but then again, it forces all sequences to vectors. it’s for… humans.

Noah Bogart20:08:07

hell yeah, thank you so much

ikitommi20:08:03

merged in master

ikitommi20:08:54

merged also the new pretty (schema error) printer into master. Not expound, but one could build such on top of this.

😎 6