Fork me on GitHub
#malli
<
2024-04-03
>
Ravi16:04:40

Hi I am trying to use malli to validate the input LocalDate string in params I did try to use malli.experimental.time but seems like it cannot handle the localDate string Ideally i used regex ealier but this breaks the Swagger doc as json is not able to convert regex. So if someone has some experiance with this that will be helpful

(def some-obj
  [:map
   [:rate [:maybe number?]]
   [:myDate [:maybe [:re #"^\d{4}-\d{2}-\d{2}"]]]
   [:myDate2 [:maybe [:re #"^\d{4}-\d{2}-\d{2}"]]]])

Want to validate localDate string like "2020-12-02"
Swagger Error
Caused by: com.fasterxml.jackson.core.JsonGenerationException: Cannot JSON encode object of class: class java.util.regex.Pattern: ^\d{4}-\d{2}-\d{2}

delaguardo16:04:02

have you tried :time/local-date?

1