You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 and MissingKotlinParameterException 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.
data class Task(
@field:NotNull
val taskType: TaskType?,
@field:NotNull
val createdAt: Instant?,
@field:NotNull
val updatedAt: Instant?,
)
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
data class Task(
val taskType: TaskType,
val createdAt: Instant,
val updatedAt: Instant,
)
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:
At least I don't have the motivation to work on this.
I agree that it is useful, but I think most libraries (e.g. kotlin-reflect) only report one missing content.
@k163377 Hi, I want to handle MismatchedInputException in spring boot, so I added a DeserializationProblemHandler, but the handler didn't handle MismatchedInputException (it only handle the unknown property problems, I want handle input null for nonnull props situation), any way to resolve this?
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: