-
Notifications
You must be signed in to change notification settings - Fork 39
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
Deprecate @JsonbProperty.nillable() in favor of @JsonbNillable on fields #52
Comments
@bravehorsie Commented So which nillable takes precedence here? Please note we can't check if both are set to raise exception in that case because of |
|
It's too bad there are two separate way to configure nillable with JSON-B annotations. If we could have a do-over, I think it would make more sense to just have Perhaps we could attempt to move towards re-aligning this in the next version of JSON-B by deprecating the |
Hmm, it would require users to migrate - to not have deprecated code - without real gain. Maybe just some documentation to adjust on jsonb website since it is not a blocker? |
It would be a very simple migration for users, and the gain is that it clears up user confusion. I have been confused myself about |
To be fair on that topic I didnt see any confusion so wonder if it is a big enough issue to break an API (deprecating leads to rework in several projects by dev practises so is as kmpacting as breaking). |
I don't agree that some projects moving to use In the event of a conflict (i.e. The full nillabe resolution strategy could be as follows:
|
Yes, the policy on some projects is to not use deprecated api - it just makes the build failling so even if not a breaking change by signature, it is lived as one. |
I agree with @aguibert. We should deprecate |
@rmannibucau I think the two different ways of doing the same thing should never have made it into the 1.0 spec, and I am hoping we can migrate away from that in the next version of JSON-B. I still disagree with your argument that this is a breaking change. If projects have configured their projects to fail if compiler warnings are found, then they have decided to opt-into a more brittle build in favor of having a "clean" codebase that follows the most modern practices.
The end goal would be in a distant future release of JSON-B we would eventually remove the |
@aguibert point is that this assumption is wrong:
The idea was to limit the number of annotation on the fields/properties (like @resource instead of 4-5 annotations). We missed the adapters/(de)serializers though :(. |
In general I agree that limiting the number of annotations is better than having multiple annotations. However, if there is a case where an annotation can be applied to a class that "inherits" down to all fields, it is better to allow that same annotation to be applied at the smaller scope, rather than the user needing to know that it becomes an attribute of a different annotation when applied at the field/method level. For example, consider JUnit's |
Strictly speaking it can make sense but it is important to not forget spec already exists and to confirm to users we dont change API at will without any strong reason. IMHO it is not one here since it does not enable any new use case and does not simplify the API (1 method for 1 annotation). |
Closed #52 as a dup of this. At min, we should update javadoc to minimize confusion here. |
While running a hands-on-lab with people wanting to get acquainted with JSON-B a number of participants attempted to apply the
@JsonbNillable
in places where the@JsonbProperty
with booleannillable
should be used.While the javadocs on
@JsonbNillable
point in the right direction for the desired functionality, for some people this is not quite intuitive.Could this be made easier on new JSON-B users by making the annotation
@JsonbNillable
applicable to places where@JsonbProperty
should now be used, or would there be objections making this not feasible/desirable?The text was updated successfully, but these errors were encountered: