Hi Nahuel,

On Saturday, August 23, 2014 7:23:42 PM UTC+2, nahuel wrote:
>
> what about:
>
> (defmulti step-handler :type)
> (defmulti get-schema :type)     ;; returns the schema
>
> And make your users implement both? Remember schemas are first-class 
> values.
>

The difficulty I'm having is figuring out how to then embed these schemas 
into another schema. (The reason I want *that* is because these steps are 
composed into different schemas, and I'd like to check the superschema.) 
Ideally I would end up with something like:

(def Step
  (s/conditional
   #(= (:type %) :http)  {:the :http :schema :here}
   #(= (:type %) :delay) {:the :delay :schema: :here}))

... except with the keys and schemas coming out of the multimethod (or 
whatever) instead of being a literal :)

I guess I could do that with some extended macrology hackery for now; if my 
defstep macro stashes all of the schemas in a ref somewhere, I can then 
expand to the above code example :)

I've created a ticket for this on prismatic/schema: 
https://github.com/Prismatic/schema/issues/140

thanks again,
lvh

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to