This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-15
Channels
- # babashka (41)
- # beginners (47)
- # calva (7)
- # cider (5)
- # cljsrn (2)
- # clojure (38)
- # clojure-europe (74)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-uk (38)
- # clojurescript (42)
- # component (30)
- # core-async (2)
- # cryogen (6)
- # cursive (47)
- # datahike (7)
- # datomic (18)
- # defnpodcast (1)
- # fulcro (17)
- # graalvm (8)
- # graphql (4)
- # helix (5)
- # honeysql (5)
- # introduce-yourself (1)
- # jobs (5)
- # jobs-discuss (4)
- # malli (20)
- # meander (4)
- # mental-health (1)
- # off-topic (41)
- # pathom (18)
- # podcasts-discuss (2)
- # re-frame (20)
- # react (1)
- # reagent (22)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # reveal (2)
- # sci (10)
- # shadow-cljs (42)
- # sql (20)
- # tools-deps (7)
- # vim (2)
- # xtdb (51)
Hey folks 👋
Why explain
keeps passing values forward when previous operations in an and
condition have already failed?
(m/explain
[:map
[:name
[:and string?
[:not {:error/message "non empty string"} empty?]]]]
{:name 1})
The example above throws Don't know how to create ISeq from: java.lang.Long
. It does at (empty? 1)
. The conditions are concatenated with an and
operator, so I wasn't expecting [:not {:error/message "non empty string"} empty?]
to run because string?
failed in the first place.
Note: there are probably better ways to express a non-empty string with Malli 😅yes, I think it’s better to have keyword types (e.g. :string
) with properties than to use the existing core functions, of which, many throw on invalid input.
@U95NTJT4H thanks for the suggestion – I knew there was a better way to solve that problem.
Glad that helped 🙂
@U055NJ5CC got it. For custom keyword types, we would have to provide a registry, right?
So, I assume Malli will check the value against every keyword type of a field, even when using an AND operator and the first check fails, in order to get a complete errors map in the first run :thinking_face:
Got it.. thanks @U055NJ5CC
Hi! I try to use malli as coercion&schemas with swagger ui. If i try serialise recursive schemas with registries, i get some "Could not resolve reference" of keys of recursive values. it is according to plan and swagger bad, or its just undone feature?) looks like there is some missing defs in swagger.json
@UNJE65T24 It might be that the references should copied to top-level swagger. If you can provide a minimal repro, would help solving
@U055NJ5CC i use swagger-ui bundled with
[metosin/reitit-swagger-ui "0.5.13"]
[metosin/ring-swagger-ui "3.36.0"]
guess it 3.XX