mirror of
https://github.com/metosin/reitit.git
synced 2026-02-20 17:29:08 +00:00
One more time for the...
This commit is contained in:
parent
dcd96c3dae
commit
25287e0df7
1 changed files with 5 additions and 5 deletions
|
|
@ -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"}]}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue