This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-29
Channels
- # adventofcode (9)
- # announcements (2)
- # aws (78)
- # babashka (55)
- # beginners (97)
- # biff (9)
- # calva (11)
- # cherry (2)
- # cider (8)
- # clerk (7)
- # clj-kondo (6)
- # clj-on-windows (4)
- # clojure (213)
- # clojure-austin (6)
- # clojure-europe (63)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-spec (10)
- # clojure-uk (1)
- # clojurescript (14)
- # clr (2)
- # community-development (3)
- # conjure (14)
- # datomic (2)
- # deps-new (5)
- # dev-tooling (10)
- # editors (3)
- # emacs (3)
- # etaoin (19)
- # events (4)
- # fulcro (71)
- # holy-lambda (20)
- # java (3)
- # jobs (2)
- # leiningen (4)
- # lsp (24)
- # malli (15)
- # membrane (107)
- # music (1)
- # off-topic (29)
- # pedestal (4)
- # polylith (1)
- # portal (2)
- # rdf (5)
- # releases (7)
- # scittle (5)
- # shadow-cljs (8)
- # tools-build (15)
- # tools-deps (6)
- # xtdb (13)
Hi, I use ‘Malli’ for ‘route data validation’. My problem is that when I validate a large structure and get an error, the output to Emacs and REPL is very slow (other IDEs don’t have this problem), I have to wait several minutes before I can work again (the error output has ~10000 lines). I was thinking of shortening the error somehow, but I have no clear idea how. Has somebody here solved a similar problem?
malli.error/humanize
can reduce the error size, but I'm not sure if you've already tried that or if it will suffice for your problem.
how are you performing the validation? could you do something like (assert (m/validate X Schema) (-> X (m/explain Schema) (me/humanize)))
?
a more general purpose solution might be to defer your error logging to an async logging library like https://github.com/BrunoBonacci/mulog, which provides a ring buffer mechanism that you can hook into with custom transformation functions to output errors and logs that narrow down to the specific thing you're trying to investigate.
I forgot to tell that humanization doesnt work for me.. for unknown reason, this is my coercion in reitit-hander. It would probably help a lot.
(r.coercion.malli/create (-> r.coercion.malli/default-options (assoc :strip-extra-keys true) (update :error-keys #(conj % :humanized))))
@UFTRLDZEW i use timbre currently, but i would like to solve that problem on malli / emacs level first.
@U055NJ5CC Yeah, vscode got it in second.
the colored outputs can be slow, dunno if there is a bug in rendering, fipp is supposed to be fast.
but, not an emacs user (anymore), so not sure what happends there, if calva is fast with the same case.
Did you switch to vscode? Yeah, i do, i will try to disable it, thanks. Is there some easy way for instrumented fns to produce only humanized errors?
• disabling pretty/reporter for instrumentation helped a lot.. closing other windows in emacs as well 😄.
Regarding providing protobuf schema from malli, what do you think about defining a data representation for the protobuf spec (even as an external dependency), then defining the transformation from malli to it? I hate protobuf but it could be useful There are also limitations to account for, like oneOf can't be repeated, which make me pull my hair out