This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-28
Channels
- # announcements (5)
- # babashka (7)
- # beginners (101)
- # biff (9)
- # calva (46)
- # cider (6)
- # clj-yaml (2)
- # cljsrn (13)
- # clojure (11)
- # clojure-europe (43)
- # clojure-nl (13)
- # clojure-norway (22)
- # clojurescript (20)
- # conjure (1)
- # cursive (7)
- # data-science (2)
- # datomic (26)
- # emacs (38)
- # graphql (27)
- # gratitude (5)
- # hoplon (8)
- # hugsql (22)
- # humbleui (2)
- # hyperfiddle (6)
- # introduce-yourself (8)
- # joyride (3)
- # lsp (79)
- # malli (6)
- # nbb (67)
- # portal (16)
- # rdf (27)
- # reagent (42)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (36)
- # test-check (17)
- # tools-deps (1)
- # xtdb (15)
Anyone interested in doing / sharing a Schema for def
syntax? like the https://github.com/metosin/malli/blob/master/src/malli/destructure.cljc#L11-L55 here.
actually… this: https://github.com/metosin/malli/blob/master/src/malli/experimental.cljc#L8-L33
if you're touching that code, i think there is an edge case for cljs (maybe clj too) if you have a custom registry - the schemas used for parsing the experimental defn form may not be available - https://github.com/metosin/malli/pull/702/files#diff-8fa8701bc52f9f699e5512b8ea028a44c05033b134751af5f789cd57edcf05ad had to add that line to get it working.
Are closed-schema
and multi
incompatible? I am calling closed-schema
on a schema which includes a multi
nested in it. It fails to validate correctly, but if I remove the closed-schema
, it works as expected.
Example:
(def operator-schema
(malli/schema
[:multi {:dispatch :op}
[:addition [:map
[:summand-1 :int]
[:summand-2 :int]]]
[:multiplication [:map
[:factor-1 :int]
[:factor-2 :int]]]]))
(def equation-schema
(mallu/closed-schema
[:map
[:left-hand-side operator-schema]
[:right-hand-side :int]]))
(malle/humanize (malli/explain equation-schema {:left-hand-side {:op :addition
:summand-1 1
:summand-2 2}
:right-hand-side 3}))
=> {:left-hand-side {:op ["disallowed key"]}}