mirror of
https://github.com/metosin/reitit.git
synced 2026-01-27 16:40:34 +00:00
add specs
This commit is contained in:
parent
b54ee1a86b
commit
ed385afe5a
1 changed files with 5 additions and 1 deletions
|
|
@ -1,12 +1,16 @@
|
||||||
(ns reitit.ring.middleware.alpha.muuntaja
|
(ns reitit.ring.middleware.alpha.muuntaja
|
||||||
(:require [muuntaja.core :as m]
|
(: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
|
(defn create-format-middleware
|
||||||
([]
|
([]
|
||||||
(create-format-middleware m/default-options))
|
(create-format-middleware m/default-options))
|
||||||
([options]
|
([options]
|
||||||
{:name ::formats
|
{:name ::formats
|
||||||
|
:spec (s/keys :opt-un [::muuntaja])
|
||||||
:compile (fn [{:keys [muuntaja]} _]
|
:compile (fn [{:keys [muuntaja]} _]
|
||||||
(let [options (or muuntaja options)]
|
(let [options (or muuntaja options)]
|
||||||
(if options
|
(if options
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue