Kelvin Rest API 3.0.0: Schema Overwrites Null Value in Patch
Summary:
When patching a user with an email attribute set to null, Kelvin 3.0.0 resets the value to the defined schema instead of leaving it empty as expected. This behavior differs from previous Kelvin versions and the CLI importer, causing unexpected overwriting of cleared values.
Description:
The customer requires a unique “technical” email address in the format <username>@uni.vention.de for students, stored in the LDAP attribute mail.
Students are not intended to use a UCS-based mail solution, making mailPrimaryAddress unnecessary. During import, the system copies the value from mailPrimaryAddress to mail. While the import process generates the mail address correctly, the customer’s application removes the value from mailPrimaryAddress after account creation.
This behavior mirrors the CLI importer, where an empty string clears the mail field. In Kelvin 3.0.0, however, setting the attribute to null no longer clears it; instead, it is reset according to the defined schema.
Providing an empty string as the value for email triggers a validation error, unlike the CLI importer, which accepts it and clears the field.
Expected behavior: Setting email to null should clear the field rather than restoring the schema-generated value.
Root Cause
This issue was introduced in Kelvin 3.0.0 and documented as bug report #58645.
Steps to Reproduce
- Configure Kelvin with the following example configuration in
/var/lib/ucs-school-import/configs/kelvin.json:
{
"maildomain": "lk.univention.de",
"scheme": {"email": "<username>@<maildomain>"}
}
- Create a user.
- Patch the user with:
{"email": "new_mail@ab.univention.de"}
- Patch the user again with:
{"email": null}
- Observe the behavior.
Observed Behavior
- Old behavior (pre-Kelvin 3.0.0 / CLI importer): The email attribute is cleared and remains empty.
- New behavior (Kelvin 3.0.0): The email attribute is reset according to the defined schema.
Expected Behavior
Patching with {"email": null} should clear the email attribute and leave it empty, consistent with previous Kelvin versions and the CLI importer.
Workarounds
Option 1: Hook Adjustment
Remove the user.email attribute in a hook and directly update the udm_property["e-mail"].
Option 2: Downgrade Procedure
To revert to the previous behavior:
univention-app install ucsschool-kelvin-rest-api=2.0.0
univention-app install ucsschool-kelvin-rest-api=2.0.0
Resolution / Fix
A fix has been released in Kelvin 3.1.1 (2025-10-07). This update restores the expected behavior, allowing email attributes to be removed even when a schema is defined.
Changelog: Kelvin Rest API 3.1.1
Upgrade to the latest Kelvin Rest API Version:
univention-app update
univention-app upgrade ucsschool-kelvin-rest-api