-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
@JsonProperty required = true does not work for constructors #174
Comments
Correct. More generally, 'required' attribute is not supported for deserialization at all -- supporting it will require surprisingly significant changes in deserializer. So if/when this is done, it should also be made to work with creator methods. |
I would really like to see this implemented. I expected that "required" worked both ways and was surprised to learn that it didn't. |
Yup, we are always open for good code contributions! |
I came across this issue after making a similar assumption about what the behaviour would be. I would, however, also comment that if you expect a value passed to a constructor to be non-null, then it should be non-null whether deserialised from JSON or constructed otherwise. As such, even if this was enforced through the Of course, if you only ever construct your objects through JSON deserialisation you probably less concerned about this. |
I think this is dup of #230, so closing as such -- still hoping to add support for checks in future, just want to reduce duplication in issue tracker. |
Correction: this was not exact dup of #230, being a subset. But we do have #781 -- just implemented for 2.6.0! -- which was re-filed for the specific case of supporting required-ness for Creator methods. This because that subset is relatively easy to support, and is needed to support some Scala functionality as well. |
resolves FasterXML#172 by adding last operation in JsonPointer.
for example with this constructor
I can still deserialize a json that does not contain blah.
I did not see this documented anywhere, just in the changelog for 2.1.0:
so i guess constructor support for this feature is just missing. is that correct?
The text was updated successfully, but these errors were encountered: