Thank you. Yes, it seems that for recursion I can use the same approach. As 
for inheritance currently I just include all parent attributes in every 
child schema. As for spec definition multi-spec, as I understand it, 
requires "defmethod" for every class which is probably a problem for my 
case since all inheritance hierarchies are also determined at run-time. I 
will need to find some approach that is both dynamic and supports precise 
error messages in case validation fails.


Am Montag, 23. Mai 2016 22:38:24 UTC+2 schrieb Alex Miller:
>
> I think you could apply the same idea - use a regular translation between 
> Java class and registered name and then always refer to the registered name.
>
> There are probably multiple approaches to modeling inheritance, so hard to 
> recommend something without knowing more. In general, attributes coming 
> from super classes can be modeled using the parent attribute name. And I 
> would recommend looking into multi-spec 
> <http://clojure.github.io/clojure/branch-master/clojure.spec-api.html#clojure.spec/multi-spec>
>  
> for doing validation of a number of "types" that could be flowing into the 
> same location by leveraging a multimethod that conditionally provides the 
> spec to use.
>
> On Monday, May 23, 2016 at 3:09:46 PM UTC-5, Andrey Grin wrote:
>>
>> Thanks, Alex. I've taken random example from plumatic.schema wiki to 
>> quickly illustrate the question. In my actual use case I dynamically 
>> generate schemas based on hundreds of model Java classes (beans) with 
>> mutual references so I need recursion (and also some way to model 
>> inheritance, that was is achieved with "conditional" in plumatic). Will try 
>> to implement the same with spec.
>>
>>

-- 
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