ring-swagger

Ravi 2024-04-03T15:39:25.456139Z

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}

2024-04-03T16:19:23.053409Z

Are you using reitit? I wasn't aware of compojure-api/ring-swagger supporting malli.

Ravi 2024-04-03T16:35:23.750599Z

yes !

2024-04-03T16:47:56.096169Z

You might have more luck in #malli or #reitit