This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-20
Channels
- # aleph (1)
- # announcements (1)
- # aws (11)
- # babashka (117)
- # beginners (34)
- # calva (13)
- # cider (3)
- # clj-commons (8)
- # clj-kondo (24)
- # clj-yaml (36)
- # cljsrn (46)
- # clojure (50)
- # clojure-australia (5)
- # clojure-europe (239)
- # clojure-nl (3)
- # clojure-norway (3)
- # clojure-spec (16)
- # clojurescript (25)
- # core-typed (20)
- # cursive (41)
- # datahike (1)
- # datalevin (1)
- # datomic (17)
- # fulcro (27)
- # hyperfiddle (35)
- # introduce-yourself (1)
- # jobs (4)
- # lsp (20)
- # malli (8)
- # meander (8)
- # nbb (1)
- # off-topic (31)
- # parinfer (9)
- # pathom (3)
- # portal (2)
- # re-frame (20)
- # react (2)
- # reagent (8)
- # releases (1)
- # remote-jobs (4)
- # scittle (2)
- # shadow-cljs (8)
- # slack-help (4)
- # sql (30)
- # squint (3)
- # tools-deps (34)
- # xtdb (21)
Hi everyone !
I have a question regarding malli.error/humanize
and a sequential
schema.
I have modified the example given in the README.
Instead of having a nil
latitude, I put a string.
(-> Address
(m/explain
{:id "ID676"
:tags #{:artesan :coffee :garden}
:address {:street "Ahlmanintie 29"
:city "paris"
:zip 33100
:lonlat [61.4858322, "23.89"]}})
(me/humanize))
=> {:address {:lonlat [nil ["should be a double"]]}}
I was expecting in the humanized error, this output :
{:address {:lonlat ["23.89" ["should be a double"]]}}
The result of m/explain
indicates clearly in the errors that the input “23.89" is incorrect.
{:schema [:map
[:id string?]
[:tags [:set keyword?]]
[:address [:map [:street string?] [:city string?] [:zip int?] [:lonlat [:tuple double? double?]]]]],
:value {:id "Hiram",
:tags #{:coffee :artesan :garden},
:address {:street "Ahlmanintie 29", :city "paris", :zip 33100, :lonlat [61.4858322 "23.89"]}},
:errors ({:path [:address :lonlat 1], :in [:address :lonlat 1], :schema double?, :value "23.89"})}
Is it normal ?
Thnak you very muchthis is normal, for sequential, nil
are used to mask the valid values, e.g. “second and fourth elements in error” = [nil nil ["error"] nil ["error"]]
you can configure how to show the valid values, e.g.
(-> Address
(m/explain
{:id "Lillan"
:tags #{:artesan "coffee" :garden "ground"}
:address {:street "Ahlmanintie 29"
:zip 33100
:lonlat [61.4858322, "23.7832851,17"]}})
(me/error-value {::me/mask-valid-values '...}))
;{:id ...
; :tags #{"coffee" "ground" ...}
; :address {:street ...
; :zip ...
; :lonlat [... "23.7832851,17"]}}
Alright ! Thank you very much 👍
It seems that me/error-value
is not available in 0.8.9
?
Do you plan to release malli this month ?
Thank you for the excellent work 🙏