requireNullableFields
Whether nullable fields must be present in JSON.
When respectDefaultPresence is true: additionally requires nullable fields even when they have a default value (e.g. val x: String? = null).
When respectDefaultPresence is false:
true: All fields are required (must be present, can be null).false: Only non-nullable fields are required.
Example with requireNullableFields = true:
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
Default: false