malli 2024-08-18

Why does this give invalid schema error? (m/schema [:number? {:min 0 :max 10}]) And why does this (m/validate (m/schema [number? {:min 0 :max 10}]) 11) return true?

The first: no schema for keyword :number?, use :number The second: you used a function not a keyword

👍 1

For the latter, it's a https://github.com/metosin/malli/blob/39244905665541c8d895c8b121b6ecf508fc2b18/src/malli/core.cljc#L2580-L2588 which has no support for min/max properties. Though it would be less confusing if it were the same as :number. I think that's achievable with a couple of tweaks.

Is there even a :number schema?

I experimented a bit aligning things like any? and :any. I think it'll look something like this https://github.com/metosin/malli/pull/1092