requireNullableFields
Whether nullable fields must be present in JSON.
Only applies when respectDefaultPresence is false.
When true: Nullable fields ARE in the required array (must be present, can be null). When false: Nullable fields are NOT in the required array (can be omitted).
Example with requireNullableFields = true (strict mode):
fun writeLog(level: String, exception: String? = null)Content copied to clipboard
Generates:
{
"required": ["level", "exception"],
"properties": {
"level": { "type": "string" },
"exception": { "type": ["string", "null"] }
}
}Content copied to clipboard
Example with requireNullableFields = false:
{
"required": ["level"],
"properties": {
"level": { "type": "string" },
"exception": { "type": ["string", "null"] }
}
}Content copied to clipboard
Default: true (Draft 2020-12 strict mode)