Open hambone01 opened 4 years ago
@hambone01
The specification of JSON-B API is originally defined by Oracle and now maintained by Eclipse Jakarta EE Team. So I cannot modify the API.
Please see https://github.com/eclipse-ee4j/jsonb-api
You can throw an unchecked exception from your ProblemHandler
in order to stop binding immediately after the input document turned out to be invalid.
There seems to be no way to detect a validation failure and therefor not bind. Take justify-examples-binding as the example. When the json is invalid the Person object should not be created. Maybe fromJson should return an Optional?
If the json is invalid, yet the object is still created, then how is user to know? Maybe if you don't provide a ProblemHandler then justify defaults to returning an empty Optional?
I realize I can add functionality to my ProblemHandler Object but that isn't exactly convenient. I would think the normal use-case would be validating incoming requests so that bad ones are disguarded or possibly fixed, but in that order.