malli

igrishaev 2025-09-23T15:21:59.822109Z

Today, I have a big disaster related to malli. I have a very complex schema for parsing incoming data, a kind of DSL. Lots of fields are declared as catn , orn and so on. These fields return pairs like [:integer 123] or [:string "foobar"] for example. When processing them, I have a common pattern like this:

(let [[tag value] parsed]
  (case tag
    :integer (process-as-integer value)
    :string (process-as-string value)))
quite many such fragments across the code base. Now, somebody has bumped malli and turned out, cant,orn and other parsing schemas return not pairs but a custom type Tag which is nothing but a defmap with the following keys:
{:key :integer :value 3000}
This map is completely different to a pair [:integer 3000] which I had before. Now I'm completely lost: the entire parsing & processing pipeline is broken due to another data format (vector -> map). Just wondering, is there is way to use old-style tags somehow? A flag maybe or something similar?

2025-09-23T15:25:43.274619Z

i believe this was implemented here: https://github.com/metosin/malli/pull/1150

2025-09-23T15:27:02.134419Z

why did you update the version? can you roll back?

igrishaev 2025-09-23T15:28:30.533109Z

This is a matter of several internal libraries. Two or three of them use malli, and someone has pumped it. I can rollback of course but sooner or later somebody do it again

ilmo 2025-09-23T15:30:32.861709Z

Fwiw, I also ran into this. I basically had to write compatibility for both pre and post versions of this breaking change. At the time I wasn’t able to find a ”feature flag” for compatibility.

ilmo 2025-09-23T15:32:46.077379Z

Link if you are interested: https://github.com/metosin/oksa/issues/25

igrishaev 2025-09-23T15:33:38.473689Z

I just wanted to stress how upset I am now with that breaking change, and honestly I would never anticipate it from such a good library

ilmo 2025-09-23T15:37:27.341429Z

I hear you, I would have also hoped for some kind of a flag :) FWIW, I’m ex-metosin, so can’t really reach them, but maybe creating an issue out of this would be a start?

igrishaev 2025-09-23T17:17:31.446209Z

Yeah maybe... I'm thinking if it's possible to extend defrecord such that it supports nth

igrishaev 2025-09-23T17:44:57.043789Z

Actually, this tweak works fine, now the question is, if they OK to accept such a pr:

(defrecord Tag [key value]
  clojure.lang.Indexed
  (nth [_ i]
    (case (long i)
      0 key
      1 value
      (throw (new IndexOutOfBoundsException))))
  (nth [_ i not-found]
    (case (long i)
      0 key
      1 value
      not-found)))

igrishaev 2025-09-23T18:02:05.792009Z

https://github.com/metosin/malli/pull/1223

opqdonut 2025-09-25T09:44:00.346269Z

I'm sorry for the breakage @igrishaev, we could've done a better job highlighting the breakage. I think we underestimated how many people are using parsing this heavily.