Is it possible to get malli to coerce blank strings ""
into the :default
value? Example:
(m/decode
[:map [:x {:default 0} int?]]
{:x ""}
(mt/transformer
mt/default-value-transformer
mt/string-transformer))
Should result in {:x 0}
Eh, never mind. I’m thinking this isn’t a great idea. I can just strip empty strings from my data before sending it into malli for coercion. I think that’s clearer and less error-prone.
I noticed that the the schema:
[:schema {:registry {::cons [:maybe [:tuple pos-int? [:ref ::cons]]]}}
::cons]
doesn't work on http://malli.io (it doesn't produce DOT output or JSON schema)
while
[:schema
{:registry {"ConsCell" [:maybe [:tuple :int [:ref "ConsCell"]]]}}
"ConsCell"]
this one does work.
In my applications I would like to use fully qualified keyword schemas (RefSchemas) is there a way to get the transformers to work without walking the schema ahead of time and converting all fully qualified keywords to strings?@ikitommi ::foo
resolves to whatever the current namespace is, by default :user/foo
thanks Tommi - using :user/cons worked. I was also seeing some issues in a local repl regarding refschemas and dot. I'll try to get minimal repro
Welcome to xterm-sci.
user=> ::foo
:user/foo
user=>
https://babashka.org/xterm-sci/hmm... Might be a edamame thing?