Schema is really awesome.  Very easy to use and even though the validation 
messages are a little cryptic, I think they'll work for libraries.

My only irk with it so far is that it appears to modify the function 
prototype.  
(extend-protocol Schema  js/Function ...

Not sure why they need to extend it directly, but its modifying a core 
object prototype is considered a big no-no (just look at the backlash to 
prototype.js).

Other than that though, been loving it.


On Monday, January 27, 2014 7:43:52 AM UTC-5, Korny wrote:
>
> Parsing is easy - use either https://github.com/clojure/data.json or 
> https://github.com/dakrone/cheshire (Cheshire used to have some 
> advantages over data.json but I have the impression data.json has caught 
> up).
>
> For validation I've used Prismatic Schema - 
> https://github.com/prismatic/schema - it's good for structural 
> validation, correct data types, valid keys etc.  If you want user-friendly 
> validation failures for individual fields you might want to use something 
> more user-focused - there are quite a few validation libraries at 
> http://www.clojure-toolbox.com/ you could try.
>
> - Korny
> On 27 Jan 2014 12:17, "David Simmons" <shortl...@gmail.com <javascript:>> 
> wrote:
>
>> Hi Folks.
>>
>> I'm writing a web app which receives a JSON structure. I'd like to 
>> validate that the structure is correct i.e. mandatory fields are present, 
>> and then convert into the relevant Clojure data structure. As a bonus if  a 
>> particular field in the JSON structure is incorrect I'd like to be able to 
>> define the error message generated (in a similar way I can do for 
>> noir.validation).
>>
>> Does anyone have any recommended libraries or the best way to approach 
>> this issue - I'm sure I'm not the first with this requirement.
>>
>> cheers
>>
>> Dave
>>  
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>  

-- 
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/groups/opt_out.

Reply via email to