Fork me on GitHub
#yada
<
2017-06-09
>
jmglov14:06:12

@malcolmsparks Apologies if this is a common question that has already been answered, but how far along is the effort to use spec for parameter coercion in yada?

jmglov14:06:55

Or more generally, replace Plumatic Schema with spec in general?

malcolmsparks14:06:09

It hasn't progressed recently. Schema makes a good default choice but one that has been made optional via yada bundles. Nothing to stop you providing your own validation logic based on clojure.spec. If you need swagger support, that's something I not very up to date with. @ikitommi may be a good person to ask, or check ring-swagger updates.

malcolmsparks14:06:48

No worries about asking anything you like on this channel.

jmglov15:06:38

Cheers, Malcolm!

jmglov15:06:56

Good reading so far. 🙂

jmglov15:06:28

And https://github.com/metosin/spec-tools looks like it covers coercion pretty well.

borkdude15:06:04

using string-conforming you mean?

borkdude17:06:08

interesting, should check it out

nha18:06:46

In bidi, is there a way to walk and update the handlers? The closest I have found is route-seq but it does not give me the possibility to change the handler.

malcolmsparks18:06:24

clojure.walk/postwalk

malcolmsparks18:06:32

I use that a lot

nha18:06:45

I am using that now, but it does not work if I have something like this:

["/" [ [[ "foo/" :id "/bar"] :handler1]
                      [[ "foo/" :id "/zoom" :id2] :handler2]]]
I am looking for keyword? but this is not enough.

nha18:06:50

Because it means I will replace the :id as well in this case.

malcolmsparks18:06:42

Look for a pair

malcolmsparks18:06:04

With a keyword on the left

malcolmsparks18:06:45

I tend to only use for resources where a can check with instance?

nha18:06:03

Ah yes that makes sense to destructure the route. I can't check the instance? in this case (in fact the update is to create an instance). Thanks!

malcolmsparks18:06:28

If you are really stuck, you could tag some of your structures with clojure metadata. Very useful feature in some cases.