Fork me on GitHub

How to add new datatypes to spec coercions? I am trying to add datetime to my JSON (testing via reitit swagger ui)

(defn localdatetime-from-string [v]
  (LocalDateTime/parse v dtfmt))

(defn localdatetime-to-string [v]
  (.format dtfmt v))

(def timestamp-str
    {:spec jt/local-date-time?
     :description "java 8 localdatetime string"
     :json-schema/type {:type "string", :format "timestamp"}
     :json-schema/example "2019-07-17T10:00:00"
     :decode/string #(localdatetime-from-string %2)
     :encode/string #(localdatetime-to-string %2)}))
encoding JSON works fine, but decoding gives a long spec error, this is the part I think is relevant:
      "path": [
      "pred": "java-time/local-date-time?",
      "val": "2019-07-17T10:00:00",
      "via": [
      "in": [


Actually, this is not working at all... I thought I can make a spec like this and use it as datatype in model definition like this

(def item
  {(ds/req :id) int?
   (ds/req :active_from) timestamp-str})