[Bug]: JSONForm Select field displays incorrect error message "duplicate values" when options array has labels but no values property
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
The Select field type in a JSONForm is missing some of the newer features of the standard Select widget. It requires an array of objects with a label and value property, and lacks the UI options to assign other property names like the standard Select Widget.
JSONForm Select Field
Standard Select Widget
If you provide an array of objects with other property names, the first error tells you you're missing a label property. Helpful.
If you map the data and provide a label but no value, the error incorrectly says that there are duplicate values, instead of telling you to add a value property.
The inconsistencies between the Select widget, and select fields in a table or JSONForm make it difficult enough to work with select options. But this error is misleading and makes it even harder for users to figure out.
Also, the evaluated value shows an empty array, even though the binding is returning a valid JSON array of unique objects.
Steps To Reproduce
Provide an array of objects to the JSONForm Select field, with unique labels, but no value property.
[{"label":"Development"},{"label":"Marketing"},{"label":"Sales"},{"label":"UX/UI"},{"label":"Product"},{"label":"Support"}]
Public Sample App
No response
Environment
Production
Severity
Medium (Frustrating UX)
Issue video log
No response
Version
Appsmith v1.27.0-SNAPSHOT
Hi @contributor-support, I'd like to pick this up. The cause is in validateArray (app/client/src/workers/Evaluation/validations.ts): the unique-keys check runs before the per-entry validation, and entries without a value key compare as undefined === undefined, so it reports "Duplicate values" and stops before "Missing required key: value" is shown. My plan is to skip undefined keys in the uniqueness comparison so real duplicates are still caught, with unit tests in validations.test.ts. Could you assign it to me? Since this is assigned to the pod, please let me know if someone is already on it.