Replies: 1 comment
-
I can see why things are problematic due to Jackson seeing problem at somewhat lower level (specific problem wrt POJO definition and input) whereas from user (and other library/framework) perspective some of these are logically equivalent or at least similar. I don't have a good solution from Jackson side. But couple of quick notes in case they might help.
That is, if you haven't tried out 2.18.0-SNAPSHOT that might worth it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We're using Dropwizard 4.x (under the hood, Jersey 3.x with Jackson 2.17.1) with Kotlin data classes.
When someone sends us some JSON that the jackson-module-kotlin cannot convert into a data class we would like to convert the resulting
MismatchedInputException
into a nice message for our users. Unfortunately the simple way to do it exposes our internal code model - the message on the exception could be:or
or
I'd like to turn those into an error that is as helpful as possible for the user, without revealing details of our classes. So the first would become:
and 2 would become:
and 3 would become:
or something like that. Unfortunately I'm struggling to differentiate between type errors and missing property errors... it looks like that information is thrown away somewhere in the construction of the exception's error message, and I would be left having to parse the error message and hope it never changes to infer the problem... has anyone solved this in a better way?
Beta Was this translation helpful? Give feedback.
All reactions