malli

adham 2025-01-10T09:28:41.909449Z

Hello everyone! I'm having issues writing a schema for a sequence of numbers Minimum Example

(defn tmp []
  (list
   {:name "FooBar", :data [[2022 1900000.0] [2023 25E4]]}))

(m/explain (m/schema [:sequential
                      [:map
                       [:name :string]
                       [:data [:cat int? number?]]]])
           (tmp))
;; => {:schema [:sequential [:map [:name :string] [:data [:cat int? number?]]]],
;;     :value ({:name "FooBar", :data [[2022 1900000.0] [2023 250000.0]]}),
;;     :errors
;;     ({:path [0 :data 0], :in [0 :data 0], :schema int?, :value [2022 1900000.0]})}

(int? 2022)
;; => true
(number? 1900000.0)
;; => true
What am I doing wrong here?

adham 2025-01-10T09:30:27.108769Z

Figured it out, I needed to use :sequential so it becomes [:sequential [:cat int? number?]]

opqdonut 2025-01-10T09:53:10.709139Z

yeah, otherwise it's just on pair of numbers