[erlang-questions] [ANN] sheriff 0.2: parse transform for type-based data validation

Tristan Sloughter <>
Wed Feb 15 00:23:38 CET 2012


Hmm, yeah. And I should have mentioned I modified Ulf's exprecs to have
slightly different syntax but the main thing was to also use types in
records to add calls to convert (which I may change to check...) for
setting each attribute of a record.

https://github.com/tsloughter/maru/blob/master/lib/maru_models/src/maru_model_transform.erl

Add support for validating email addresses and more complicated types is in
my plan for dealing with that model creation. But no reason to have it not
be a secondary piece of sheriff now :)

Tristan

On Tue, Feb 14, 2012 at 10:01 AM, Loïc Hoguin <> wrote:

> Right, forgot about that. I also want pre-defined functions for validating
> things like emails, URLs and others that string() or binary() types can't
> define. But I'm not sure this should go in sheriff proper, it could very
> well just be another library, perhaps generated based on RFCs or something.
>
>
> On 02/14/2012 04:24 PM, Tristan Sloughter wrote:
>
>> It would be nice if the validation of a type could be defined as a fun.
>>
>> I was going to build something similar to this for validation on models
>> in a web framework. So for validating email addresses and things like
>> that. More complicated than a simple type.
>>
>> Tristan
>>
>> On Tue, Feb 14, 2012 at 8:35 AM, Loïc Hoguin <
>> <mailto:>> wrote:
>>
>>    In the short term fixing bugs, adding the missing iolist() and
>>    iodata() validation and a couple other less documented types.
>>
>>    In the long term it would be nice to find a way to generate
>>    validation functions also for types found in the Erlang libs, or at
>>    least a certain subset for the most used of the lot, like the
>>    calendar module for example.
>>
>>    I'm open to any and all suggestions at this point.
>>
>>
>>    On 02/14/2012 02:38 PM, Ignas Vyšniauskas wrote:
>>
>>        Hi,
>>
>>        I'm confused why no-one is excited about this, this looks
>>        awesome! I am
>>        already looking forward to using this in our project.
>>
>>        Loïc, are there any milestones/plans regarding further
>>        developement of this?
>>
>>        Regards,
>>        Ignas
>>
>>        On 2012.02.13 10 <tel:2012.02.13%2010>:52, Loïc Hoguin wrote:
>>
>>            Hello!
>>
>>            We just released the first beta version of the sheriff parse
>>            transform.
>>            It allows you to validate data against types defined through
>>            the Erlang
>>            type system.
>>            <..>
>>
>>
>>
>>    --
>>    Loïc Hoguin
>>    Erlang Cowboy
>>    Nine Nines
>>    ______________________________**___________________
>>    erlang-questions mailing list
>>     <mailto:erlang-questions@**erlang.org<>
>> >
>>    http://erlang.org/mailman/__**listinfo/erlang-questions<http://erlang.org/mailman/__listinfo/erlang-questions>
>>    <http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>> >
>>
>>
>>
>
> --
> Loïc Hoguin
> Erlang Cowboy
> Nine Nines
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120214/dc8308f0/attachment.html>


More information about the erlang-questions mailing list