-
Bug
-
Resolution: Done
-
Undefined
-
None
-
False
-
-
False
-
-
Before reporting an issue
[X] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
admin/ui
Describe the bug
The user attributes in /[realm]/users/[userId]/settings are incorrectly marked as required when a length validator with min is configured to a number. Unfortunately, the profile settings in the realm settings set the min to a string instead of a number, which makes this more difficult to reproduce.
Adding validator through admin UI in realm settings:
Adding validator through the API with a number instead:
Note that even if a validator with length min: 10 is added to an attribute, it is still not a required attribute, and you can save the form without issues. This is the correct behavior, since fields can be optional but require a minimum length when set. For instance, if you have an optional phone number field and want to validate that the number has a specific length when it's set.
Version
26.0.7
Regression
[ ] The issue is a regression
Expected behavior
Validators with minimum length should not be considered as required. Only the required value should be considered.
Actual behavior
Using the minimum length as an "implicit" required state.
How to Reproduce?
1. Add a user attribute in the realm profile settings with a min length validator set to min: 1 using the Admin CLI API instead of the GUI.
2. Open the edit form of a user.
3. Observe that the field is marked as required, even though the field is not required.
Anything else?
The responsible section of code for this seems to be here:
- links to