-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Enforce @JsonProperty.required
when using builder.
#2618
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
There is #230 which could be considered to cover this, but leaving this for builders is ok. |
Actually. Will tag 2.12 to maybe have another look, after 2.11 release. |
@JsonProperty.required
when using builder.
Note to self: unfortunately support for builders no easier than that for all POJOs as databind does not have much special handling for builders (they just look like odd POJOs where "Setters" may return |
Hi, could you clarify your plans on including this feature? I opened a feature request for lombok Also a similar question about |
@almson I guess Lombok folks are way more optimistic about this getting implemented then: there is no on-going work to make this happen. But even if there was, I'd probably consider having a It is in fact quite unlikely that Same goes for "defaultValue": nothing currently exists to use that, except for JSON Schema generation (it was requested for that use case). Having said all that: just because I do not have time to work on either feature does not mean other members of Jackson community might not be working on it, or decide to try it. 3 out of 5 "most wanted" features for 2.12 came as full "external" contributions (from new contributors, without much discussion before contribution). |
When using
@JsonProperty(required = true)
with creator/factory (@JsonCreator
annotation), an exception is raised if a required field is missing (as expected).It is possible to have the same feature when using a builder to deserialize?
Sorry if this request is duplicate or already present, but I couldn't find it at issues list, forum, neither as configuration on the ObjectMapper documentation.
Tested with Jackson version 2.10.2, using the following code:
The text was updated successfully, but these errors were encountered: