reitit

Sardtok 2024-11-26T14:42:27.651519Z

Is there a way to replace a single decoder in the json-transformer of the malli coercer in reitit? I have an API that I'm converting from Liberator to reitit, and it used to support string values for decimal numbers, so I'd like to comp the -string->double and -number->double, but I'd rather not rewrite the whole malli.transform/json-transformer. It's probably something simple that I'm overlooking, but I can't see an easy way to push a new decoder in there.

opqdonut 2024-11-26T14:43:11.334119Z

you can set a custom decoder for that schema, using malli props

🙇 1
opqdonut 2024-11-26T14:44:04.708279Z

(m/decode
  [string? {:decode/string clojure.string/upper-case}]
  "kerran" mt/string-transformer)
; => "KERRAN"

Sardtok 2024-11-26T14:44:28.318279Z

Thanks!

opqdonut 2024-11-26T14:45:06.367969Z

happy to help!