-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Prerequisites
- I have read the documentation
What theme are you using?
N/A
Is your feature request related to a problem? Please describe.
We have the following JSON schema structure:
{
"additionalProperties": {
"type": "string"
},
"propertyNames": {
"enum": [
"a",
"b",
"c",
"d"
]
},
"type": "object"
}
The object keys have an enumerated list of allowed values.
react-jsonschema-form
picks this enum
correctly up in the validation:
However, as an end user it is difficult to understand from the generated user interface what is wrong, and what the allowed values are.
Describe the solution you'd like
When key is an enum
with a defined list of allowed values, show it as a dropdown instead of a text input field, in order to support the user in filling in valid values.
Describe alternatives you've considered
Add the allowed values in the enum
to the field description, such that the user have it documented. However, this has the risk of the description and the JSON schema enum
field getting out of sync, and in addition it is quicker for the user to select a valid value from dropdown instead of parsing the description, and writing in a valid string.