This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-06
Channels
- # admin-announcements (1)
- # announcements (32)
- # babashka (38)
- # beginners (91)
- # braveandtrue (1)
- # calva (1)
- # cider (9)
- # cljsrn (19)
- # clojure (129)
- # clojure-bay-area (3)
- # clojure-europe (24)
- # clojure-italy (1)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (24)
- # clojurescript (14)
- # community-development (7)
- # conjure (16)
- # cursive (3)
- # datomic (20)
- # defnpodcast (4)
- # emacs (11)
- # figwheel (2)
- # fulcro (5)
- # helix (6)
- # integrant (3)
- # jackdaw (5)
- # java (6)
- # jobs (1)
- # kaocha (13)
- # lsp (8)
- # malli (29)
- # meander (2)
- # off-topic (120)
- # pathom (3)
- # podcasts-discuss (6)
- # portal (6)
- # re-frame (27)
- # reagent (5)
- # releases (4)
- # remote-jobs (6)
- # rewrite-clj (9)
- # shadow-cljs (108)
- # xtdb (5)
what is the difference between :or and :alt ?
@ikitommi how to define string constant in map spec? e.g version api is a constant
[:enum "v1.0.0"] ?
is there other ways?
and why sets are not supported as spec definition? I cannot put
[:abc #{1 2 3}]
in map spec#{1 2 3}
doesn’t work as we didn’t want to reserver too much clojure syntax for special purposes. There is a hook to add support for that in the user space, but not documented as it’s not recommended.
why? there is a cljs compiler warning about those, coudn’t fix it, instead of: #"kikka.*"
would have been enough to have [:re #"kikka.*]
or even [:string {:format "kikka.*"}]
I think in 90%+ cases people add anyway properties to the regexps like :error/message
, so the benefit for supporting plain regexps is quite small.
An enhancement of regex error messages could be an indication at which character the match has failed. "Should match regex" isn't terribly helpful for humanized errors
Host regexes don't support error positions. And I don't blame them, because the regex can fail in multiple ways at every character (our seqex schemas heuristically give the error the first longest partial match).
If we can do regex based generators we should theoretically be able to do regex based error reporting No one said it would be easy, or even a good idea. You may not want to expose your regex via error messages
[:= "v1.0.0"]👍
Is there a function that would give ":and" instead of ":or"? stricter vs. looser. maybe mu/intersect?
(mu/union [:map [:Event keyword?]] [:map [:Event [:enum :A :B]]])
=> [:map [Event [:or keyword? [:enum :A :B]...
you can configure the the mu/merge
with few options, see`:merge-default` in mu/union
https://github.com/metosin/malli/blob/master/src/malli/util.cljc#L104-L113
any way to get schema name from RefSchema?
e.g. I have [:schema {:registry reg} ::task]
and it’s already a RefSchema
(let [schema (schema ?schema options)]
(cond-> schema (satisfies? RefSchema schema) (-deref)))
@UK0810AQ2 thanks for the input! This gives something that looks like a keyword but in fact is a :malli.core/schema
and I don’t understand how to get the keyword out
what you see in m/children is still a schema! but (-> m/form last) cuts it, thanks!