File tree 3 files changed +25
-22
lines changed
3 files changed +25
-22
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Malli is in well matured [alpha](README.md#alpha).
22
22
* use ` :gen/return nil ` property to restore this behavior
23
23
* Support decoding map keys into keywords for ` [:map ` schemas in ` json-transformer ` [ #1135 ] ( https://github.com/metosin/malli/issues/1135 )
24
24
* FIX: ` malli.registry/{mode,type} ` not respected in Babashka [ #1124 ] ( https://github.com/metosin/malli/issues/1124 )
25
+ * FIX: ` :float ` missing humanizer [ #1122 ] ( https://github.com/metosin/malli/issues/1122 )
25
26
* Updated dependencies:
26
27
27
28
```
Original file line number Diff line number Diff line change 135
135
negated " should be a string" )))}}
136
136
:int {:error/fn {:en (-pred-min-max-error-fn {:pred int?, :message " should be an integer" })}}
137
137
:double {:error/fn {:en (-pred-min-max-error-fn {:pred double?, :message " should be a double" })}}
138
+ :float {:error/fn {:en (-pred-min-max-error-fn {:pred float?, :message " should be a float" })}}
138
139
:boolean {:error/message {:en " should be a boolean" }}
139
140
:keyword {:error/message {:en " should be a keyword" }}
140
141
:symbol {:error/message {:en " should be a symbol" }}
Original file line number Diff line number Diff line change 373
373
(me/humanize )))))
374
374
375
375
(deftest double-test
376
- (is (= {:a [" should be a double" ]
377
- :b [" should be at least 1" ]
378
- :c [" should be at most 4" ]
379
- :d [[" should be at least 1" ]
380
- [" should be at most 4" ]]
381
- :e [" should be a double" ]
382
- :f [" should be 4" ]}
383
- (-> [:map
384
- [:a :double ]
385
- [:b [:double {:min 1 }]]
386
- [:c [:double {:max 4 }]]
387
- [:d [:vector [:double {:min 1 , :max 4 }]]]
388
- [:e [:double {:min 1 , :max 4 }]]
389
- [:f [:double {:min 4 , :max 4 }]]]
390
- (m/explain
391
- {:a " 123"
392
- :b 0.0
393
- :c 5.0
394
- :d [0.0 5.0 ]
395
- :e " 123"
396
- :f 5.0 })
397
- (me/humanize )))))
376
+ (doseq [t [:double :float ]]
377
+ (is (= {:a [(str " should be a " (name t))]
378
+ :b [" should be at least 1" ]
379
+ :c [" should be at most 4" ]
380
+ :d [[" should be at least 1" ]
381
+ [" should be at most 4" ]]
382
+ :e [(str " should be a " (name t))]
383
+ :f [" should be 4" ]}
384
+ (-> [:map
385
+ [:a t]
386
+ [:b [t {:min 1 }]]
387
+ [:c [t {:max 4 }]]
388
+ [:d [:vector [t {:min 1 , :max 4 }]]]
389
+ [:e [t {:min 1 , :max 4 }]]
390
+ [:f [t {:min 4 , :max 4 }]]]
391
+ (m/explain
392
+ {:a " 123"
393
+ :b 0.0
394
+ :c 5.0
395
+ :d [0.0 5.0 ]
396
+ :e " 123"
397
+ :f 5.0 })
398
+ (me/humanize ))))))
398
399
399
400
(deftest any-test
400
401
(testing " success"
You can’t perform that action at this time.
0 commit comments