Open rbell-mfj opened 1 year ago
If I could get support from my employer to have someone contribute this, is there someone around here to accept a PR? Looks like the last PR merged in this repo was June 2021.
Is the ask here to make it possible to customize what annotations jtd-codegen would use to indicate nullable/non-nullable fields?
And yes, I can accept PRs.
Is the ask here to make it possible to customize what annotations jtd-codegen would use to indicate nullable/non-nullable fields?
In short, yes.
The immediate goal is to have a way to add nullability annotations that allow the Kotlin compiler, when reading Java code generated by jtd-codegen
, to know whether a property is nullable or not. (By default, it treats all Java types as unchecked with regard to nullability). The list of supported annotations for this is here
These would need to be in addition to the existing Jackson annotations.
Customizable sets of annotations for nullable/non-nullable is perhaps the best way to do this as it would enable other use cases.
That said, a simple on/off switch for one predetermined type of nullability annotation (from the list linked above) would also achieve the goal, if we could identify one that made sense as a de-facto standard or most commonly used.
Do you have a preference?
Generated Java code would have better null safety when used in Kotlin if there were an option to add nullability annotations