Fork me on GitHub

Hello, guys! I'm new in clojure world and I'm creating simple API service using compojure-api library. I'm writing schema for validation and don't understand how to validate and coerce date for field :birthdate in my model. Can you help?

(ns hs-crud.patient
  (:require [schema.core :as s])

;; code for validators 

(s/defschema Patient
  {:fullname  (s/constrained s/Str valid-fullname?)
   :gender    (s/enum :male :female :other)
   :birthdate s/Str  ;; todo add date validator
   :address   (s/constrained s/Str valid-address?)
   :rpn       (s/constrained s/Str valid-rpn?)})
That is how my schema looks now