-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
@JsonCreator with unknown fallback setter: do not throw error if FAIL_ON_UNKNOWN_PROPERTIES is false #862
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
Thank you! Interesting question here. I think your suggestion is good, to see if |
Finally looking into this, I think I misunderstood this, assuming there was a failure even without attempt to set a value. However: in case of a known property (due to One possible remedy would be to use |
Re-created as #1401. |
Hi, sorry for this late reply : I would like you to reconsider this issue. I have an object with an immutable property. Some other properties are mutable. My immutable property is exposed to my front-end. The front-end code contains a form to update de mutable properties, and displays the immutable property. By convenience and code simplicity, I do not want to copy / remove the immutable property when I send my update request, therefore the immutable property is part of the request (but unchanged). Therefore, I think it a reasonable use case to have a property defined in a JsonCreator, provided inside a readerForUpdating request, but ignored by having no setter. On the other hand, if you do not throw any exception, the only drawback is that the developer will need to analyse why the property was not updated. I think it is quite easy to find that a setter is missing. Best regards, |
Hi, I am currently using @JsonCreator to control object creation, combined with "readerForUpdating" to control object updates.
I have a property that can be created, but not updated. Therefore, it exists as an argument of my constructor, but there is not setter method.
I would like to ignore the property during update. However, I get this error:
No fallback setter/field defined: can not use creator property for ...
.The culprit is CreatorProperty L192, with a nice comment:
Actually, I would like an exception only if my mapper is configured to
FAIL_ON_UNKNOWN_PROPERTIES
. Am I correct?Thanks for the great work by the way!
The text was updated successfully, but these errors were encountered: