-
-
Notifications
You must be signed in to change notification settings - Fork 177
Return multiple missing kotlin parameters at once #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
At least I don't have the motivation to work on this. |
@k163377 Hi, I want to handle |
@aboutZZ I have checked the code a bit. This would cause the registered The
|
I am also very interested in a solution to the problem mentioned in the original post. I tried implementing a custom deserialization modifier. The idea is that before actual deserialization, you use reflecting to check all fields missing in the target class. I had posted about this here: @k163377 do you know what it will take to make such an approach work? |
I think you need to fix jackson-module-kotlin/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt Line 47 in 6b4b19f
|
Use case
We expose public API and we want to to be as descriptive as possible returning bad request response. So we want to return all required null fields at once. By using
KotlinValueInstantiator
andMissingKotlinParameterException
we are able to return just one at the time. So we use @NotNull annotation validation but this requires us to mark non-null fields as nullable and then use ugly!!
in the code eg.Describe the solution you'd like
It would be much nicer if exception thrown by jackson kotlin module contained all fields that are invalid (MissingKotlinParametersException with a list of missing parameters?). Then we could simplify example above to
It could be configurable with some kind of flag to keep backward compatibility and not iterate through all fields if not necessary.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: