cljs.spec.alpha/nonconforming
(nonconforming spec)
Source docstring:
takes a spec and returns a spec that has the same properties except
'conform' returns the original (not the conformed) value. Note, will specize regex ops.
(defn nonconforming
[spec]
(let [spec (delay (specize spec))]
(reify
Specize
(specize* [s] s)
(specize* [s _] s)
Spec
(conform* [_ x] (let [ret (conform* @spec x)]
(if (invalid? ret)
::invalid
x)))
(unform* [_ x] (unform* @spec x))
(explain* [_ path via in x] (explain* @spec path via in x))
(gen* [_ overrides path rmap] (gen* @spec overrides path rmap))
(with-gen* [_ gfn] (nonconforming (with-gen* @spec gfn)))
(describe* [_] `(nonconforming ~(describe* @spec))))))