Fork me on GitHub
#reitit
<
2018-09-05
>
levitanong06:09:53

@ikitommi can i get an example with reitit-ring with clojure.spec coercion? Can’t seem to get it to work 😞

ikitommi10:09:19

spec coercion is bit hacky, before (if ever) we get spec to really support coercion.

ericstewart16:09:39

@ikitommi do you mean any spec based coercion (like data specs) or straight spec coercion is the hacky bit? Asking because using compojure-api now and had trouble with spec coercion there too (but data specs work fairly well) and I have had my eye on moving to reitit at some point

ikitommi19:09:27

@ericstewart coercion kinda works, but spec-tools (used in c-api and in reitit) leans on s/conform of clojure.spec which might be changed/removed later. There are CLJ-2116 & CLJ-2251 to modify clojure.spec core so that we could build robust coercion on top of it. The first issue is commented “I continue to think we will most likely decline this.” and the second “No plans to look at this before the next batch of implementation changes, so it will be a while.“.

ikitommi19:09:34

only public api with clojure.spec is the s/form currently. but it’s contents can change too.

ikitommi19:09:18

would like to solve this, we could copy most of the spec internals to make it Good, but just too much work.

ericstewart19:09:51

ok, that's the way I understood it. spec-based coercion will remain risky while it is still alpha at least. thanks for everything done in spec tools though. We have been using it for not just coercion but for generating JSON Specs for use in our front end and has been working well

👍 4
ikitommi19:09:05

maybe the core-team will need this some day and they’ll open up the spec api so that we can built it right without hacks.

ericstewart19:09:33

yep. but they did very clearly explain that spec is still alpha. in any case, thanks again for providing some workable solutions on top of an alpha api even though it may all have to radically change again.