-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Description
When using React JSON Schema Form with JSON Schema that includes minItems
property for array validation, the form doesn't properly enforce the minimum items requirement.
Current Behavior
- When a JSON Schema includes
minItems
property for arrays, React JSON Schema Form ignores this validation - Arrays can be empty even when
minItems
is set to a value greater than 0 - No validation errors are shown to users when array length is less than
minItems
Expected Behavior
- React JSON Schema Form should respect the
minItems
property in JSON Schema - Forms should prevent arrays from having fewer items than specified in
minItems
- Validation errors should be shown when array length is less than
minItems
Example Schema
{
"type": "object",
"properties": {
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
}
}
}
Additional Context
This is a common requirement in forms where certain arrays must have at least one item. The minItems
property is a standard part of JSON Schema validation, and it would be beneficial if React JSON Schema Form supported this validation rule.
Possible Workarounds
Currently, we're handling this by:
- Adding custom validation
- Using
required
property (though this doesn't enforce minimum items) - Implementing custom array field templates
Impact
This limitation affects form validation where arrays must have a minimum number of items, which is a common requirement in many applications.
Additional Notes
This is not a bug in the traditional sense, but rather a missing feature that would improve the library's compliance with JSON Schema standards.