Perhaps I'm missing something, but it seems like there's no support for properly generating code/annotations, and therefore ensuring that an object matches the json schema spec for fields which are nullable but required.
The problem is that my JSON spec specifies that the foo field is required while also possibly being null. However, in the generated code, it's flagged as @Nonnull. The difference between specifying a field as possibly being null type versus required is documented on the JSON schema site: "In JSON a property with value null is not equivalent to the property not being present.", as well as here: "It's important to remember that in JSON, null isn't equivalent to something being absent".
Perhaps I'm missing something, but it seems like there's no support for properly generating code/annotations, and therefore ensuring that an object matches the json schema spec for fields which are nullable but required.
Given the following schema:
both properties are generated as follows:
with the following gradle task settings:
The problem is that my JSON spec specifies that the
foo
field is required while also possibly being null. However, in the generated code, it's flagged as@Nonnull
. The difference between specifying a field as possibly being null type versus required is documented on the JSON schema site: "In JSON a property with value null is not equivalent to the property not being present.", as well as here: "It's important to remember that in JSON, null isn't equivalent to something being absent".