users@jsonb-spec.java.net

[jsonb-spec users] Re: Integrating JSON-B with Bean Validation

From: <gunnar.morling_at_googlemail.com>
Date: Thu, 9 Mar 2017 16:45:48 +0000 (UTC)

> new ValidationAdapter<User, User>() {} should work I think

Ok, I kinda hoped one wouldn't need one validation adapter per type.
One single generic implementation should actually suffice.

But I tried what you suggest with the RI and my adaptor is invoked now,
but I'm ending in an stack overflow exception:

at
org.eclipse.yasson.internal.serializer.AdaptedObjectSerializer$AdaptedO
bjectSerializerModel.getCustomization(AdaptedObjectSerializer.java:71)

It seems it's calling the adapter again and again as the input and
output type are the same. So this route seems not viable?

> Regarding a deeper integration I'm not particularly against but have
to
> admit I don't really see a strong use case ATM (tend to think even
> standalone code has a container these days, spring or cdi standalone
so it
> is easy to bind the validation on the event bus for instance and less
> intrusive in the marshalling layer)

I hear you; and yes, people could put a validation decorator around
JsonbBuilder and expose it as managed bean for their DI framework. The
proposal would make life just a tad easier also for those not knowing
the ins and outs of decorators and the like which is why I thought I'd
bring it up.