Fork me on GitHub
#clojure-spec
<
2024-02-24
>
Jérémie Pelletier16:02:48

Can spec be used to replace invalid data with default values?

Jérémie Pelletier16:02:38

Looking to keep the valid data as well, instead of replacing the entire value tree with a default

Jérémie Pelletier16:02:22

Figured since spec is already traversing the data, it can save having to manually do it again when validation errors are detected, but unsure how to approach it

Alex Miller (Clojure team)17:02:29

No, spec is a validation library, not a transformation library

Jérémie Pelletier18:02:14

Ah good to know, thanks! Are you aware of a library providing such transformations?

nikolavojicic00:02:08

Maybe you could leverage s/explain-data

Jérémie Pelletier11:02:09

Spec-tools is interesting! I'll look into it, thank you!