mirror of
https://github.com/metosin/reitit.git
synced 2025-12-30 21:28:25 +00:00
spec warning
This commit is contained in:
parent
5cfcd0a3c9
commit
4506284054
1 changed files with 9 additions and 1 deletions
|
|
@ -2,7 +2,15 @@
|
|||
|
||||
The [clojure.spec](https://clojure.org/guides/spec) library specifies the structure of data, validates or destructures it, and can generate data based on the spec.
|
||||
|
||||
**NOTE**: Currently, `clojure.spec` [doesn't support runtime transformations via conforming](https://dev.clojure.org/jira/browse/CLJ-2116), so one needs to wrap all specs into [Spec Records](https://github.com/metosin/spec-tools/blob/master/README.md#spec-records) to get the coercion working.
|
||||
## Warning
|
||||
|
||||
`clojure.spec` by itself doesn't support coercion. `reitit` uses [spec-tools](https://github.com/metosin/spec-tools) that adds coercion to spec. Like `clojure.spec`, it's alpha as it leans on `clojure.spec.alpha/conform`, which is concidered a spec internal, that might be changed or removed later.
|
||||
|
||||
For now, all leaf specs need to be wrapped into [Spec Records](https://github.com/metosin/spec-tools/blob/master/README.md#spec-records) to get the coercion working.
|
||||
|
||||
There are [CLJ-2116](https://dev.clojure.org/jira/browse/CLJ-2116) and [CLJ-2251](https://dev.clojure.org/jira/browse/CLJ-2251) that would help solve this elegantly.
|
||||
|
||||
## Example
|
||||
|
||||
```clj
|
||||
(require '[reitit.coercion.spec])
|
||||
|
|
|
|||
Loading…
Reference in a new issue