users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Editors Note 7.2

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 17 Apr 2012 11:11:43 -0400

Hi Ron,

 Are you suggesting something like this:

public interface ValidationError {
    public Object getInvalidValue();
    public String getMessage();
}
 
 and then replace List<String> for List<ValidationError> in JAX-RS's ValidationException?

 Thanks.

-- Santiago

On Apr 14, 2012, at 11:28 PM, Ron Sigal wrote:

> In particular: "A ViolationException currently holds a list of violation messages (strings) instead of ConstraintViolation to avoid a dependency with BV. Is this sufficient?"
>
> At first, I wanted to extend ViolationException to ResteasyViolationException and include entire ConstraintViolations. Thinking about it some more, though, I realized that a lot of the information in ConstraintViolations, e.g., paths and the root bean, may not be appropriate for client consumption. In fact, I think the reasonable default behavior is to include just two ConstraintViolation fields: the message and the invalid value. As per the current spec, I turned those two fields into a single String by concatenating them, separated by ':'. Shortly after I did that, I discovered the String
>
> s must have length: 3 <= length <= 5: Foo[abcdef]
>
> in one of my unit tests. So ':' doesn't make a very good delimiter. In fact, any character could show up in a violation message.
>
> I'm thinking it would be nice to have something a bit richer than a single String in the API, even something as simple as a typical Pair.
>
> -Ron
>
> --
> Erdös number 4.
>