Skip to content

Instantly share code, notes, and snippets.

View ckshekhar's full-sized avatar

Chandrashekhar ckshekhar

View GitHub Profile
@ckshekhar
ckshekhar / with-schema.clj
Created July 10, 2019 09:05 — forked from ikitommi/with-schema.clj
Schema coercion, how to do this with spec?
; (./pull '[prismatic/schema "1.1.3"])
(require '[schema.core :as schema])
(require '[schema.coerce :as coerce])
;; let's define some matchers
(def matchers
{:string coerce/string-coercion-matcher ;; used with ring query-, path- & form-params
:json coerce/json-coercion-matcher ;; used with body/response for "application/json"
:edn (constantly nil)}) ;; used with body/response for "application/edn"