-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
modelmapper can't map from a NULL or empty String to LocalDate #13
Comments
We're hitting this too, which renders the module useless to us. Is there a simple universal work-around we're not aware of? If not, is this by design or should it be fixed? |
in the beginning I tried this:
With that code, you can format the pattern you receive the data, from your front-end. |
In my case I don't control the data coming in, and it's protobuf, so it has optional blank strings for dates that I simply need to skip. |
You can take this piece of code, that uses
In that case, I'm letting the mapper know that I don't want to set |
Yes, I can skip individual fields, but I have dozens and dozens of fields to deal with, so a universal solution would be preferable. Of course, it's easy enough to setup a custom blank-skipping converter for LocalDate/LocalDateTime, and that's what I've done, but that does mean this module is useless. :) |
Have you tried this, in your config class? It will ignore all incoming null attributes:
|
@felipealvesgnu again, thanks, but in our case the incoming fields are empty strings. |
I'm trying to map from a NULL json string field and I'm getting:
and when with an empty string field I get:
The text was updated successfully, but these errors were encountered: