One more time for the...

This commit is contained in:
Tommi Reiman 2019-02-20 08:58:29 +02:00
parent dcd96c3dae
commit 25287e0df7

View file

@ -61,7 +61,7 @@ Failing coercion:
## Deeply nested ## Deeply nested
As spec coercion is not complete (before `clojure.spec` adds support to it), not all specs can be coerced. One can test the coercion easily in the REPL. Spec-tools allow deeply nested specs to be coerced. One can test the coercion easily in the REPL.
Define some specs: Define some specs:
@ -97,7 +97,7 @@ Apply a json->edn coercion to the data:
```clj ```clj
(st/coerce (st/coerce
::my-json-api ::my-json-api
{:skus [{:id :123}] {:skus [{:id "123"}]
:photos [{:id "123"}]} :photos [{:id "123"}]}
st/json-transformer) st/json-transformer)
; {:skus [{:id :123}] ; {:skus [{:id :123}]
@ -112,11 +112,11 @@ By default, reitit uses custom transformers that also strip out extra keys from
(st/coerce (st/coerce
::my-json-api ::my-json-api
{:TOO "MUCH" {:TOO "MUCH"
:skus [{:id :123 :skus [{:id "123"
:INFOR "MATION"}] :INFOR "MATION"}]
:photos [{:id "123" :photos [{:id "123"
:HERE "TOO"}]} :HERE "TOO"}]}
rcs/json-transformer) rcs/json-transformer)
; {:photos [{:id "123"}] ; {:skus [{:id :123}]
; :skus [{:id :123}]} ; :photos [{:id "123"}]}
``` ```