add specs

This commit is contained in:
Tommi Reiman 2018-07-21 14:59:20 +03:00
parent b54ee1a86b
commit ed385afe5a

View file

@ -1,12 +1,16 @@
(ns reitit.ring.middleware.alpha.muuntaja
(:require [muuntaja.core :as m]
[muuntaja.middleware]))
[muuntaja.middleware]
[clojure.spec.alpha :as s]))
(s/def ::muuntaja (partial instance? m/Muuntaja))
(defn create-format-middleware
([]
(create-format-middleware m/default-options))
([options]
{:name ::formats
:spec (s/keys :opt-un [::muuntaja])
:compile (fn [{:keys [muuntaja]} _]
(let [options (or muuntaja options)]
(if options