Hello, this is exactly the kind of library I was probably going to rewrite for myself rather sooner than later, cool !
One question, though : if I understant it correctly, the default behaviour once you start defining a schema is for it to be "strict" rather than "loose", meaning that any extra key found in a map will be default generate an error. I find that a little bit unfortunate. What is a rationale behind being strict by default ? 2012/12/5 Alex Baranosky <alexander.barano...@gmail.com>: > Added a step-wise 'Getting Started' tutorial. Plan to add more in-depth > documentation soon: > https://github.com/runa-dev/clj-schema/wiki/Getting-Started > > > On Tue, Nov 27, 2012 at 7:18 PM, Alex Baranosky > <alexander.barano...@gmail.com> wrote: >> >> Hi Stathis, >> >> Thanks for your interestin clj-schema. If you use it and have any feedback >> please let me know. >> >> clj-schema is released under the MIT license: http://mit-license.org/ >> >> I think TypedClojure is really cool. I'm excited about both approaches >> because in general I'm very interested in approaches to coding that help us >> ensure that our code works correctly. That said there are some interesting >> differences in the approaches: >> >> schemas can be used for other things other than validation or type >> checking. >> >> schemas are more decoupled from the code. Say you are reading a map out >> of a file, or get a map returned from another library. With schemas you >> could easily validate the map. How would that be handled in a TypeClojure >> approach? Also, schema validation only checks at a snapshot in time; it >> makes no effort to ensure that that map is always correct. >> >> schema validation happens at run-time; TypedClojure is a static analysis >> tool. ( Of course, if there was some kind of adapter for TypedClojure it >> could take schemas as params to the type declarations.) >> >> >> Alex >> >> >> On Tue, Nov 27, 2012 at 2:23 AM, Stathis Sideris <side...@gmail.com> >> wrote: >>> >>> Hello Alex, >>> >>> This looks very useful, thanks. What's the license under which you are >>> releasing this code? Also, I'm wondering whether something like that could >>> be the next step for Typed Clojure. From Ambrose's thesis, I got the >>> impression that he would like Typed Clojure to eventually cater for checking >>> the contents of maps. >>> >>> Thanks, >>> >>> Stathis >>> >>> >>> On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote: >>>> >>>> Clj-schema is a library for defining and validating schemas for maps, as >>>> well as for using those schemas to create valid test data. We've been >>>> using >>>> this in production for at least a few months now, at Runa. >>>> >>>> https://github.com/runa-dev/clj-schema >>>> >>>> The main benefits I've found from using this library are: >>>> * validating the inputs to the application: validating Ring request >>>> params and config files >>>> * validating before storing maps into the DB >>>> * using the clj-schema.fixtures library to create valid test data that >>>> stays valid. So as the standard form of a map changes over time the tests >>>> will stay in sync with those changes automatically. >>>> * there are some code-readability benefits as well - any developer can >>>> pretty quickly see what certain kinds of maps tend to look like. >>>> >>>> There's more info in the README: >>>> https://github.com/runa-dev/clj-schema/blob/master/README.md >>>> >>>> Future possibilities: >>>> * auto-generating test data from clj-schema fixtures >>>> * being able to create schemas for sets and sequences (currently a >>>> schema is always for a map) >>>> >>>> Contributors welcome. >>>> >>>> Alex >>> >>> -- >>> 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 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 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