[hibernate-issues] [Hibernate-JIRA] Commented: (HV-19) Consider higher level validations, such as email, URL, credit card, etc.

Ted Bergeron (JIRA) noreply at atlassian.com
Wed Jan 13 22:07:31 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-19?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35220#action_35220 ] 

Ted Bergeron commented on HV-19:
--------------------------------

I've been reviewing the HTML5 spec and they document validation strategy for Email and URL.  They also note that they specifically violate prior definitions with good reason.  This seems like the right spec to adhere to as web apps will be using input type="email" and type="url" binding to fields marked @Email and @URL in the validator.

* http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state

"A valid e-mail address is a string that matches the ABNF production 1*( atext / "." ) "@" ldh-str 1*( "." ldh-str ) where atext is defined in RFC 5322 section 3.2.3, and ldh-str is defined in RFC 1034 section 3.5. [ABNF] [RFC5322] [RFC1034]

This requirement is a willful violation of RFC 5322, which defines a syntax for e-mail addresses that is simultaneously too strict (before the "@" character), too vague (after the "@" character), and too lax (allowing comments, white space characters, and quoted strings in manners unfamiliar to most users) to be of practical use here."

* http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#valid-url

"The term "URL" in this specification is used in a manner distinct from the precise technical meaning it is given in RFC 3986. Readers familiar with that RFC will find it easier to read this specification if they pretend the term "URL" as used herein is really called something else altogether. This is a willful violation of RFC 3986. [RFC3986]"




> Consider higher level validations, such as email, URL, credit card, etc.
> ------------------------------------------------------------------------
>
>                 Key: HV-19
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-19
>             Project: Hibernate Validator
>          Issue Type: New Feature
>          Components: legacy
>            Reporter: Ted Bergeron
>            Priority: Minor
>             Fix For: 3.2.0
>
>
> I was looking at the release notes for commons validator 1.2 http://wiki.apache.org/jakarta-commons/ValidatorVersion120  and wondered if the higher level constructs fit the design goals of hibernate validator.
> They have email, URL, Credit card and ISBN.  These could all be handled via @Pattern with regex matching a constant declared somewhere.
> Would it be desirable to have Hibernate supply the values for these constants? Such as:
> @Pattern(type="email") or @Pattern(regex=org.hibernate.validator.Pattern.EMAIL) or @Email
> Email and URL are global patterns.  This probably wouldn't work for something like phone number which is locale sensitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list