jasvorno
jasvorno copied to clipboard
Better error handling for resolution fail of null union case
Most of the unions we see are of the specific 'nullable type' case: [null, T]
. When we fail to find a union branch that matches T
we give a fairly generic error:
Caused by: com.hotels.jasvorno.JasvornoConverterException: Cannot resolve union: ...
However, in this specific case we really have only one candidate type that happens to be nullable. Therefore it would be really useful to see why the value does not match T
, just as if we were trying to validate against only T
(and not a union of T
and null
).
Providing this error would greatly assist in debugging schemas that have nullable fields, and so is actually not really related to the more general use of the union
type.