Hi Romain,
> Do you have some more cases?
I think it's mostly manually performed unmarshalling which would
benefit from this:
Jsonb jsonb = JsonbBuilder.create(
new JsonbConfig()
.withValidationMode( CALLBACK ) // or AUTO/NONE as in JPA
.withValidationGroups( MyBasicConstraints.class )
);
// if the call returns, a valid instance is guaranteed
// otherwise a ConstraintViolationException is raised
Person personLoaded = jsonb.fromJson( jsonRepresentation,
Person.class );
That way people could configure a validating JsonbBuilder and e.g.
expose it as CDI bean within their application. Wheras no validation
would occur during unmarshalling performed by integrators such as
JAX-RS.
I.e. it'd just be an option to obtain an automatically validating
JsonbBuilder, saving users from writing some glue code.
--Gunnar